cuelang.org/go@v0.13.0/.github/workflows/trybot.yaml (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_target: {}
    13    workflow_dispatch: {}
    14  jobs:
    15    test:
    16      defaults:
    17        run:
    18          shell: bash --noprofile --norc -euo pipefail {0}
    19      strategy:
    20        fail-fast: false
    21        matrix:
    22          go-version:
    23            - 1.23.x
    24            - 1.24.x
    25          runner:
    26            - ubuntu-24.04
    27            - macos-14
    28            - windows-2022
    29      runs-on: ${{ matrix.runner }}
    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        - name: Set common go env vars
    75          run: |-
    76            go env -w GOTOOLCHAIN=local
    77  
    78            # Dump env for good measure
    79            go env
    80        - id: go-mod-cache-dir
    81          name: Get go mod cache directory
    82          run: echo "dir=$(go env GOMODCACHE)" >> ${GITHUB_OUTPUT}
    83        - id: go-cache-dir
    84          name: Get go build/test cache directory
    85          run: echo "dir=$(go env GOCACHE)" >> ${GITHUB_OUTPUT}
    86        - if: |-
    87            (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, '
    88            Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test'))
    89          uses: actions/cache@v4
    90          with:
    91            path: |-
    92              ${{ steps.go-mod-cache-dir.outputs.dir }}/cache/download
    93              ${{ steps.go-cache-dir.outputs.dir }}
    94            key: ${{ runner.os }}-${{ matrix.go-version }}-${{ github.run_id }}
    95            restore-keys: ${{ runner.os }}-${{ matrix.go-version }}
    96        - if: |-
    97            ! (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, '
    98            Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test'))
    99          uses: actions/cache/restore@v4
   100          with:
   101            path: |-
   102              ${{ steps.go-mod-cache-dir.outputs.dir }}/cache/download
   103              ${{ steps.go-cache-dir.outputs.dir }}
   104            key: ${{ runner.os }}-${{ matrix.go-version }}-${{ github.run_id }}
   105            restore-keys: ${{ runner.os }}-${{ matrix.go-version }}
   106        - if: |-
   107            github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, '
   108            Dispatch-Trailer: {"type":"')))) || github.ref == 'refs/heads/ci/test')
   109          run: go clean -testcache
   110        - run: go run cuelang.org/go/cmd/cue login --token=${{ secrets.NOTCUECKOO_CUE_TOKEN }}
   111        - if: (matrix.go-version == '1.24.x' && matrix.runner == 'ubuntu-24.04')
   112          name: Early git and code sanity checks
   113          run: go run ./internal/ci/checks
   114        - if: |-
   115            ((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, '
   116            Dispatch-Trailer: {"type":"')))) || !(matrix.go-version == '1.24.x' && matrix.runner == 'ubuntu-24.04')
   117          name: Test
   118          run: go test ./...
   119        - if: (matrix.go-version == '1.24.x' && matrix.runner == 'ubuntu-24.04')
   120          name: Test with -race
   121          env:
   122            GORACE: atexit_sleep_ms=10
   123          run: go test -race ./...
   124        - if: (matrix.go-version == '1.24.x' && matrix.runner == 'ubuntu-24.04')
   125          name: Test on 32 bits
   126          env:
   127            GOARCH: "386"
   128          run: go test -short ./...
   129        - name: Test with -tags=cuewasm
   130          run: go test -tags cuewasm ./cmd/cue/cmd ./cue/interpreter/wasm
   131        - id: auth
   132          if: |-
   133            github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, '
   134            Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) && (matrix.go-version == '1.24.x' && matrix.runner == 'ubuntu-24.04')
   135          name: gcloud auth for end-to-end tests
   136          uses: google-github-actions/auth@v2
   137          with:
   138            credentials_json: ${{ secrets.E2E_GCLOUD_KEY }}
   139        - if: |-
   140            github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, '
   141            Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) && (matrix.go-version == '1.24.x' && matrix.runner == 'ubuntu-24.04')
   142          name: gcloud setup for end-to-end tests
   143          uses: google-github-actions/setup-gcloud@v2
   144        - if: |-
   145            github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, '
   146            Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) && (matrix.go-version == '1.24.x' && matrix.runner == 'ubuntu-24.04')
   147          name: End-to-end test
   148          env:
   149            CUE_TEST_TOKEN: ${{ secrets.E2E_PORCUEPINE_CUE_TOKEN }}
   150          run: |-
   151            cd internal/_e2e
   152            go test -race
   153        - if: (matrix.go-version == '1.24.x' && matrix.runner == 'ubuntu-24.04')
   154          name: Go checks
   155          run: |-
   156            go vet ./...
   157            go mod tidy
   158            (cd internal/_e2e && go test -run=-)
   159        - if: (matrix.go-version == '1.24.x' && matrix.runner == 'ubuntu-24.04')
   160          name: staticcheck
   161          uses: dominikh/staticcheck-action@v1
   162          with:
   163            version: "2025.1"
   164            install-go: false
   165        - if: (matrix.go-version == '1.24.x' && matrix.runner == 'ubuntu-24.04')
   166          name: Check all git tags are available
   167          run: |-
   168            cd $(mktemp -d)
   169  
   170            git ls-remote --tags https://github.com/cue-lang/cue >github.txt
   171            echo "GitHub tags:"
   172            sed 's/^/    /' github.txt
   173  
   174            git ls-remote --tags https://review.gerrithub.io/cue-lang/cue >gerrit.txt
   175  
   176            if ! diff -u github.txt gerrit.txt; then
   177            	echo "GitHub and Gerrit do not agree on the list of tags!"
   178            	echo "Did you forget about refs/attic branches? https://github.com/cue-lang/cue/wiki/Notes-for-project-maintainers"
   179            	exit 1
   180            fi
   181        - if: (matrix.go-version == '1.24.x' && matrix.runner == 'ubuntu-24.04')
   182          name: Generate
   183          run: go generate ./...
   184        - if: always()
   185          name: Check that git is clean at the end of the job
   186          run: test -z "$(git status --porcelain)" || (git status; git diff; false)