Debian Codegraph @

.github/workflows/go.yaml

raw symbols SCIP
1 # Copyright 2025 The go-yaml Project Contributors
2 # SPDX-License-Identifier: Apache-2.0
3
4 name: Go
5
6 on:
7 push:
8 branches: [ main, v3, v2, v1 ]
9 pull_request:
10 branches: [ main, v3, v2, v1 ]
11
12 permissions: read-all
13
14 jobs:
15 test:
16 runs-on: ubuntu-latest
17 needs: go-versions
18 continue-on-error: true # make sure to run all versions, even if one fails
19
20 strategy:
21 fail-fast: false
22 matrix:
23 go-version: ${{ fromJSON(needs.go-versions.outputs.versions) }}
24
25 steps:
26 - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
27 with: {persist-credentials: false}
28
29 - name: Run all unit tests w/ -cover, all YTS tests and go lint
30 run: make test lint v=1 cover=1 GO-VERSION=${{ matrix.go-version }}
31
32 test-cross-platform:
33 name: Test on ${{ matrix.GOOS }}/${{ matrix.GOARCH }}
34 runs-on: ${{ matrix.os }}
35 continue-on-error: true # make sure to run all platforms, even if one fails
36
37 strategy:
38 fail-fast: false
39 matrix:
40 include:
41 - os: macos-latest
42 GOOS: darwin
43 GOARCH: amd64
44 test-args: -race
45 - os: macos-latest
46 GOOS: darwin
47 GOARCH: arm64
48 test-args: -race
49 - os: windows-latest
50 GOOS: windows
51 GOARCH: amd64
52 test-args: -race
53 - os: ubuntu-latest
54 GOOS: linux
55 GOARCH: 386
56 test-args: '' # race is not available on 32 bits architecture
57 - os: windows-latest
58 GOOS: windows
59 GOARCH: 386
60 test-args: '' # race is not available on 32 bits architecture
61
62 env:
63 GOARCH: ${{ matrix.GOARCH }}
64 GOOS: ${{ matrix.GOOS }}
65
66 steps:
67 - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
68 with: {persist-credentials: false}
69
70 - name: Run tests
71 run: |
72 bash -c 'echo + $OSTYPE + $MACHTYPE +'
73 make test-main test-internal v=1 o=${{ matrix.test-args }}
74
75 go-versions:
76 name: Lookup Go versions
77 runs-on: ubuntu-latest
78 outputs:
79 versions: ${{ steps.latest-patch-versions.outputs.matrix }}
80
81 steps:
82 - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
83
84 - name: Get latest patch for each minor version
85 # yamllint disable-line rule:line-length
86 uses: arnested/go-version-action@6343454db06c63467680c5dc1f4f382fe9fe6303 # v2.1.2
87 id: latest-patch-versions
88 with:
89 latest-patches-only: true
90 patch-level: true