Skip to content

πŸ¦€ Rust πŸ¦€ #431

πŸ¦€ Rust πŸ¦€

πŸ¦€ Rust πŸ¦€ #431

Workflow file for this run

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