ci: Add initial set of CI jobs #2
Workflow file for this run
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: Build & Test | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- "**.rs" | |
- "**.toml" | |
- ".github/workflows/**" | |
pull_request: | |
branches: [ main ] | |
paths: | |
- "**.rs" | |
- "**.toml" | |
- ".github/workflows/**" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-hack | |
- name: Check | |
run: | | |
cargo hack check --workspace | |
test: | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup | Install toolchain | |
run: | | |
rustup toolchain install stable --profile minimal | |
rustup toolchain install nightly --profile minimal | |
- name: Setup | Install cargo-fuzz | |
run: | | |
cargo install cargo-fuzz | |
- name: Setup | Cache dependencies | |
uses: Swatinem/[email protected] | |
id: cache | |
with: | |
cache-all-crates: true | |
- name: Test | Everything w/o fuzzing (macOS, Ubuntu) | |
if: matrix.os != 'windows-latest' | |
run: | | |
for build_mode in "" "--release"; | |
do | |
for feature_mode in "" "--all-features"; | |
do | |
echo "# Testing" ${build_mode} ${feature_mode} | |
cargo test --workspace ${build_mode} ${feature_mode} --doc | |
cargo test --workspace ${build_mode} ${feature_mode} --all-targets # TODO: exclude fuzz-targets | |
done | |
done | |
- name: Test | Everything w/o fuzzing (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
$build_modes = @('','--release') | |
$feature_modes = @('','--all-features') | |
foreach ($build_mode in $build_modes) { | |
foreach ($feature_mode in $feature_modes) { | |
echo "# Testing" ${build_mode} ${feature_mode} | |
cargo test --workspace ${build_mode} ${feature_mode} --doc | |
cargo test --workspace ${build_mode} ${feature_mode} --all-targets # TODO: exclude fuzz-targets | |
} | |
} | |
- name: Test | Limited fuzzing (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: echo "NOOP" # TODO | |
minimal-versions: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup | Install toolchain | |
run: | | |
# 1.65 is the Minimum Supported Rust Version (MSRV) for imap-codec. | |
rustup toolchain install 1.65 --profile minimal | |
rustup toolchain install nightly --profile minimal | |
- name: Setup | Cache dependencies | |
uses: Swatinem/[email protected] | |
id: cache | |
with: | |
cache-all-crates: true | |
- name: Check | |
run: | | |
cargo +nightly update -Z minimal-versions | |
cargo +1.65 check --workspace --all-targets --all-features | |
cargo +1.65 test --workspace --all-targets --all-features # TODO: exclude fuzz-targets | |
env: | |
RUSTFLAGS: -Dwarnings | |
audit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Audit dependencies | |
uses: EmbarkStudios/cargo-deny-action@1e59595bed8fc55c969333d08d7817b36888f0c5 | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install toolchain | |
uses: actions-rs/toolchain@88dc2356392166efad76775c878094f4e83ff746 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: clippy | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Check for common mistakes and missed improvements | |
uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-features | |
formatting: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install nightly toolchain | |
uses: actions-rs/toolchain@88dc2356392166efad76775c878094f4e83ff746 | |
with: | |
profile: minimal | |
toolchain: nightly | |
override: true | |
components: rustfmt | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Check code formatting | |
run: cargo +nightly fmt --check |