TryBot #529
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Code generated internal/ci/ci_tool.cue; DO NOT EDIT. | |
name: TryBot | |
"on": | |
push: | |
branches: | |
- ci/test | |
- master | |
- release-branch.* | |
tags-ignore: | |
- v* | |
workflow_dispatch: {} | |
pull_request_target: {} | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
go-version: | |
- 1.22.x | |
- 1.23.x | |
runner: | |
- ubuntu-24.04 | |
- macos-14 | |
- windows-2022 | |
runs-on: ${{ matrix.runner }} | |
if: |- | |
(contains(github.event.head_commit.message, ' | |
Dispatch-Trailer: {"type":"trybot"')) || ! (contains(github.event.head_commit.message, ' | |
Dispatch-Trailer: {"type":"')) | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Reset git directory modification times | |
run: touch -t 202211302355 $(find * -type d) | |
- name: Restore git file modification times | |
uses: chetan/git-restore-mtime-action@075f9bc9d159805603419d50f794bd9f33252ebe | |
- id: DispatchTrailer | |
name: Try to extract Dispatch-Trailer | |
run: |- | |
x="$(git log -1 --pretty='%(trailers:key=Dispatch-Trailer,valueonly)')" | |
if [[ "$x" == "" ]] | |
then | |
# Some steps rely on the presence or otherwise of the Dispatch-Trailer. | |
# We know that we don't have a Dispatch-Trailer in this situation, | |
# hence we use the JSON value null in order to represent that state. | |
# This means that GitHub expressions can determine whether a Dispatch-Trailer | |
# is present or not by checking whether the fromJSON() result of the | |
# output from this step is the JSON value null or not. | |
x=null | |
fi | |
echo "value<<EOD" >> $GITHUB_OUTPUT | |
echo "$x" >> $GITHUB_OUTPUT | |
echo "EOD" >> $GITHUB_OUTPUT | |
- if: |- | |
((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' | |
Dispatch-Trailer: {"type":"')))) && (contains(github.event.head_commit.message, ' | |
Dispatch-Trailer: {"type":"')) | |
name: Check we don't have Dispatch-Trailer on a protected branch | |
run: |- | |
echo "github.event.head_commit.message contains Dispatch-Trailer but we are on a protected branch" | |
false | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
cache: false | |
go-version: ${{ matrix.go-version }} | |
- name: Set common go env vars | |
run: |- | |
go env -w GOTOOLCHAIN=local | |
# Dump env for good measure | |
go env | |
- id: go-mod-cache-dir | |
name: Get go mod cache directory | |
run: echo "dir=$(go env GOMODCACHE)" >> ${GITHUB_OUTPUT} | |
- id: go-cache-dir | |
name: Get go build/test cache directory | |
run: echo "dir=$(go env GOCACHE)" >> ${GITHUB_OUTPUT} | |
- if: |- | |
(((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' | |
Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) | |
uses: actions/cache@v4 | |
with: | |
path: |- | |
${{ steps.go-mod-cache-dir.outputs.dir }}/cache/download | |
${{ steps.go-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-${{ matrix.go-version }}-${{ github.run_id }} | |
restore-keys: ${{ runner.os }}-${{ matrix.go-version }} | |
- if: |- | |
! (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' | |
Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) | |
uses: actions/cache/restore@v4 | |
with: | |
path: |- | |
${{ steps.go-mod-cache-dir.outputs.dir }}/cache/download | |
${{ steps.go-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-${{ matrix.go-version }}-${{ github.run_id }} | |
restore-keys: ${{ runner.os }}-${{ matrix.go-version }} | |
- if: |- | |
github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' | |
Dispatch-Trailer: {"type":"')))) || github.ref == 'refs/heads/ci/test') | |
run: go clean -testcache | |
- if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-24.04') | |
name: Early git and code sanity checks | |
run: go run ./internal/ci/checks | |
- if: |- | |
((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' | |
Dispatch-Trailer: {"type":"')))) || !(matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-24.04') | |
name: Test | |
run: go test ./... | |
- if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-24.04') | |
name: Test with -race | |
run: go test -race ./... | |
env: | |
GORACE: atexit_sleep_ms=10 | |
- if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-24.04') | |
name: Test on 32 bits | |
run: go test -short ./... | |
env: | |
GOARCH: "386" | |
- name: Test with -tags=cuewasm | |
run: go test -tags cuewasm ./cmd/cue/cmd ./cue/interpreter/wasm | |
- name: gcloud auth for end-to-end tests | |
id: auth | |
if: |- | |
github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' | |
Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) && (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-24.04') | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.E2E_GCLOUD_KEY }} | |
- if: |- | |
github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' | |
Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) && (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-24.04') | |
name: gcloud setup for end-to-end tests | |
uses: google-github-actions/setup-gcloud@v2 | |
- if: |- | |
github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' | |
Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) && (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-24.04') | |
name: End-to-end test | |
env: | |
CUE_TEST_TOKEN: ${{ secrets.E2E_PORCUEPINE_CUE_TOKEN }} | |
run: |- | |
cd internal/_e2e | |
go test -race | |
- if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-24.04') | |
name: Go checks | |
run: |- | |
go vet ./... | |
go mod tidy | |
(cd internal/_e2e && go test -run=-) | |
- if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-24.04') | |
name: staticcheck | |
uses: dominikh/staticcheck-action@v1 | |
with: | |
version: 2024.1.1 | |
install-go: false | |
- if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-24.04') | |
name: Check all git tags are available | |
run: |- | |
cd $(mktemp -d) | |
git ls-remote --tags https://github.com/cue-lang/cue >github.txt | |
echo "GitHub tags:" | |
sed 's/^/ /' github.txt | |
git ls-remote --tags https://review.gerrithub.io/cue-lang/cue >gerrit.txt | |
if ! diff -u github.txt gerrit.txt; then | |
echo "GitHub and Gerrit do not agree on the list of tags!" | |
echo "Did you forget about refs/attic branches? https://github.com/cue-lang/cue/wiki/Notes-for-project-maintainers" | |
exit 1 | |
fi | |
- if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-24.04') | |
name: Generate | |
run: |- | |
go run cuelang.org/go/cmd/cue login --token=${CUE_TOKEN} | |
go generate ./... | |
env: | |
CUE_TOKEN: ${{ secrets.NOTCUECKOO_CUE_TOKEN }} | |
- if: always() | |
name: Check that git is clean at the end of the job | |
run: test -z "$(git status --porcelain)" || (git status; git diff; false) |