Skip to content

fix: Fix Cargo bin detection on Windows. #3479

fix: Fix Cargo bin detection on Windows.

fix: Fix Cargo bin detection on Windows. #3479

Workflow file for this run

name: Rust
on:
push:
branches:
- master
pull_request:
paths:
- .cargo/config.toml
- .github/workflows/rust.yml
- crates/**
- nextgen/**
- tests/**
- Cargo.lock
- Cargo.toml
- Makefile.toml
- rust-toolchain.toml
env:
WITH_COVERAGE: ${{ contains(github.ref, 'develop-') || github.ref_name == 'master' }}
# sccache
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
RUSTC_WRAPPER: sccache
# RUST_LOG: trace
SCCACHE_BUCKET: moon-ci-sccache
# SCCACHE_LOG: debug
# SCCACHE_NO_DAEMON: 1
SCCACHE_REGION: us-east-2
SCCACHE_S3_SERVER_SIDE_ENCRYPTION: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: moonrepo/setup-rust@v1
with:
cache: false
components: rustfmt
- name: Check formatting
run: cargo fmt --all --check
lint:
name: Lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: moonrepo/setup-rust@v1
with:
bins: cargo-make
cache-base: '^(master|develop-)'
components: clippy
- uses: mozilla-actions/[email protected]
- name: Run linter
run: cargo make lint
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [buildjet-8vcpu-ubuntu-2204, self-hosted-laptop-macos-m1, self-hosted-laptop-windows-i7]
fail-fast: false
# Linux runs out of disk space right now...
continue-on-error: ${{ matrix.os == 'buildjet-8vcpu-ubuntu-2204' }}
steps:
- uses: actions/checkout@v4
- uses: moonrepo/setup-rust@v1
with:
bins: cargo-make, cargo-nextest, cargo-llvm-cov
cache-base: '^(master|develop-)'
components: llvm-tools-preview
# Required for "global bins" tests
- uses: moonrepo/setup-toolchain@v0
if: ${{ runner.os == 'Linux' }}
- run: proto install bun 1.0.0
if: ${{ runner.os == 'Linux' }}
- uses: mozilla-actions/[email protected]
- name: Run tests
if: ${{ env.WITH_COVERAGE == 'false' }}
run: cargo make test-ci
env:
NEXTEST_PROFILE: ci
- name: Run tests with coverage
if: ${{ env.WITH_COVERAGE == 'true' }}
run: cargo make test-coverage
env:
NEXTEST_PROFILE: ci
- name: Generate code coverage
if: ${{ env.WITH_COVERAGE == 'true' }}
run: cargo make generate-report
- name: Upload coverage report
uses: actions/upload-artifact@v3
if: ${{ env.WITH_COVERAGE == 'true' }}
with:
name: coverage-${{ runner.os }}
path: ./report.txt
if-no-files-found: error
coverage:
if: ${{ contains(github.ref, 'develop-') || github.ref_name == 'master' }}
name: Code coverage
runs-on: ubuntu-latest
needs:
- test
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
name: Download coverage reports
with:
path: coverage
- uses: codecov/codecov-action@v3
name: Upload to Codecov
with:
files: ./coverage/coverage-Linux/report.txt,./coverage/coverage-macOS/report.txt,./coverage/coverage-Windows/report.txt
flags: rust
verbose: true