Use [lints] in Cargo.toml and apply more lints #615
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 | |
tags: | |
- '[0-9]+-[0-9]+-[0-9]+' | |
schedule: | |
- cron: '0 2 * * 5' | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
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 | |
build: | |
needs: tidy | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: linux-gnu | |
- target: linux-gnu | |
host: aarch64 | |
# TODO(linux-musl): https://github.com/rust-lang/rust/pull/107129/ | |
# - target: linux-musl | |
# musl: '1.1' | |
- target: linux-musl | |
musl: '1.2' | |
- target: linux-uclibc | |
- target: android | |
- target: freebsd | |
- target: netbsd | |
- target: openbsd | |
- target: dragonfly | |
- target: solaris | |
- target: illumos | |
- target: redox | |
# - target: fuchsia | |
- target: wasi | |
- target: emscripten | |
- target: windows-gnu | |
- target: windows-gnu | |
host: aarch64 | |
- target: none | |
- target: none | |
host: aarch64 | |
runs-on: ubuntu-latest | |
timeout-minutes: 150 | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: taiki-e/github-actions/free-device-space@main | |
- uses: taiki-e/github-actions/setup-docker@main | |
- run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin | |
echo "PUSH_TO_GHCR=1" >>"${GITHUB_ENV}" | |
if: github.repository_owner == 'taiki-e' && (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') | |
- run: tools/build-docker.sh "${{ matrix.target }}" | |
env: | |
HOST_ARCH: ${{ matrix.host }} | |
MUSL_VERSION: ${{ matrix.musl }} | |
manifest: | |
if: github.repository_owner == 'taiki-e' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin | |
echo "PUSH_TO_GHCR=1" >>"${GITHUB_ENV}" | |
if: github.repository_owner == 'taiki-e' && (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') | |
- run: tools/docker-manifest.sh | |
codegen: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install Rust | |
run: rustup toolchain add nightly --no-self-update && rustup default nightly | |
- 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') | |
- uses: peter-evans/create-pull-request@v5 | |
with: | |
title: Update generated code | |
body: | | |
Auto-generated by [create-pull-request][1] | |
[Please close and immediately reopen this pull request to run CI.][2] | |
[1]: https://github.com/peter-evans/create-pull-request | |
[2]: https://github.com/peter-evans/create-pull-request/blob/HEAD/docs/concepts-guidelines.md#workarounds-to-trigger-further-workflow-runs | |
branch: update-generated-code | |
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 |