-
Notifications
You must be signed in to change notification settings - Fork 4
103 lines (97 loc) · 3.76 KB
/
ci.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: CI
on:
push:
branches: [ main ]
pull_request:
permissions:
contents: read # for actions/checkout to fetch code
jobs:
formatting:
name: runner / formatting
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- name: Format
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
- name: Run go vet
run: go vet ./...
golangci-lint:
name: runner / golangci-lint
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
fail_on_error: true
golangci_lint_flags: "--config=.github/.golangci.yml ./..."
yamllint:
name: runner / yamllint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- uses: reviewdog/action-yamllint@v1
with:
fail_on_error: true
reporter: github-pr-review
yamllint_flags: '-d "{extends: default, rules: {truthy: disable}}" .'
dotenv-linter:
name: runner / dotenv-linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- uses: dotenv-linter/action-dotenv-linter@v2
with:
reporter: github-pr-review
check-dependencies:
name: runner / check-dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7
- name: WriteGoList
run: go list -json -m all > go.list
- name: Nancy
uses: sonatype-nexus-community/nancy-github-action@main
continue-on-error: true
- name: "Dependency Review"
uses: actions/dependency-review-action@0c155c5e8556a497adf53f2c18edabf945ed8e70 # v4.3.2
tests:
name: runner / build and tests
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.20.x, 1.21.x, 1.22.x]
os: [windows-2019, windows-2022, ubuntu-22.04, ubuntu-20.04]
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: Install Test Converter and run tests
run: |
export GOPATH="$HOME/go/"
export PATH=$PATH:$GOPATH/bin
go install github.com/jstemmer/go-junit-report/v2@latest
go test -covermode=atomic -coverprofile=coverage.out -race -v ./... > test_output.txt 2>&1 || true
cat test_output.txt
cat test_output.txt | go-junit-report -set-exit-code > junit-${{matrix.os}}-${{matrix.go-version}}-${{github.run_attempt}}.xml
if grep -q "FAIL" test_output.txt; then exit 1; fi
- name: Upload Coverage Results
uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be # v4.3.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: GitHub Upload Release Artifacts
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: JUnit Results ${{matrix.os}}-${{matrix.go-version}}-${{github.run_attempt}}
path: junit-${{matrix.os}}-${{matrix.go-version}}-${{github.run_attempt}}.xml
# - name: Integration tests
# run: "docker-compose up \
# --build \
# --abort-on-container-exit \
# --exit-code-from integration"