-
Notifications
You must be signed in to change notification settings - Fork 1.3k
68 lines (60 loc) · 2.28 KB
/
Copy pathgo.yml
File metadata and controls
68 lines (60 loc) · 2.28 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
56
57
58
59
60
61
62
63
64
65
66
67
68
---
name: Go
on:
pull_request:
push:
branches:
- main
- "release-*"
# Modified to avoid canceling all matrix jobs when one fails
# Each job type will have its own concurrency group
concurrency:
group: ${{ github.workflow }}-${{ github.job }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }}
cancel-in-progress: true
# Minimal permissions to be inherited by any job that don't declare it's own permissions
permissions:
contents: read
jobs:
supportedVersions:
name: Fetch supported Go versions
runs-on: ubuntu-latest
outputs:
supported_versions: ${{ steps.matrix.outputs.supported_versions }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Read supported_go_versions.txt
id: matrix
run: |
versions=$(cat supported_go_versions.txt)
matrix="[$(echo "$versions" | sed 's/\(.*\)/"\1"/' | paste -s -d,)]"
echo "supported_versions=$matrix" >> $GITHUB_OUTPUT
test:
name: Tests (${{ matrix.go_version }})
runs-on: ubuntu-latest
needs: supportedVersions
# Set fail-fast to false to ensure all Go versions are tested regardless of failures
strategy:
fail-fast: false
matrix:
go_version: ${{ fromJSON(needs.supportedVersions.outputs.supported_versions) }}
# Define concurrency at the job level for matrix jobs
concurrency:
group: ${{ github.workflow }}-test-${{ matrix.go_version }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v5.5.0
with:
go-version: ${{ matrix.go_version }}
check-latest: true
cache-dependency-path: go.sum
- name: Run tests and check license
run: make check_license test
env:
CI: true
- name: Run style and unused
if: ${{ matrix.go_version == '1.22' }}
run: make style unused