cuelang.org/go@v0.10.1/.github/workflows/trybot.yml (about) 1 # Code generated internal/ci/ci_tool.cue; DO NOT EDIT. 2 3 name: TryBot 4 "on": 5 push: 6 branches: 7 - ci/test 8 - master 9 - release-branch.* 10 tags-ignore: 11 - v* 12 pull_request: {} 13 workflow_dispatch: {} 14 jobs: 15 test: 16 strategy: 17 fail-fast: false 18 matrix: 19 go-version: 20 - 1.22.x 21 - 1.23.x 22 runner: 23 - ubuntu-22.04 24 - macos-14 25 - windows-2022 26 runs-on: ${{ matrix.runner }} 27 defaults: 28 run: 29 shell: bash 30 if: |- 31 (contains(github.event.head_commit.message, ' 32 Dispatch-Trailer: {"type":"trybot"')) || ! (contains(github.event.head_commit.message, ' 33 Dispatch-Trailer: {"type":"')) 34 steps: 35 - name: Checkout code 36 uses: actions/checkout@v4 37 with: 38 ref: ${{ github.event.pull_request.head.sha }} 39 fetch-depth: 0 40 - name: Reset git directory modification times 41 run: touch -t 202211302355 $(find * -type d) 42 - name: Restore git file modification times 43 uses: chetan/git-restore-mtime-action@075f9bc9d159805603419d50f794bd9f33252ebe 44 - id: DispatchTrailer 45 name: Try to extract Dispatch-Trailer 46 run: |- 47 x="$(git log -1 --pretty='%(trailers:key=Dispatch-Trailer,valueonly)')" 48 if [[ "$x" == "" ]] 49 then 50 # Some steps rely on the presence or otherwise of the Dispatch-Trailer. 51 # We know that we don't have a Dispatch-Trailer in this situation, 52 # hence we use the JSON value null in order to represent that state. 53 # This means that GitHub expressions can determine whether a Dispatch-Trailer 54 # is present or not by checking whether the fromJSON() result of the 55 # output from this step is the JSON value null or not. 56 x=null 57 fi 58 echo "value<<EOD" >> $GITHUB_OUTPUT 59 echo "$x" >> $GITHUB_OUTPUT 60 echo "EOD" >> $GITHUB_OUTPUT 61 - if: |- 62 ((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' 63 Dispatch-Trailer: {"type":"')))) && (contains(github.event.head_commit.message, ' 64 Dispatch-Trailer: {"type":"')) 65 name: Check we don't have Dispatch-Trailer on a protected branch 66 run: |- 67 echo "github.event.head_commit.message contains Dispatch-Trailer but we are on a protected branch" 68 false 69 - name: Install Go 70 uses: actions/setup-go@v5 71 with: 72 cache: false 73 go-version: ${{ matrix.go-version }} 74 - id: go-mod-cache-dir 75 name: Get go mod cache directory 76 run: echo "dir=$(go env GOMODCACHE)" >> ${GITHUB_OUTPUT} 77 - id: go-cache-dir 78 name: Get go build/test cache directory 79 run: echo "dir=$(go env GOCACHE)" >> ${GITHUB_OUTPUT} 80 - if: |- 81 (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' 82 Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) 83 uses: actions/cache@v4 84 with: 85 path: |- 86 ${{ steps.go-mod-cache-dir.outputs.dir }}/cache/download 87 ${{ steps.go-cache-dir.outputs.dir }} 88 key: ${{ runner.os }}-${{ matrix.go-version }}-${{ github.run_id }} 89 restore-keys: ${{ runner.os }}-${{ matrix.go-version }} 90 - if: |- 91 ! (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' 92 Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) 93 uses: actions/cache/restore@v4 94 with: 95 path: |- 96 ${{ steps.go-mod-cache-dir.outputs.dir }}/cache/download 97 ${{ steps.go-cache-dir.outputs.dir }} 98 key: ${{ runner.os }}-${{ matrix.go-version }}-${{ github.run_id }} 99 restore-keys: ${{ runner.os }}-${{ matrix.go-version }} 100 - if: |- 101 github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' 102 Dispatch-Trailer: {"type":"')))) || github.ref == 'refs/heads/ci/test') 103 run: go clean -testcache 104 - if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04') 105 name: Early git and code sanity checks 106 run: go run ./internal/ci/checks 107 - if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04') 108 name: Generate 109 run: go generate ./... 110 - if: |- 111 ((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' 112 Dispatch-Trailer: {"type":"')))) || !(matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04') 113 name: Test 114 run: go test ./... 115 - if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04') 116 name: Test with -race 117 run: go test -race ./... 118 env: 119 GORACE: atexit_sleep_ms=10 120 - name: Test with -tags=cuewasm 121 run: go test -tags cuewasm ./cmd/cue/cmd ./cue/interpreter/wasm 122 - name: gcloud auth for end-to-end tests 123 id: auth 124 if: |- 125 github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' 126 Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) && (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04') 127 uses: google-github-actions/auth@v2 128 with: 129 credentials_json: ${{ secrets.E2E_GCLOUD_KEY }} 130 - if: |- 131 github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' 132 Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) && (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04') 133 name: gcloud setup for end-to-end tests 134 uses: google-github-actions/setup-gcloud@v2 135 - if: |- 136 github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' 137 Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) && (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04') 138 name: End-to-end test 139 env: 140 CUE_TEST_LOGINS: ${{ secrets.E2E_CUE_LOGINS }} 141 run: |- 142 cd internal/_e2e 143 go test -race 144 - if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04') 145 name: Check 146 run: |- 147 go vet ./... 148 go mod tidy 149 (cd internal/_e2e && go test -run=-) 150 - if: always() 151 name: Check that git is clean at the end of the job 152 run: test -z "$(git status --porcelain)" || (git status; git diff; false)