...
1name: Go
2on: pull_request
3
4permissions:
5 contents: read
6
7jobs:
8 meta:
9 runs-on: ubuntu-22.04
10 steps:
11 - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
12 - uses: tj-actions/changed-files@d6babd6899969df1a11d14c368283ea4436bca78
13 id: changed
14 with:
15 files: |
16 .github/workflows/go.yml
17 go.sum
18 **/*.go
19 **/*.golden
20 **/charts/**
21 files_ignore: |
22 **/Chart.yaml
23 **/README*
24 outputs:
25 changed: ${{ steps.changed.outputs.any_changed }}
26
27 go-lint:
28 needs: meta
29 if: needs.meta.outputs.changed == 'true'
30 timeout-minutes: 10
31 runs-on: ubuntu-22.04
32 container: ghcr.io/linkerd/dev:v43-go
33 steps:
34 - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
35 - run: git config --global --add safe.directory "$PWD" # actions/runner#2033
36 - run: just go-lint --verbose --timeout=10m
37
38 go-format:
39 needs: meta
40 if: needs.meta.outputs.changed == 'true'
41 timeout-minutes: 10
42 runs-on: ubuntu-22.04
43 container: ghcr.io/linkerd/dev:v43-go
44 steps:
45 - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
46 - run: git config --global --add safe.directory "$PWD" # actions/runner#2033
47 - run: just go-fmt
48
49 go-test:
50 needs: meta
51 if: needs.meta.outputs.changed == 'true'
52 timeout-minutes: 10
53 runs-on: ubuntu-22.04
54 container: ghcr.io/linkerd/dev:v43-go
55 steps:
56 - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
57 - run: git config --global --add safe.directory "$PWD" # actions/runner#2033
58 - run: just go-fetch
59 - run: just go-test
60
61 # There's currently one flakey test we want to retry in particular:
62 # TestEndpointProfileTranslator/Handles_overflow
63 go-test-retry:
64 needs: go-test
65 if: failure() && fromJSON(github.run_attempt) < 3
66 runs-on: ubuntu-22.04
67 permissions:
68 actions: write
69 env:
70 GH_REPO: ${{ github.repository }}
71 GH_TOKEN: ${{ github.token }}
72 GH_DEBUG: api
73 REF: ${{ github.head_ref }}
74 steps:
75 - run: gh workflow run rerun.yml -F 'run_id=${{ github.run_id }}' --ref "$REF"
76
77 go-ok:
78 needs: [go-lint, go-format, go-test]
79 if: always()
80 runs-on: ubuntu-22.04
81 steps:
82 - name: Results
83 run: |
84 echo 'go-lint: ${{ needs.go-lint.result }}'
85 echo 'go-format: ${{ needs.go-format.result }}'
86 echo 'go-test: ${{ needs.go-test.result }}'
87
88 - name: Verify jobs
89 # All jobs must succeed or be skipped.
90 if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
91 run: exit 1
View as plain text