-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (45 loc) · 1.41 KB
/
build-push.yml
File metadata and controls
55 lines (45 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: build-push
on:
push:
workflow_dispatch:
jobs:
lint-test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
- name: Set up Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
with:
go-version-file: "go.mod"
- name: go mod tidy
run: |
go mod tidy
if ! git diff --exit-code go.mod go.sum; then
echo "Error: go.mod or go.sum is not tidy. Run 'go mod tidy' locally and commit the changes."
exit 1
fi
- name: golangci-lint
uses: golangci/golangci-lint-action@e7fa5ac41e1cf5b7d48e45e42232ce7ada589601 # v9
with:
version: latest
- name: Install dependencies
run: go get .
- run: go build
- name: unit test
run: go test -race -v ./...
- name: coverage
run: go test -v -coverprofile=coverage.out -covermode=atomic ./...
- name: upload coverage to codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5
with:
files: ./coverage.out
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run:
needs: [lint-test]
uses: libops/.github/.github/workflows/build-push-ghcr.yaml@main
permissions:
contents: read
packages: write
secrets: inherit