Skip to content

Use cargo for binstall install on macos #1

Use cargo for binstall install on macos

Use cargo for binstall install on macos #1

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