Skip to content

TryBot

TryBot #421

Workflow file for this run

# Code generated internal/ci/ci_tool.cue; DO NOT EDIT.
name: TryBot
"on":
push:
branches:
- ci/test
- main
pull_request: {}
schedule:
- cron: 0 2 * * *
workflow_dispatch: {}
jobs:
test:
defaults:
run:
shell: bash --noprofile --norc -euo pipefail {0}
strategy:
fail-fast: false
matrix:
go-version:
- stable
python-version:
- "3.12"
runner:
- namespace-profile-linux-amd64
- macos-14
runs-on: ${{ matrix.runner }}
if: |-
(contains(github.event.head_commit.message, '
Dispatch-Trailer: {"type":"trybot"')) || ! (contains(github.event.head_commit.message, '
Dispatch-Trailer: {"type":"'))
steps:
- name: Checkout code
uses: actions/checkout@v5
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@cbf8161ddb4e9b162409104954fb540e8a38c1da
- 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/main') && (! (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
- uses: cue-lang/setup-cue@v1.0.1
with:
version: latest
- name: Install Go
uses: actions/setup-go@v6
with:
cache: false
go-version: 1.25.x
- name: Set common go env vars
run: |-
case $(go env GOARCH) in
amd64) go env -w GOAMD64=v3 ;; # 2013 and later; makes `go test -race` 15% faster
arm64) go env -w GOARM64=v8.6 ;; # Apple M2 and later
esac
# Dump env for good measure
go env
- name: Early git and code sanity checks
run: go run cuelang.org/go/internal/ci/checks@v0.14.1
- name: Re-generate CI
run: cue cmd gen
working-directory: ./internal/ci
- 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)
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: pip install
run: pip install -r requirements.txt
- name: Checkout libcue
uses: actions/checkout@v4
with:
repository: cue-lang/libcue
path: libcue-checkout
- name: Build libcue
working-directory: libcue-checkout
run: |-
go build -o libcue.so -buildmode=c-shared
cp libcue.so libcue.dylib
cp libcue.so cue.dll
- name: mypy
run: mypy .
- if: runner.os == 'Windows'
name: Add libcue to PATH
run: echo '${{ github.workspace }}/libcue-checkout' >> $GITHUB_PATH
- name: pytest
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/libcue-checkout
DYLD_LIBRARY_PATH: ${{ github.workspace }}/libcue-checkout
run: pytest
- 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)