Merge pull request #1 from rustyhorde/feature/binstall-fix #2
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: 🧪 Test 🧪 | |
jobs: | |
test-all-features: | |
name: 🧪 Test 🧪 | |
runs-on: ${{ inputs.os }} | |
env: | |
ARANGODB_ROOT_PASSWORD: ${{ secrets.ARANGODB_ROOT_PASSWORD }} | |
ARANGODB_RUARANGO_PASSWORD: ${{ secrets.ARANGODB_RUARANGO_PASSWORD }} | |
ARANGODB_URL: ${{ secrets.ARANGODB_URL }} | |
BB8_MONGODB_URL: ${{ secrets.BB8_MONGODB_URL }} | |
BB8_MONGODB_USER: ${{ secrets.BB8_MONGODB_USER }} | |
BB8_MONGODB_PASSWORD: ${{ secrets.BB8_MONGODB_PASSWORD }} | |
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 }}-${{ inputs.target }} | |
rustup toolchain install ${{ inputs.channel }}-${{ inputs.target }} --profile minimal --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: 🧪 Test 🧪 | |
if: ${{ inputs.project == '' }} | |
run: cargo matrix --num-chunks ${{ inputs.num_chunks }} --chunk ${{ inputs.chunk }} test | |
- name: 🧪 Test P 🧪 | |
if: ${{ inputs.project != '' }} | |
run: cargo matrix --num-chunks ${{ inputs.num_chunks }} --chunk ${{ inputs.chunk }} -p ${{ inputs.project }} test |