-
-
Notifications
You must be signed in to change notification settings - Fork 50
78 lines (77 loc) · 2.8 KB
/
build.yml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: build
on: [push, pull_request]
jobs:
lint:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name)
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
- uses: actions/checkout@v4
- uses: golangci/golangci-lint-action@v3
with:
version: v1.57.2
test:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name)
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
- uses: actions/checkout@v4
- run: go build ./cmd/goverter
- run: go test -coverpkg ./... -coverprofile=coverage.txt -covermode=atomic ./...
- run: grep -v '/example/' coverage.txt > filtered-coverage.txt
- uses: codecov/codecov-action@v4
with:
disable_search: true
files: ./filtered-coverage.txt
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test_go118:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name)
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.18.x
- uses: actions/checkout@v4
- run: go build ./cmd/goverter
- run: go test ./...
env:
SKIP_VERSION_DEPENDENT: 'true'
generate:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name)
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21.x"
- uses: actions/checkout@v4
- run: mkdir covdata
- run: GOCOVERDIR="$PWD/covdata" go generate ./...
- run: go tool covdata textfmt -i=./covdata -o example-coverage.txt
- uses: codecov/codecov-action@v4
with:
disable_search: true
files: ./example-coverage.txt
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- run: git diff --exit-code
- if: failure()
run: echo "::error::Check failed, please run 'go generate ./...' and commit the changes."
build_docs:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
cache-dependency-path: docs/yarn.lock
- working-directory: docs
run: |
yarn install --frozen-lockfile
yarn docs:build