Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
ci: only run gorelease check on latest versions of Go
Browse files Browse the repository at this point in the history
Also tidy up use of go generate to declare a go:generate directive that
runs go generate for the .github/workflows package (that is otherwise
not found by ./... from the root).

Change-Id: I6cae310b78f9cc17f84942298c53000c7dea7812
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6221
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
  • Loading branch information
myitcv committed May 28, 2020
1 parent 2f69bfa commit c47316f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ jobs:
restore-keys: ${{ runner.os }}-${{ matrix.go-version }}-go-
- name: Generate
if: matrix.go-version == '1.14.3' && matrix.os != 'windows-latest'
run: |-
go generate ./...
go generate ./.github/workflows
run: go generate ./...
- name: Test
run: go test ./...
- name: Test with -race
run: go test -race ./...
- name: gorelease check
if: matrix.go-version == '1.14.3' || matrix.go-version == '1.13.x'
run: go run golang.org/x/exp/cmd/gorelease
- name: Check that git is clean post generate and tests
run: test -z "$(git status --porcelain)" || (git status; git diff; false)
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@ jobs:
restore-keys: ${{ runner.os }}-${{ matrix.go-version }}-go-
- name: Generate
if: matrix.go-version == '1.14.3' && matrix.os != 'windows-latest'
run: |-
go generate ./...
go generate ./.github/workflows
run: go generate ./...
- name: Test
run: go test ./...
- name: Test with -race
run: go test -race ./...
- name: gorelease check
if: matrix.go-version == '1.14.3' || matrix.go-version == '1.13.x'
run: go run golang.org/x/exp/cmd/gorelease
- name: Check that git is clean post generate and tests
run: test -z "$(git status --porcelain)" || (git status; git diff; false)
Expand Down
3 changes: 3 additions & 0 deletions gen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package cue

//go:generate go generate ./.github/workflows
14 changes: 8 additions & 6 deletions internal/ci/workflows.cue
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ workflows: [
#job: (json.#Workflow.jobs & {x: _}).x
#step: ((#job & {steps: _}).steps & [_])[0]

#latestGo: "1.14.3"

#testStrategy: {
"fail-fast": false
matrix: {
// Use a stable version of 1.14.x for go generate
"go-version": ["1.12.x", "1.13.x", "1.14.3"]
"go-version": ["1.12.x", "1.13.x", #latestGo]
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
}
}
Expand Down Expand Up @@ -67,13 +69,10 @@ workflows: [

#goGenerate: #step & {
name: "Generate"
run: """
go generate ./...
go generate ./.github/workflows
"""
run: "go generate ./..."
// The Go version corresponds to the precise 1.14.x version specified in
// the matrix. Skip windows for now until we work out why re-gen is flaky
if: "matrix.go-version == '1.14.3' && matrix.os != 'windows-latest'"
if: "matrix.go-version == '\(#latestGo)' && matrix.os != 'windows-latest'"
}

#goTest: #step & {
Expand All @@ -89,6 +88,9 @@ workflows: [
#goReleaseCheck: #step & {
name: "gorelease check"
run: "go run golang.org/x/exp/cmd/gorelease"
// Only run on 1.13.x and latest Go for now. Bug with Go 1.12.x means
// this check fails
if: "matrix.go-version == '\(#latestGo)' || matrix.go-version == '1.13.x'"
}

#checkGitClean: #step & {
Expand Down

0 comments on commit c47316f

Please sign in to comment.