Use cargo for binstall install on macos #1
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
on: | |
workflow_call: | |
inputs: | |
os: | |
description: 'The os to run this job on [ubuntu-latest, macos-latest, windows-latest]' | |
required: true | |
type: string | |
channel: | |
description: 'The rust channel to use [stable, beta, nightly, version i.e. 1.70.0]' | |
required: true | |
type: string | |
target: | |
description: 'The rust target, i.e x86_64-unknown-linux-gnu' | |
required: true | |
type: string | |
num_chunks: | |
description: 'The number of chunks to run for cargo-matrix' | |
default: 1 | |
required: false | |
type: number | |
chunk: | |
description: 'The chunk number to run for cargo-matrix' | |
default: 1 | |
required: false | |
type: number | |
project: | |
description: 'The project to run cargo-matrix against (useful in workspaces)' | |
default: '' | |
required: false | |
type: string | |
update: | |
description: 'Run cargo update before running clippy command' | |
required: false | |
default: false | |
type: boolean | |
name: π³οΈ Clippy π³οΈ | |
jobs: | |
clippy-all-features: | |
name: π³οΈ Lints π³οΈ | |
runs-on: ${{ inputs.os }} | |
env: | |
ARANGODB_ROOT_PASSWORD: ${{ secrets.ARANGODB_ROOT_PASSWORD }} | |
ARANGODB_RUARANGO_PASSWORD: ${{ secrets.ARANGODB_RUARANGO_PASSWORD }} | |
ARANGODB_URL: ${{ secrets.ARANGODB_URL }} | |
steps: | |
- name: β Checkout β | |
uses: actions/checkout@v4 | |
- name: π§Ή Cleanup π§Ή | |
if: inputs.os == 'ubuntu-latest' | |
run: | | |
rm -rf /home/runner/.cargo/bin/rustfmt | |
rm -rf /home/runner/.cargo/bin/cargo-fmt | |
rm -rf /home/runner/.cargo/bin/rust-analyzer | |
- name: π§Ή Cleanup π§Ή | |
if: inputs.os == 'windows-latest' | |
run: | | |
If (Test-Path C:\Users\runneradmin\.cargo\bin\rustfmt.exe) { Remove-Item C:\Users\runneradmin\.cargo\bin\rustfmt.exe } | |
If (Test-Path C:\Users\runneradmin\.cargo\bin\cargo-fmt.exe) { Remove-Item C:\Users\runneradmin\.cargo\bin\cargo-fmt.exe } | |
If (Test-Path C:\Users\runneradmin\.cargo\bin\rust-analyzer.exe) { Remove-Item C:\Users\runneradmin\.cargo\bin\rust-analyzer.exe } | |
- name: π§° Toolchain π§° | |
run: | | |
rustup toolchain remove ${{ inputs.channel }} | |
rustup toolchain install ${{ inputs.channel }} --profile default --no-self-update | |
rustup default ${{ inputs.channel }} | |
- name: π΅ Rust Cache π΅ | |
uses: Swatinem/rust-cache@v2 | |
if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} | |
with: | |
key: ${{ inputs.target }} | |
cache-all-crates: true | |
- name: πΎ Install (cargo-binstall) πΎ | |
if: inputs.os == 'ubuntu-latest' || inputs.os == 'windows-latest' | |
uses: cargo-bins/cargo-binstall@main | |
- name: πΎ Install (cargo-binstall) πΎ | |
if: inputs.os == 'macos-latest' | |
uses: cargo install cargo-binstall --force | |
- name: πΎ Install (cargo-matrix) πΎ | |
run: cargo binstall --no-confirm --no-symlinks --no-discover-github-token cargo-matrix --force | |
- name: πΊ Update πΊ | |
if: inputs.update | |
run: cargo update | |
- name: π Clippy π | |
if: ${{ inputs.project == '' }} | |
run: cargo matrix --num-chunks ${{ inputs.num_chunks }} --chunk ${{ inputs.chunk }} clippy --all-targets -- -Dwarnings | |
- name: π Clippy P π | |
if: ${{ inputs.project != '' }} | |
run: cargo matrix --num-chunks ${{ inputs.num_chunks }} --chunk ${{ inputs.chunk }} -p ${{ inputs.project }} clippy --all-targets -- -Dwarnings |