refactor: Add a configuration manager as a crate #573
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: ci | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
job-matrix: | |
name: ${{ matrix.make.task }} (${{ matrix.rust }}; ${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- make: | |
task: format | |
os: ubuntu-latest | |
rust: stable | |
- make: | |
task: check-dependencies | |
os: ubuntu-latest | |
rust: stable | |
- make: | |
task: lint | |
os: ubuntu-latest | |
rust: stable | |
- make: | |
task: doc | |
os: ubuntu-latest | |
rust: stable | |
- make: | |
task: deadlink | |
install-cargo-deadlinks: true | |
install-mlc: true | |
os: ubuntu-latest | |
rust: stable | |
- make: | |
task: lcov | |
install-grcov: true | |
os: ubuntu-latest | |
rust: stable | |
- make: | |
task: copyright | |
rust-free: true | |
os: ubuntu-latest | |
- make: | |
task: test | |
os: ubuntu-latest | |
rust: nightly | |
- make: | |
task: test | |
os: ubuntu-latest | |
rust: stable | |
- make: | |
task: test | |
os: ubuntu-latest | |
rust: 1.63.0 | |
- make: | |
task: test | |
os: macos-latest | |
rust: stable | |
# Example does not cover various envs. Should be done in test. | |
- make: | |
task: example-run | |
install-replayman: true | |
os: ubuntu-latest | |
rust: stable | |
env: | |
RUST_BACKTRACE: full | |
CACHE_RESET_KEY: 20211022-01 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust ${{ matrix.rust }} | |
if: ${{ ! matrix.make.rust-free }} | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
components: rustfmt, clippy, llvm-tools-preview | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.make.task }} | |
- name: Check versions on crates.io | |
if: ${{ matrix.make.task == 'check-dependencies' }} | |
id: dep-versions | |
run: | | |
# load helper script | |
source .github/workflows/scripts/crates.io-script.bash | |
# get latest version from crates.io | |
echo "CARGO_DENY_VERSION=$(get_crate_latest_version cargo-deny)" >> $GITHUB_ENV | |
# add other dependencies versions here | |
- name: Cache cargo-deny | |
if: ${{ matrix.make.task == 'check-dependencies' }} | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/bin/cargo-deny | |
key: ${{ env.CACHE_RESET_KEY }}-${{ runner.os }}-${{ matrix.rust }}-cargo-deny-${{ env.CARGO_DENY_VERSION }} | |
- name: Install cargo-deny | |
if: ${{ matrix.make.task == 'check-dependencies' }} | |
run: | | |
if ! test -f "$HOME/.cargo/bin/cargo-deny"; then | |
cargo install cargo-deny | |
fi | |
- name: Install cargo-make | |
env: | |
BASE_URL: https://github.com/sagiegurari/cargo-make/releases/download | |
VERSION: 0.35.10 | |
run: | | |
if [ "${{ matrix.os }}" = "macos-latest" ]; then | |
FILE_BASE="cargo-make-v${VERSION}-x86_64-apple-darwin" | |
else | |
FILE_BASE="cargo-make-v${VERSION}-x86_64-unknown-linux-musl" | |
fi | |
mkdir -p "${HOME}/.local/bin" | |
curl -L "${BASE_URL}/${VERSION}/${FILE_BASE}.zip" --output /tmp/cargo-make.zip | |
unzip "/tmp/cargo-make.zip" -d /tmp/cargo-make | |
mv -f "/tmp/cargo-make/${FILE_BASE}/cargo-make" "$HOME/.local/bin/cargo-make" | |
echo "$HOME/.local/bin" >> "$GITHUB_PATH" | |
- name: Install cargo-deadlinks | |
if: ${{ matrix.make.install-cargo-deadlinks }} | |
env: | |
BASE_URL: https://github.com/deadlinks/cargo-deadlinks/releases/download | |
VERSION: 0.8.1 | |
run: | | |
if [ "${{ matrix.os }}" = "macos-latest" ]; then | |
FILE_BASE=cargo-deadlinks-macos | |
else | |
FILE_BASE=cargo-deadlinks-linux | |
fi | |
curl -L "${BASE_URL}/${VERSION}/${FILE_BASE}" --output "$HOME/.local/bin/cargo-deadlinks" | |
chmod +x "$HOME/.local/bin/cargo-deadlinks" | |
cargo deadlinks --version | |
- name: Install mlc | |
if: ${{ matrix.make.install-mlc }} | |
env: | |
BASE_URL: https://github.com/becheran/mlc/releases/download | |
VERSION: 0.14.3 | |
run: | | |
if [ "${{ matrix.os }}" = "macos-latest" ]; then | |
FILE_BASE=mlc-x86_64-apple-darwin | |
else | |
FILE_BASE=mlc-x86_64-linux | |
fi | |
curl -L "${BASE_URL}/v${VERSION}/${FILE_BASE}" --output "$HOME/.local/bin/mlc" | |
chmod +x "$HOME/.local/bin/mlc" | |
mlc --version | |
- name: Install grcov | |
if: ${{ matrix.make.install-grcov }} | |
env: | |
BASE_URL: https://github.com/mozilla/grcov/releases/download | |
VERSION: 0.8.7 | |
run: | | |
if [ "${{ matrix.os }}" = "macos-latest" ]; then | |
FILE_BASE=grcov-x86_64-apple-darwin | |
else | |
FILE_BASE=grcov-x86_64-unknown-linux-gnu | |
fi | |
curl -L "${BASE_URL}/v${VERSION}/${FILE_BASE}.tar.bz2" --output /tmp/grcov.tar.bz2 | |
tar xvf /tmp/grcov.tar.bz2 --directory="$HOME/.local/bin/" | |
grcov --version | |
- name: Install replayman | |
if: ${{ matrix.make.install-replayman }} | |
run: | | |
cargo install replayman | |
- name: ${{ matrix.make.task }} | |
run: | | |
cargo make ${{ matrix.make.task }} | |
- name: Upload lcov to codecov | |
if: ${{ matrix.make.install-grcov }} | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_SECRET }} | |
files: ./target/lcov.info | |
slack-notify: | |
if: always() | |
needs: | |
- job-matrix | |
name: workflow notification to slack | |
runs-on: ubuntu-latest | |
steps: | |
- uses: Gamesight/slack-workflow-status@master | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} |