Skip to content

CI

CI #239

Workflow file for this run

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
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
with:
clippy-target: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,armv7-unknown-linux-gnueabihf,riscv64gc-unknown-linux-gnu,powerpc64le-unknown-linux-gnu
msrv:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: taiki-e/checkout-action@v1
- uses: taiki-e/install-action@cargo-hack
- run: cargo hack build -p test-helper --no-dev-deps --all-features --version-range .. --version-step 2
if: github.event_name == 'pull_request'
- run: cargo hack build -p test-helper --no-dev-deps --all-features --version-range ..
if: github.event_name != 'pull_request'
codegen:
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
pull-requests: write # for gh pr review --approve
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
"$@"
}
apt_packages=(
gcc-aarch64-linux-gnu
gcc-arm-linux-gnueabi
gcc-13-loongarch64-linux-gnu
# gcc-mips-linux-gnu # mips64el-linux-gnuabi64-gcc -mabi=32 -mips32r2 -meb
# gcc-mips64-linux-gnuabi64 # mips64el-linux-gnuabi64-gcc -mips64r2 -meb
gcc-mips64el-linux-gnuabi64
# gcc-mipsel-linux-gnu # mips64el-linux-gnuabi64-gcc -mabi=32 -mips32r2
# gcc-mipsisa32r6-linux-gnu # mips64el-linux-gnuabi64-gcc -mabi=32 -mips32r6 -meb
# gcc-mipsisa32r6el-linux-gnu # mips64el-linux-gnuabi64-gcc -mabi=32 -mips32r6
# gcc-mipsisa64r6-linux-gnuabi64 # mips64el-linux-gnuabi64-gcc -mips64r6 -meb
# gcc-mipsisa64r6el-linux-gnuabi64 # mips64el-linux-gnuabi64-gcc -mips64r6
# gcc-powerpc-linux-gnu # powerpc64le-linux-gnu-gcc -m32 -mbig-endian
# gcc-powerpc64-linux-gnu # powerpc64le-linux-gnu-gcc -mbig-endian
gcc-powerpc64le-linux-gnu
gcc-riscv64-linux-gnu
gcc-s390x-linux-gnu
gettext
)
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 "${apt_packages[@]}"
- run: tools/gen.sh
- name: Handle diff
id: diff
run: tools/ci/gen.sh
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'push' && github.ref == 'refs/heads/main')
- run: git add -N . && git -c color.ui=always diff --exit-code
- 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).
This will be auto-merged when CI has passed because this is an auto-generated PR in a defined format and is usually considered no additional review is required.
branch: update-generated-code
token: ${{ secrets.CREATE_PR_TOKEN }}
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false'
- name: Enable auto-merge for auto-generated PR
run: gh pr merge --rebase --auto "${PR_NUMBER:?}"
env:
GITHUB_TOKEN: ${{ secrets.CREATE_PR_TOKEN }}
PR_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }}
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' && steps.create-pull-request.outputs.pull-request-operation == 'created'
- name: Approve auto-generated PR for auto-merge
run: gh pr review --approve "${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 == 'workflow_dispatch' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' && (steps.create-pull-request.outputs.pull-request-operation == 'created' || steps.create-pull-request.outputs.pull-request-operation == 'updated')