Skip to content

Commit

Permalink
internal/ci: add Go 1.18 and bump action and Go versions
Browse files Browse the repository at this point in the history
Add Go 1.18 as the latest stable version,
as all of our tests are nearly passing with it at this point.

We also stop pinning the exact Go versions for running the tests,
because they should always be running on the latest bugfix release.
We can drop the exact version pinning from code generation too,
now that qgo is no longer used as part of `go generate`.
We do keep the pinning for the releases, for reproducibility.

There have been a few bugfix Go releases recently.
The official GitHub Actions for setup-go, checkout, and cache
all have jumped to v3 now.

Beyond a number of fixes, the only notable change is that setup-go now
works with Go pre-release tags without needing `stable: false`.

While here, I noticed that the cue.mod/module.cue file in the github
test was buggy: it was missing the cue extension and had bad syntax.

Fixes #1619.

Change-Id: Ib12004d7856ac3702cd2a1e370e7f66211ecccdb
Signed-off-by: Daniel Martí <[email protected]>
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/536099
Unity-Result: CUEcueckoo <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Marcel van Lohuizen <[email protected]>
  • Loading branch information
mvdan authored and mpvl committed Apr 19, 2022
1 parent 05f74a8 commit dc2c9e0
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 113 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ jobs:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.17.3
stable: false
go-version: 1.18.1
- name: Setup qemu
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ jobs:
fail-fast: false
matrix:
go-version:
- 1.16.10
- 1.17.3
- 1.16.x
- 1.17.x
- 1.18.x
os:
- ubuntu-18.04
- macos-10.15
Expand All @@ -53,27 +54,26 @@ jobs:
EOD
chmod 600 ~/.netrc
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
stable: false
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Cache Go modules
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-${{ matrix.go-version }}-go-
- if: ${{ github.ref == 'refs/heads/master' }}
name: Set go build tags
run: go env -w GOFLAGS=-tags=long
- if: matrix.go-version == '1.16.10' && matrix.os == 'ubuntu-18.04'
- if: matrix.go-version == '1.16.x' && matrix.os == 'ubuntu-18.04'
name: Generate
run: go generate ./...
- name: Test
run: go test ./...
- if: ${{ matrix.go-version == '1.17.3' && matrix.os == 'ubuntu-18.04' }}
- if: ${{ matrix.go-version == '1.18.x' && matrix.os == 'ubuntu-18.04' }}
name: Test with -race
run: go test -race ./...
- name: gorelease check
Expand Down
67 changes: 36 additions & 31 deletions cmd/cue/cmd/testdata/script/cmd_github.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ cmp .github/workflows/repository_dispatch.yml .github/workflows/repository_dispa
cmp .github/workflows/test.yml .github/workflows/test.yml.golden
cmp .github/workflows/tip_triggers.yml .github/workflows/tip_triggers.yml.golden

-- cue.mod/module --
module "cuelang.org/go"
-- cue.mod/module.cue --
module: "cuelang.org/go"
-- .github/workflows/mirror.yml.golden --
# Generated by internal/ci/ci_tool.cue; do not edit

Expand Down Expand Up @@ -62,14 +62,13 @@ jobs:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.17.3
stable: false
go-version: 1.18.1
- name: Setup qemu
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
Expand Down Expand Up @@ -160,8 +159,9 @@ jobs:
fail-fast: false
matrix:
go-version:
- 1.16.10
- 1.17.3
- 1.16.x
- 1.17.x
- 1.18.x
os:
- ubuntu-18.04
- macos-10.15
Expand All @@ -180,27 +180,26 @@ jobs:
EOD
chmod 600 ~/.netrc
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
stable: false
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Cache Go modules
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-${{ matrix.go-version }}-go-
- if: ${{ github.ref == 'refs/heads/master' }}
name: Set go build tags
run: go env -w GOFLAGS=-tags=long
- if: matrix.go-version == '1.16.10' && matrix.os == 'ubuntu-18.04'
- if: matrix.go-version == '1.16.x' && matrix.os == 'ubuntu-18.04'
name: Generate
run: go generate ./...
- name: Test
run: go test ./...
- if: ${{ matrix.go-version == '1.17.3' && matrix.os == 'ubuntu-18.04' }}
- if: ${{ matrix.go-version == '1.18.x' && matrix.os == 'ubuntu-18.04' }}
name: Test with -race
run: go test -race ./...
- name: gorelease check
Expand Down Expand Up @@ -1239,7 +1238,7 @@ release: _#bashWorkflow & {
steps: [_#checkoutCode & {
with: "fetch-depth": 0
}, _#installGo & {
with: "go-version": _#latestStableGo
with: "go-version": _#pinnedReleaseGo
}, _#step & {
name: "Setup qemu"
uses: "docker/setup-qemu-action@v1"
Expand Down Expand Up @@ -1319,18 +1318,27 @@ _#step: ((_#job & {
steps: _
}).steps & [_])[0]

// We use the latest go1.16 for code generation
_#codeGenGo: "1.16.10"

// Use a specific latest version for release builds
_#latestStableGo: "1.17.3"
_#linuxMachine: "ubuntu-18.04"
_#macosMachine: "macos-10.15"
_#windowsMachine: "windows-2019"
// We use the oldest supported Go version for code generation.
// TODO(mvdan): now that we don't use qgo via go:generate,
// we should try to use latestStableGo for code generation,
// which is closer to how developers will run go generate.
_#codeGenGo: "1.16.x"

// Use the latest Go version for extra checks,
// such as running tests with the data race detector.
_#latestStableGo: "1.18.x"

// Use a specific latest version for release builds.
// Note that we don't want ".x" for the sake of reproducibility,
// so we instead pin a specific Go release.
_#pinnedReleaseGo: "1.18.1"
_#linuxMachine: "ubuntu-18.04"
_#macosMachine: "macos-10.15"
_#windowsMachine: "windows-2019"
_#testStrategy: {
"fail-fast": false
matrix: {
"go-version": [_#codeGenGo, _#latestStableGo]
"go-version": [_#codeGenGo, "1.17.x", _#latestStableGo]
os: [_#linuxMachine, _#macosMachine, _#windowsMachine]
}
}
Expand All @@ -1341,19 +1349,16 @@ _#setGoBuildTags: _#step & {
}
_#installGo: _#step & {
name: "Install Go"
uses: "actions/setup-go@v2"
with: {
"go-version": *"${{ matrix.go-version }}" | string
stable: false
}
uses: "actions/setup-go@v3"
with: "go-version": *"${{ matrix.go-version }}" | string
}
_#checkoutCode: _#step & {
name: "Checkout code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
}
_#cacheGoModules: _#step & {
name: "Cache Go modules"
uses: "actions/cache@v2"
uses: "actions/cache@v3"
with: {
path: "~/go/pkg/mod"
key: "${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}"
Expand Down
Loading

0 comments on commit dc2c9e0

Please sign in to comment.