π¦ Rust π¦ #471
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: "42 3 * * *" | |
name: CI | |
jobs: | |
rustfmt: | |
name: π Formatting π | |
runs-on: ubuntu-latest | |
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 }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
- 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.70.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') }} | |
restore-keys: | | |
${{ runner.os }}-${{ 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.70.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') }} | |
restore-keys: | | |
${{ runner.os }}-${{ 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.70.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') }} | |
restore-keys: | | |
${{ runner.os }}-${{ 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.70.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/ | |
key: ${{ runner.os }}-${{ matrix.rust }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
${{ runner.os }}-${{ 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 π | |
run: cargo tarpaulin --out Xml --skip-clean --target-dir target/coverage | |
- name: π Upload Code Coverage π | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./vergen/cobertura.xml,./vergen-pretty/cobertura.xml | |
test-macos: | |
name: π§ͺ MacOS π§ͺ | |
needs: lints-macos | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: macos-latest | |
rust: "1.70.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/ | |
target/ | |
key: ${{ runner.os }}-${{ matrix.rust }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
${{ runner.os }}-${{ 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 πΎ | |
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.70.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.70.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/ | |
target/ | |
key: ${{ runner.os }}-${{ matrix.rust }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock', '**/main.yml') }} | |
${{ runner.os }}-${{ 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 πΎ | |
run: cargo binstall --no-confirm --no-symlinks --force cargo-all-features | |
- name: π§ͺ Test π§ͺ | |
run: cargo test-all-features |