Debian Codegraph @

.github/workflows/test.yaml

raw
1 ---
2 name: test
3
4 on: ["push", "pull_request"]
5
6 env:
7 GO_VERSION: "1.22"
8 LINUX_ARCHES: "amd64 386 arm arm64 s390x mips64le ppc64le"
9
10 jobs:
11 lint:
12 name: Lint
13 permissions:
14 contents: read
15 pull-requests: read
16 runs-on: ubuntu-latest
17 steps:
18 - name: setup go
19 uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
20 with:
21 go-version: ${{ env.GO_VERSION }}
22
23 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
24
25 - uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1
26 with:
27 format: auto
28 config_file: .yamllint.yaml
29
30 - uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
31 with:
32 args: --verbose
33 version: v1.57.1
34
35 build:
36 name: Build all linux architectures
37 needs: lint
38 runs-on: ubuntu-latest
39 steps:
40 - name: setup go
41 uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
42 with:
43 go-version: ${{ env.GO_VERSION }}
44
45 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
46
47 - name: Build on all supported architectures
48 run: |
49 set -e
50 for arch in ${LINUX_ARCHES}; do
51 echo "Building for arch $arch"
52 GOARCH=$arch go build ./...
53 done
54
55 test-linux:
56 name: Run tests on Linux amd64
57 needs: build
58 runs-on: ubuntu-latest
59 steps:
60 - name: setup go
61 uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
62 with:
63 go-version: ${{ env.GO_VERSION }}
64
65 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
66
67 - name: Install test binaries
68 run: |
69 go install github.com/mattn/[email protected]
70 go install github.com/modocache/gover@latest
71
72 - name: test
73 run: COVERALLS=1 ./test.sh
74
75 - env:
76 COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77 name: Send coverage to coveralls
78 run: |
79 PATH=$PATH:$(go env GOPATH)/bin
80 gover
81 goveralls -coverprofile=gover.coverprofile -service=github
82
83 test-win:
84 name: Build and run tests on Windows
85 needs: build
86 runs-on: windows-latest
87 steps:
88 - name: setup go
89 uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
90 with:
91 go-version: ${{ env.GO_VERSION }}
92
93 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
94
95 - name: test
96 run: bash ./test.sh