Update Rust crate anyhow to v1.0.93 #595
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: Rust | |
on: | |
push: | |
pull_request: | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dependencies | |
if: ${{ env.ACT }} | |
run: sudo apt update && sudo apt install -y apt-utils pip | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
cache: pip | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- name: Dependencies | |
run: sudo apt install -y libdbus-1-dev | |
- uses: pre-commit/[email protected] | |
check: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
security-events: write | |
actions: read | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Dependencies | |
if: ${{ env.ACT }} | |
run: sudo apt update | |
- name: Dependencies | |
run: sudo apt install -y libdbus-1-dev | |
- uses: dtolnay/rust-toolchain@stable | |
id: toolchain | |
with: | |
components: rustfmt, clippy | |
- uses: actions/cache@v3 | |
id: cache-registry | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-check | |
restore-keys: | | |
${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}- | |
${{ runner.os }}-cargo-registry- | |
- uses: actions/cache@v3 | |
id: cache-toolchain-dependent | |
with: | |
path: | | |
~/.cargo/bin/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}-check | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }} | |
${{ runner.os }}-cargo-${{ steps.toolchain.outputs.cachekey }}- | |
- name: Install required cargo | |
run: cargo install clippy-sarif sarif-fmt | |
# This would fail if we already have the programs installed with no updates available | |
# If we do need to install them, we'll find out that we failed in the next step | |
continue-on-error: true | |
- name: Run rust-clippy | |
run: cargo clippy | |
--all-features | |
--message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt | |
continue-on-error: true | |
- name: Upload analysis results to GitHub | |
if: ${{ ! env.ACT }} | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: rust-clippy-results.sarif | |
wait-for-processing: true | |
- name: Check Cargo fmt | |
run: cargo fmt | |
--all | |
--check | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- check | |
strategy: | |
matrix: | |
rust: | |
- stable | |
- beta | |
- nightly | |
- 1.63.0 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Dependencies | |
if: ${{ env.ACT }} | |
run: sudo apt update | |
- name: Dependencies | |
run: sudo apt install -y libdbus-1-dev | |
- uses: dtolnay/rust-toolchain@master | |
id: toolchain | |
with: | |
toolchain: ${{ matrix.rust }} | |
- uses: actions/cache@v3 | |
id: cache-registry | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-build | |
restore-keys: | | |
${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-check | |
${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}- | |
${{ runner.os }}-cargo-registry- | |
- uses: actions/cache@v3 | |
id: cache-toolchain-dependent | |
with: | |
path: | | |
~/.cargo/bin/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}-build | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}-check | |
${{ runner.os }}-cargo-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}- | |
${{ runner.os }}-cargo-${{ steps.toolchain.outputs.cachekey }}- | |
- name: Build | |
run: cargo build | |
--locked | |
--all-targets | |
- name: Test | |
run: cargo test --locked | |
publish: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- pre-commit | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Dependencies | |
if: ${{ env.ACT }} | |
run: sudo apt update | |
- name: Dependencies | |
run: sudo apt install -y libdbus-1-dev | |
- uses: dtolnay/rust-toolchain@stable | |
id: toolchain | |
- uses: actions/cache@v3 | |
id: cache-registry | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-publish | |
restore-keys: | | |
${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-build | |
${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}- | |
${{ runner.os }}-cargo-registry- | |
- uses: actions/cache@v3 | |
id: cache-toolchain-dependent | |
with: | |
path: | | |
~/.cargo/bin/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}-publish | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}-build | |
${{ runner.os }}-cargo-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}- | |
${{ runner.os }}-cargo-${{ steps.toolchain.outputs.cachekey }}- | |
- uses: katyo/publish-crates@v2 | |
with: | |
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
ignore-unpublished-changes: true |