🦀 Rust 🦀 #220
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
on: | |
# Trigger the workflow on push to master or any pull request | |
# Ignore all tags | |
push: | |
branches: | |
- master | |
tags-ignore: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: "13 3 * * *" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
name: 🦀 Rust 🦀 | |
jobs: | |
rustfmt: | |
name: 📌 Formatting 📌 | |
runs-on: ubuntu-latest | |
steps: | |
- name: ✅ Checkout ✅ | |
uses: actions/checkout@v3 | |
- name: ⭕ Rustfmt Check ⭕ | |
run: cargo fmt --all -- --check | |
lints-linux: | |
name: 🕳️ Lints Linux 🕳️ | |
needs: rustfmt | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
rust: "1.67.0" | |
- os: ubuntu-latest | |
rust: stable | |
- os: ubuntu-latest | |
rust: beta | |
- os: ubuntu-latest | |
rust: nightly | |
steps: | |
- name: ✅ Checkout ✅ | |
uses: actions/checkout@v3 | |
- name: 💵 Cache 💵 | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
- name: 🧰 Toolchain 🧰 | |
run: | | |
rustup toolchain remove ${{ matrix.rust }} | |
rm -f ~/.cargo/bin/rustfmt | |
rm -f ~/.cargo/bin/cargo-fmt | |
rm -f ~/.cargo/bin/cargo-clippy | |
rustup toolchain install ${{ matrix.rust }} --profile default | |
rustup default ${{ matrix.rust }} | |
- name: 📎 Clippy 📎 | |
run: | | |
cargo update | |
cargo clippy --all-targets --all-features -- -Dwarnings | |
lints-macos: | |
name: 🕳️ Lints MacOS 🕳️ | |
needs: rustfmt | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: macos-latest | |
rust: "1.67.0" | |
- os: macos-latest | |
rust: stable | |
- os: macos-latest | |
rust: beta | |
- os: macos-latest | |
rust: nightly | |
steps: | |
- name: ✅ Checkout ✅ | |
uses: actions/checkout@v3 | |
- name: 💵 Cache 💵 | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
- name: 🧰 Toolchain 🧰 | |
run: | | |
rustup toolchain remove ${{ matrix.rust }} | |
rustup toolchain install ${{ matrix.rust }} --profile default --no-self-update | |
rustup default ${{ matrix.rust }} | |
- name: 📎 Clippy 📎 | |
run: | | |
cargo update | |
cargo clippy --all-targets --all-features -- -Dwarnings | |
lints-windows: | |
name: 🕳️ Lints Windows 🕳️ | |
needs: rustfmt | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
rust: "1.67.0" | |
- os: windows-latest | |
rust: stable | |
- os: windows-latest | |
rust: beta | |
- os: windows-latest | |
rust: nightly | |
steps: | |
- name: ✅ Checkout ✅ | |
uses: actions/checkout@v3 | |
- name: 💵 Cache 💵 | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
- name: 🧰 Toolchain 🧰 | |
run: | | |
rustup toolchain remove ${{ matrix.rust }} | |
rustup toolchain install ${{ matrix.rust }} --profile default --no-self-update | |
rustup default ${{ matrix.rust }} | |
- name: 📎 Clippy 📎 | |
run: | | |
cargo update | |
cargo clippy --all-targets --all-features -- -Dwarnings | |
test-linux: | |
name: 🧪 Linux 🧪 | |
needs: lints-linux | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
rust: "1.67.0" | |
target: x86_64-unknown-linux-gnu | |
- os: ubuntu-latest | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
- os: ubuntu-latest | |
rust: beta | |
target: x86_64-unknown-linux-gnu | |
- os: ubuntu-latest | |
rust: nightly | |
target: x86_64-unknown-linux-gnu | |
steps: | |
- name: ✅ Checkout ✅ | |
uses: actions/checkout@v3 | |
- name: 💵 Cache 💵 | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/coverage | |
key: ${{ runner.os }}-${{ matrix.rust }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
- name: 🧰 Toolchain 🧰 | |
run: | | |
rustup toolchain remove ${{ matrix.rust }}-${{ matrix.target }} | |
rustup toolchain add ${{ matrix.rust }}-${{ matrix.target }} --profile minimal | |
rustup default ${{ matrix.rust }} | |
- name: 💾 Install (cargo-binstall) 💾 | |
run: | | |
rustup override set stable | |
cargo binstall -V || cargo install cargo-binstall | |
rustup override remove | |
- name: 💾 Install (tarpaulin, all-features) 💾 | |
run: cargo binstall --no-confirm --no-symlinks --force cargo-tarpaulin cargo-all-features | |
- name: 🧪 Test 🧪 | |
run: | | |
cargo test-all-features | |
- name: 🙊 Code Coverage (vergen) 🙊 | |
run: cargo tarpaulin --config tarpaulin.toml --exclude-files src/lib.rs src/config.rs target/* --out xml --skip-clean --target-dir target/coverage | |
- name: 🙊 Upload Code Coverage 🙊 | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./cobertura.xml | |
test-macos: | |
name: 🧪 MacOS 🧪 | |
needs: lints-macos | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: macos-latest | |
rust: "1.67.0" | |
target: x86_64-apple-darwin | |
- os: macos-latest | |
rust: stable | |
target: x86_64-apple-darwin | |
- os: macos-latest | |
rust: beta | |
target: x86_64-apple-darwin | |
- os: macos-latest | |
rust: nightly | |
target: x86_64-apple-darwin | |
steps: | |
- name: ✅ Checkout ✅ | |
uses: actions/checkout@v3 | |
- name: 💵 Cache 💵 | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{ runner.os }}-${{ matrix.rust }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
- name: 🧰 Toolchain 🧰 | |
run: | | |
rustup toolchain remove ${{ matrix.rust }}-${{ matrix.target }} | |
rustup toolchain add ${{ matrix.rust }}-${{ matrix.target }} --profile minimal | |
rustup default ${{ matrix.rust }} | |
- name: 💾 Install (cargo-binstall) 💾 | |
run: | | |
rustup override set stable | |
cargo binstall -V || cargo install cargo-binstall | |
rustup override remove | |
- name: 💾 Install (all-features) 💾 | |
run: cargo binstall --no-confirm --no-symlinks --force cargo-all-features | |
- name: 🧪 Test 🧪 | |
run: | | |
cargo test-all-features | |
test-windows: | |
name: 🧪 Windows 🧪 | |
needs: lints-windows | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
rust: "1.67.0" | |
target: x86_64-pc-windows-msvc | |
- os: windows-latest | |
rust: stable | |
target: x86_64-pc-windows-msvc | |
- os: windows-latest | |
rust: beta | |
target: x86_64-pc-windows-msvc | |
- os: windows-latest | |
rust: nightly | |
target: x86_64-pc-windows-msvc | |
- os: windows-latest | |
rust: "1.67.0" | |
target: x86_64-pc-windows-gnu | |
- os: windows-latest | |
rust: stable | |
target: x86_64-pc-windows-gnu | |
- os: windows-latest | |
rust: beta | |
target: x86_64-pc-windows-gnu | |
- os: windows-latest | |
rust: nightly | |
target: x86_64-pc-windows-gnu | |
steps: | |
- name: ✅ Checkout ✅ | |
uses: actions/checkout@v3 | |
- name: 💵 Cache 💵 | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{ runner.os }}-${{ matrix.rust }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
- name: 🧰 Toolchain 🧰 | |
run: | | |
rustup toolchain remove ${{ matrix.rust }}-${{ matrix.target }} | |
rustup toolchain add ${{ matrix.rust }}-${{ matrix.target }} --profile minimal --no-self-update | |
rustup default ${{ matrix.rust }} | |
- name: 💾 Install (cargo-binstall) 💾 | |
run: | | |
rustup override set stable | |
cargo binstall -V || cargo install cargo-binstall | |
rustup override remove | |
- name: 💾 Install (all-features) 💾 | |
run: cargo binstall --no-confirm --no-symlinks --force cargo-all-features | |
- name: 🧪 Test 🧪 | |
run: | | |
cargo test-all-features |