Skip to content

Update Rust crate clap to v4.5.23 #152

Update Rust crate clap to v4.5.23

Update Rust crate clap to v4.5.23 #152

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags-ignore:
- v*
paths-ignore:
- 'LICENSE'
- '**.md'
pull_request:
paths-ignore:
- 'LICENSE'
- '**.md'
env:
CARGO_INCREMENTAL: 0
jobs:
format:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Cargo fmt
run: |
cargo fmt --version
cargo fmt --all -- --check
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Add clippy
run: rustup component add clippy
- name: Run lint
run: |
cargo clippy --version
cargo clippy
unit_tests:
name: Unit Tests
runs-on: ${{ matrix.os }}
needs: [format, lint]
timeout-minutes: 20
env:
# For some builds, we use cross to test on 32-bit and big-endian
# systems.
CARGO: cargo
# When CARGO is set to CROSS, this is set to `--target matrix.target`.
TARGET_FLAGS: ""
# When CARGO is set to CROSS, TARGET_DIR includes matrix.target.
TARGET_DIR: ./target
# Emit backtraces on panics.
RUST_BACKTRACE: 1
RUST_MIN_SRV: "1.43.1"
strategy:
fail-fast: false
matrix:
build: [linux, macos, win-msvc, win32-msvc]
include:
- build: linux
os: ubuntu-24.04
rust: stable
target: x86_64-unknown-linux-musl
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
- build: win-msvc
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
- build: win32-msvc
os: windows-latest
rust: stable
target: i686-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
- name: Use Cross
shell: bash
run: |
cargo install cross
echo "CARGO=cross" >> $GITHUB_ENV
echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
- name: Show command used for Cargo
run: |
echo "cargo command is: ${{ env.CARGO }}"
echo "target flag is: ${{ env.TARGET_FLAGS }}"
echo "target dir is: ${{ env.TARGET_DIR }}"
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- name: Build
run: ${{ env.CARGO }} build --verbose ${{ env.TARGET_FLAGS }}
- name: Run tests
run: ${{ env.CARGO }} test --verbose --workspace ${{ env.TARGET_FLAGS }}
coverage:
runs-on: ubuntu-latest
needs: [format, lint, unit_tests]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools
- name: Install cargo-llvm-cov and cargo-make
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov,cargo-make
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2
- name: Generate coverage
run: |
cargo llvm-cov --lcov --output-path target/lcov.info
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false # yet