|
8 | 8 | pull_request:
|
9 | 9 |
|
10 | 10 | env:
|
11 |
| - GO_VERSION: 1.24.x |
| 11 | + GO_VERSION: 1.24 |
12 | 12 | GOTOOLCHAIN: local
|
| 13 | + GO_INSTALL_DESTINATION: /opt |
13 | 14 |
|
14 | 15 | jobs:
|
15 |
| - go: |
| 16 | + go_current: |
16 | 17 | timeout-minutes: 5
|
17 |
| - name: "go | ${{ matrix.goos }} | ${{ matrix.canary }}" |
18 |
| - runs-on: "${{ matrix.os }}" |
19 |
| - defaults: |
20 |
| - run: |
21 |
| - shell: bash |
22 |
| - strategy: |
23 |
| - fail-fast: false |
24 |
| - matrix: |
25 |
| - include: |
26 |
| - - os: ubuntu-24.04 |
27 |
| - goos: linux |
28 |
| - - os: ubuntu-24.04 |
29 |
| - goos: freebsd |
30 |
| - # FIXME: this is currently failing in a non-sensical way, so, running on linux instead... |
31 |
| - # - os: windows-2022 |
32 |
| - - os: ubuntu-24.04 |
33 |
| - goos: windows |
34 |
| - - os: ubuntu-24.04 |
35 |
| - goos: linux |
36 |
| - # This allows the canary script to select any upcoming golang alpha/beta/RC |
37 |
| - canary: go-canary |
| 18 | + name: "go stable" |
| 19 | + runs-on: ubuntu-24.04 |
| 20 | + steps: |
| 21 | + # First, setup: clone, install go (with cache), install dev tools (with cache) |
| 22 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 23 | + with: |
| 24 | + fetch-depth: 100 |
| 25 | + - name: Environment setup |
| 26 | + run: | |
| 27 | + echo "GO_VERSION=$(make install-go-resolve-version)" >> "$GITHUB_ENV" |
| 28 | + echo "PATH=$GO_INSTALL_DESTINATION/go/bin:$HOME/go/bin:$PATH" >> "$GITHUB_ENV" |
| 29 | + - uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 |
| 30 | + id: cache-go |
| 31 | + with: |
| 32 | + path: /opt/go |
| 33 | + key: golang-${{ env.GO_VERSION }} |
| 34 | + - uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 |
| 35 | + id: cache-go-dev |
| 36 | + with: |
| 37 | + path: ~/go/bin |
| 38 | + key: golang-dev-${{ env.GO_VERSION }}-${{ hashFiles('Makefile') }} |
| 39 | + - if: ${{ steps.cache-go.outputs.cache-hit != 'true' }} |
| 40 | + name: Install go |
| 41 | + continue-on-error: false |
| 42 | + run: make install-go |
| 43 | + - if: ${{ steps.cache-go-dev.outputs.cache-hit != 'true' }} |
| 44 | + name: Install dev tools |
| 45 | + continue-on-error: false |
| 46 | + run: make install-dev-tools |
| 47 | + |
| 48 | + - name: imports |
| 49 | + run: make lint-imports |
| 50 | + - name: mod |
| 51 | + run: make lint-mod |
| 52 | + - name: go |
| 53 | + run: make lint-go-all |
| 54 | + - name: go |
| 55 | + # This is duplicating some of the work done in projects-check (which uses an old / buggy version |
| 56 | + # of go-licenses, and also only test for linux). |
| 57 | + run: make lint-licenses-all |
| 58 | + |
| 59 | + go_canary: |
| 60 | + timeout-minutes: 5 |
| 61 | + name: "go canary" |
| 62 | + runs-on: ubuntu-24.04 |
38 | 63 | env:
|
39 |
| - GOOS: "${{ matrix.goos }}" |
| 64 | + GO_VERSION: canary |
40 | 65 | steps:
|
41 | 66 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
42 | 67 | with:
|
43 | 68 | fetch-depth: 1
|
44 |
| - - name: Set GO env |
| 69 | + - name: Environment setup |
45 | 70 | run: |
|
46 |
| - # If canary is specified, get the latest available golang pre-release instead of the major version |
47 |
| - if [ "$canary" != "" ]; then |
48 |
| - . ./hack/build-integration-canary.sh |
49 |
| - canary::golang::latest |
50 |
| - fi |
51 |
| - - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 |
| 71 | + echo "GO_VERSION=$(make install-go-resolve-version)" >> "$GITHUB_ENV" |
| 72 | + echo "PATH=$GO_INSTALL_DESTINATION/go/bin:$HOME/go/bin:$PATH" >> "$GITHUB_ENV" |
| 73 | + - uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 |
| 74 | + id: cache-go |
52 | 75 | with:
|
53 |
| - go-version: ${{ env.GO_VERSION }} |
54 |
| - check-latest: true |
55 |
| - - name: golangci-lint |
56 |
| - uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0 |
| 76 | + path: /opt/go |
| 77 | + key: golang-${{ env.GO_VERSION }} |
| 78 | + - uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 |
| 79 | + id: cache-go-dev |
57 | 80 | with:
|
58 |
| - args: --verbose |
59 |
| - # See https://github.com/containerd/nerdctl/issues/3914 |
60 |
| - verify: false |
| 81 | + path: ~/go/bin |
| 82 | + key: golang-dev-${{ env.GO_VERSION }}-${{ hashFiles('Makefile') }} |
| 83 | + - if: ${{ steps.cache-go.outputs.cache-hit != 'true' }} |
| 84 | + name: Install go |
| 85 | + run: make install-go |
| 86 | + - if: ${{ steps.cache-go-dev.outputs.cache-hit != 'true' }} |
| 87 | + name: Install dev tools |
| 88 | + run: make install-dev-tools |
| 89 | + |
| 90 | + - name: imports |
| 91 | + run: make lint-imports |
| 92 | + - name: mod |
| 93 | + run: make lint-mod |
| 94 | + - name: go |
| 95 | + run: make lint-go-all |
| 96 | + |
61 | 97 | other:
|
62 | 98 | timeout-minutes: 5
|
63 |
| - name: yaml | shell | imports order |
| 99 | + name: "yaml | shell" |
64 | 100 | runs-on: ubuntu-24.04
|
65 | 101 | steps:
|
66 | 102 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
67 | 103 | with:
|
68 | 104 | fetch-depth: 1
|
69 |
| - - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 |
70 |
| - with: |
71 |
| - go-version: ${{ env.GO_VERSION }} |
72 |
| - check-latest: true |
73 |
| - - name: install required linters and dev-tools |
74 |
| - run: | |
75 |
| - make install-dev-tools |
76 |
| - - name: yaml |
| 105 | + - name: make lint-yaml |
77 | 106 | run: make lint-yaml
|
78 |
| - - name: shell |
| 107 | + - name: make lint-shell |
79 | 108 | run: make lint-shell
|
80 |
| - - name: go imports ordering |
81 |
| - run: | |
82 |
| - make lint-imports |
|
0 commit comments