CI #71
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
name: CI | |
permissions: | |
contents: read | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- dev | |
schedule: | |
- cron: '0 2 * * *' | |
workflow_dispatch: | |
env: | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
CARGO_NET_RETRY: 10 | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
RUST_TEST_THREADS: 1 | |
RUSTDOCFLAGS: -D warnings | |
RUSTFLAGS: -D warnings | |
RUSTUP_MAX_RETRIES: 10 | |
defaults: | |
run: | |
shell: bash --noprofile --norc -CeEuxo pipefail {0} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
tidy: | |
uses: taiki-e/github-actions/.github/workflows/tidy.yml@main | |
permissions: | |
contents: read | |
pull-requests: write # for gh pr edit --add-assignee | |
repository-projects: read # for gh pr edit --add-assignee | |
secrets: inherit | |
codegen: | |
runs-on: ubuntu-24.04 # old clang doesn't support AArch64 illumos # TODO: use ubuntu-latest once https://github.com/actions/runner-images/issues/10636 done | |
timeout-minutes: 60 | |
permissions: | |
contents: read | |
pull-requests: write # for gh pr edit --add-assignee | |
repository-projects: read # for gh pr edit --add-assignee | |
steps: | |
- uses: taiki-e/checkout-action@v1 | |
- uses: taiki-e/github-actions/install-rust@nightly | |
- run: | | |
retry() { | |
for i in {1..10}; do | |
if "$@"; then | |
return 0 | |
else | |
sleep "${i}" | |
fi | |
done | |
"$@" | |
} | |
retry sudo apt-get -o Acquire::Retries=10 -qq update | |
retry sudo apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends \ | |
gcc-aarch64-linux-gnu \ | |
gcc-arm-linux-gnueabi \ | |
gcc-powerpc64le-linux-gnu \ | |
gcc-riscv64-linux-gnu \ | |
gettext | |
- run: tools/gen.sh | |
- id: diff | |
run: tools/ci/gen.sh | |
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') | |
- id: create-pull-request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
title: Update generated code | |
body: | | |
Auto-generated by CI using [create-pull-request](https://github.com/peter-evans/create-pull-request). | |
branch: update-generated-code | |
token: ${{ secrets.CREATE_PR_TOKEN }} | |
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' | |
- name: Notify PR author by assigning PR | |
run: gh pr edit --add-assignee taiki-e "${PR_NUMBER:?}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }} | |
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' | |
- run: git add -N . && git diff --exit-code |