diff --git a/.github/workflows/evict_caches.yaml b/.github/workflows/evict_caches.yaml index b870dd742ab..cfc0f531c38 100644 --- a/.github/workflows/evict_caches.yaml +++ b/.github/workflows/evict_caches.yaml @@ -21,8 +21,8 @@ jobs: run: touch -t 202211302355 $(find * -type d) - name: Restore git file modification times uses: chetan/git-restore-mtime-action@075f9bc9d159805603419d50f794bd9f33252ebe - - name: Try to extract Dispatch-Trailer - id: DispatchTrailer + - id: DispatchTrailer + name: Try to extract Dispatch-Trailer run: |- x="$(git log -1 --pretty='%(trailers:key=Dispatch-Trailer,valueonly)')" if [[ "$x" == "" ]] @@ -38,11 +38,11 @@ jobs: echo "value<> $GITHUB_OUTPUT echo "$x" >> $GITHUB_OUTPUT echo "EOD" >> $GITHUB_OUTPUT - - name: Check we don't have Dispatch-Trailer on a protected branch - if: |- + - 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 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f764ae55427..0519198451f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -28,8 +28,8 @@ jobs: run: touch -t 202211302355 $(find * -type d) - name: Restore git file modification times uses: chetan/git-restore-mtime-action@075f9bc9d159805603419d50f794bd9f33252ebe - - name: Try to extract Dispatch-Trailer - id: DispatchTrailer + - id: DispatchTrailer + name: Try to extract Dispatch-Trailer run: |- x="$(git log -1 --pretty='%(trailers:key=Dispatch-Trailer,valueonly)')" if [[ "$x" == "" ]] @@ -45,11 +45,11 @@ jobs: echo "value<> $GITHUB_OUTPUT echo "$x" >> $GITHUB_OUTPUT echo "EOD" >> $GITHUB_OUTPUT - - name: Check we don't have Dispatch-Trailer on a protected branch - if: |- + - 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 @@ -82,17 +82,17 @@ jobs: install-only: true version: v2.3.2 - name: Run GoReleaser with CUE - env: - CUE_LOGINS: ${{ secrets.NOTCUECKOO_CUE_LOGINS }} - GITHUB_TOKEN: ${{ secrets.CUECKOO_GITHUB_PAT }} run: |- export CUE_CONFIG_DIR=$(mktemp -d) echo "$CUE_LOGINS" > $CUE_CONFIG_DIR/logins.json cue cmd release working-directory: ./internal/ci/goreleaser - - name: Re-test cuelang.org - if: startsWith(github.ref, 'refs/tags/v') + env: + CUE_LOGINS: ${{ secrets.NOTCUECKOO_CUE_LOGINS }} + GITHUB_TOKEN: ${{ secrets.CUECKOO_GITHUB_PAT }} + - if: startsWith(github.ref, 'refs/tags/v') + name: Re-test cuelang.org run: 'curl -s -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.CUECKOO_GITHUB_PAT }}" -H "X-GitHub-Api-Version: 2022-11-28" --fail --request POST --data-binary "{\"event_type\":\"Re-test post release of ${GITHUB_REF##refs/tags/}\"}" https://api.github.com/repos/cue-lang/cuelang.org/dispatches' - - name: Trigger unity build - if: startsWith(github.ref, 'refs/tags/v') + - if: startsWith(github.ref, 'refs/tags/v') + name: Trigger unity build run: 'curl -s -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.PORCUEPINE_GITHUB_PAT }}" -H "X-GitHub-Api-Version: 2022-11-28" --fail --request POST --data-binary "{\"event_type\":\"Check against CUE ${GITHUB_REF##refs/tags/}\",\"client_payload\":{\"type\":\"unity\",\"payload\":{\"versions\":\"\\\"${GITHUB_REF##refs/tags/}\\\"\"}}}" https://api.github.com/repos/cue-unity/unity-private/dispatches' diff --git a/.github/workflows/trybot.yaml b/.github/workflows/trybot.yaml index da54f2b3abf..eb2d77bb04b 100644 --- a/.github/workflows/trybot.yaml +++ b/.github/workflows/trybot.yaml @@ -41,8 +41,8 @@ jobs: run: touch -t 202211302355 $(find * -type d) - name: Restore git file modification times uses: chetan/git-restore-mtime-action@075f9bc9d159805603419d50f794bd9f33252ebe - - name: Try to extract Dispatch-Trailer - id: DispatchTrailer + - id: DispatchTrailer + name: Try to extract Dispatch-Trailer run: |- x="$(git log -1 --pretty='%(trailers:key=Dispatch-Trailer,valueonly)')" if [[ "$x" == "" ]] @@ -58,11 +58,11 @@ jobs: echo "value<> $GITHUB_OUTPUT echo "$x" >> $GITHUB_OUTPUT echo "EOD" >> $GITHUB_OUTPUT - - name: Check we don't have Dispatch-Trailer on a protected branch - if: |- + - 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 @@ -77,75 +77,75 @@ jobs: # Dump env for good measure go env - - name: Get go mod cache directory - id: go-mod-cache-dir + - id: go-mod-cache-dir + name: Get go mod cache directory run: echo "dir=$(go env GOMODCACHE)" >> ${GITHUB_OUTPUT} - - name: Get go build/test cache directory - id: go-cache-dir + - id: go-cache-dir + name: Get go build/test cache directory run: echo "dir=$(go env GOCACHE)" >> ${GITHUB_OUTPUT} - - with: + - 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, ' + - 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: + 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 }} - uses: actions/cache/restore@v4 - 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')) - 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 - - name: Early git and code sanity checks - if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04') + - if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04') + name: Early git and code sanity checks run: go run ./internal/ci/checks - - name: Test - if: |- + - 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-22.04') + name: Test run: go test ./... - if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04') name: Test with -race + run: go test -race ./... env: GORACE: atexit_sleep_ms=10 - run: go test -race ./... - if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04') name: Test on 32 bits + run: go test -short ./... env: GOARCH: "386" - run: go test -short ./... - 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 - uses: google-github-actions/auth@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-22.04') + uses: google-github-actions/auth@v2 with: credentials_json: ${{ secrets.E2E_GCLOUD_KEY }} - - name: gcloud setup for end-to-end tests - if: |- + - 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-22.04') + name: gcloud setup for end-to-end tests uses: google-github-actions/setup-gcloud@v2 - - name: End-to-end test - env: - CUE_TEST_LOGINS: ${{ secrets.E2E_PORCUEPINE_CUE_LOGINS }} - if: |- + - 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-22.04') + name: End-to-end test + env: + CUE_TEST_LOGINS: ${{ secrets.E2E_PORCUEPINE_CUE_LOGINS }} run: |- cd internal/_e2e go test -race @@ -171,14 +171,14 @@ jobs: echo "Did you forget about refs/attic branches? https://github.com/cue-lang/cue/wiki/Notes-for-project-maintainers" exit 1 fi - - name: Generate - env: - CUE_LOGINS: ${{ secrets.NOTCUECKOO_CUE_LOGINS }} + - if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04') + name: Generate run: |- export CUE_CONFIG_DIR=$(mktemp -d) echo "$CUE_LOGINS" > $CUE_CONFIG_DIR/logins.json go generate ./... - if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04') - - name: Check that git is clean at the end of the job - if: always() + env: + CUE_LOGINS: ${{ secrets.NOTCUECKOO_CUE_LOGINS }} + - 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) diff --git a/.github/workflows/trybot_dispatch.yaml b/.github/workflows/trybot_dispatch.yaml index 18ee5e06d5c..cda31939970 100644 --- a/.github/workflows/trybot_dispatch.yaml +++ b/.github/workflows/trybot_dispatch.yaml @@ -22,17 +22,17 @@ jobs: password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} EOD chmod 600 ~/.netrc - - name: Write fake payload - id: payload + - id: payload if: github.repository == 'cue-lang/cue' && (github.ref == 'refs/heads/ci/test') + name: Write fake payload run: |- cat <> $GITHUB_OUTPUT value<