Skip to content

Merge pull request #1 from rustyhorde/feature/binstall-fix #2

Merge pull request #1 from rustyhorde/feature/binstall-fix

Merge pull request #1 from rustyhorde/feature/binstall-fix #2

Workflow file for this run

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
clean:
description: 'Clean the workspace before running llvm-cov'
default: false
required: false
type: boolean
lcov:
description: 'Generate an LCOV report (lcov.info)'
default: false
required: false
type: boolean
html:
description: 'Generate an HTML report'
default: false
required: false
type: boolean
run_cmd:
description: 'The command to run to generate the llvm-cov output'
default: cargo llvm-cov --no-report
required: false
type: string
name: 🧱 Coverage 🧱
jobs:
coverage:
name: 🧱 Coverage 🧱
runs-on: ${{ inputs.os }}
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 }}
rustup component add llvm-tools-preview
- 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 (llvm-cov) πŸ’Ύ
run: cargo binstall --no-confirm --no-symlinks cargo-llvm-cov --force
- name: πŸ’Ύ Install (cargo-matrix) πŸ’Ύ
run: cargo binstall --no-confirm --no-symlinks --no-discover-github-token cargo-matrix --force
- name: πŸ™Š Clean Workspace πŸ™Š
if: inputs.clean
run: cargo llvm-cov clean --workspace
- name: πŸ™Š Code Coverage πŸ™Š
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 }}
run: ${{ inputs.run_cmd }}
- name: πŸ™Š Code Coverage Report (LCOV) πŸ™Š
if: inputs.lcov
run: cargo llvm-cov report --lcov --output-path lcov.info
- name: πŸ™Š Code Coverage Report (HTML) πŸ™Š
if: inputs.html
run: cargo llvm-cov report --html
- name: πŸ™Š Upload Code Coverage πŸ™Š
if: inputs.lcov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./lcov.info