Skip to content

Refactor CI and daily workflow #2093

Refactor CI and daily workflow

Refactor CI and daily workflow #2093

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- 'main'
defaults:
run:
shell: bash
permissions:
contents: read
env:
RUSTUP_MAX_RETRIES: 10
CARGO_INCREMENTAL: 0
jobs:
ci:
runs-on: ubuntu-latest
needs:
- check
- careful
- clippy
# - cross
- fmt
# - fuzz
- test
- udeps
- deny
steps:
- run: exit 0
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: make check
test:
name: test ${{ matrix.target.triple }} - ${{ matrix.target.toolchain }}
needs: check
strategy:
matrix:
target:
- { os: ubuntu-latest, toolchain: stable, triple: x86_64-unknown-linux-gnu }
- { os: ubuntu-latest, toolchain: 1.74.1, triple: x86_64-unknown-linux-gnu }
- { os: ubuntu-latest, toolchain: beta, triple: x86_64-unknown-linux-gnu }
- { os: ubuntu-latest, toolchain: nightly, triple: x86_64-unknown-linux-gnu }
- { os: macos-latest, toolchain: stable, triple: x86_64-apple-darwin }
- { os: macos-latest, toolchain: 1.74.1, triple: x86_64-apple-darwin }
- { os: windows-latest, toolchain: stable, triple: x86_64-pc-windows-gnu }
- { os: windows-latest, toolchain: 1.74.1, triple: x86_64-pc-windows-gnu }
- { os: windows-latest, toolchain: stable, triple: i686-pc-windows-msvc }
- { os: windows-latest, toolchain: 1.74.1, triple: i686-pc-windows-msvc }
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.target.toolchain }}
targets: ${{ matrix.target.triple }}
- uses: Swatinem/rust-cache@v2
- run: ci/prepare-tests.sh
- run: make test
# cross:
# if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
# name: cross ${{ matrix.target.triple }} - ${{ matrix.target.toolchain }}
# runs-on: ${{ matrix.target.os }}
# needs: check
# strategy:
# fail-fast: false
# matrix:
# target:
# - { os: ubuntu-latest, toolchain: stable, triple: x86_64-unknown-linux-gnu }
# - { os: ubuntu-latest, toolchain: beta, triple: x86_64-unknown-linux-gnu }
# - { os: ubuntu-latest, toolchain: nightly, triple: x86_64-unknown-linux-gnu }
# - { os: ubuntu-latest, toolchain: stable, triple: x86_64-unknown-linux-musl }
# - { os: ubuntu-latest, toolchain: stable, triple: aarch64-unknown-linux-gnu }
# - { os: ubuntu-latest, toolchain: stable, triple: aarch64-unknown-linux-musl }
# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@master
# with:
# toolchain: ${{ matrix.target.toolchain }}
# targets: ${{ matrix.target.triple }}
# - uses: Swatinem/rust-cache@v2
# - run: cargo install cross
# - run: |
# cross build --target ${{ matrix.target.triple }}
# fuzz:
# if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
# name: fuzz ${{ matrix.item.name }}
# runs-on: ubuntu-latest
# timeout-minutes: 900
# needs: check
# strategy:
# matrix:
# item:
# - { name: pica-record-ref, fuzz-dir: crates/pica-record/fuzz, target: fuzz-record-ref, max-total-time: 300 }
# - { name: pica-record-matcher, fuzz-dir: crates/pica-matcher/fuzz, target: fuzz-record-matcher, max-total-time: 300 }
# - { name: pica-select-query, fuzz-dir: crates/pica-select/fuzz, target: fuzz-query, max-total-time: 300 }
# - { name: pica-path, fuzz-dir: crates/pica-path/fuzz, target: fuzz-path, max-total-time: 300 }
# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@nightly
# - uses: Swatinem/rust-cache@v2
# - uses: dtolnay/install@cargo-fuzz
# - run: |
# cargo fuzz run --fuzz-dir ${{ matrix.item.fuzz-dir }} --jobs 2 ${{ matrix.item.target }} -- -max_total_time=${{ matrix.item.max-total-time }}
fmt:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: make check-fmt
clippy:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: make clippy
careful:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-careful
- run: ci/prepare-tests.sh
- run: make careful
udeps:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-udeps
- run: cargo udeps --workspace
deny:
runs-on: ubuntu-latest
needs: check
strategy:
matrix:
checks:
- bans licenses sources
- advisories
continue-on-error: ${{ matrix.checks == 'advisories' }}
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
rust-version: stable
# audit:
# if: ${{ github.ref == 'refs/heads/main' }}
# runs-on: ubuntu-latest
# needs: test
# steps:
# - uses: actions/checkout@v4
# - uses: abbbi/github-actions-tune@v1
# - uses: actions/cache@v4
# with:
# key: ${{ env.CACHE_KEY }}-${{ hashFiles('**/Cargo.toml') }}
# path: |
# ~/.cargo/bin/
# ~/.cargo/git/db/
# ~/.cargo/registry/cache/
# ~/.cargo/registry/index/
# target/
# - uses: dtolnay/rust-toolchain@nightly
# - uses: rustsec/[email protected]
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# upgrades:
# if: ${{ github.ref == 'refs/heads/main' }}
# runs-on: ubuntu-latest
# needs: test
# steps:
# - uses: actions/checkout@v4
# - uses: abbbi/github-actions-tune@v1
# - uses: actions/cache@v4
# with:
# key: ${{ env.CACHE_KEY }}-${{ hashFiles('**/Cargo.toml') }}
# path: |
# ~/.cargo/bin/
# ~/.cargo/git/db/
# ~/.cargo/registry/cache/
# ~/.cargo/registry/index/
# target/
# - uses: dtolnay/rust-toolchain@nightly
# - name: "Install `cargo-upgrades`"
# run: |
# cargo install -f cargo-upgrades
# - run: |
# cargo upgrades
# miri:
# name: miri
# runs-on: ubuntu-latest
# needs: test
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@miri
# - run: cargo miri test --workspace --lib --verbose
# env:
# MIRIFLAGS: -Zmiri-strict-provenance
# - run: cargo miri test --workspace --doc --verbose
# env:
# MIRIFLAGS: -Zmiri-strict-provenance
# book:
# if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
# runs-on: ubuntu-latest
# needs: test
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: true
# fetch-depth: 0
# - uses: abbbi/github-actions-tune@v1
# - name: Setup Hugo
# uses: peaceiris/actions-hugo@v2
# with:
# hugo-version: 'latest'
# extended: true
# - name: Build
# run: |
# cd docs
# hugo --minify
# gh-pages:
# if: ${{ github.ref == 'refs/heads/main' }}
# needs:
# - audit
# - book
# - careful
# - check
# - clippy
# - cross
# - deny
# - fmt
# - fuzz
# - miri
# - test
# # - udeps
# - upgrades
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: abbbi/github-actions-tune@v1
# - uses: actions/cache@v4
# with:
# key: ${{ env.CACHE_KEY }}-${{ hashFiles('**/Cargo.toml') }}
# path: |
# ~/.cargo/bin/
# ~/.cargo/git/db/
# ~/.cargo/registry/cache/
# ~/.cargo/registry/index/
# target/
# - uses: dtolnay/rust-toolchain@nightly
# - name: Setup Hugo
# uses: peaceiris/actions-hugo@v2
# with:
# hugo-version: 'latest'
# extended: true
# - run: |
# make docs
# - uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: target/docs
# keep_files: false
# force_orphan: true