new: Add moon action-graph
command.
#3291
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
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.head_ref, 'develop-') || endsWith(github.ref, 'master') }} | |
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: | |
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 | |
components: clippy | |
- name: Run linter | |
run: cargo make lint | |
test: | |
name: Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [buildjet-4vcpu-ubuntu-2204, self-hosted-laptop-macos-m1, self-hosted-laptop-windows-i7] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: moonrepo/setup-rust@v1 | |
with: | |
bins: cargo-make, cargo-nextest, cargo-llvm-cov | |
components: llvm-tools-preview | |
cache: false # ${{ runner.os == 'Linux' }} | |
- name: Run tests with coverage | |
if: ${{ env.WITH_COVERAGE == 'true' }} | |
run: cargo make test-coverage | |
env: | |
NEXTEST_PROFILE: ci | |
- name: Run tests | |
if: ${{ env.WITH_COVERAGE == 'false' }} | |
run: cargo make test-ci | |
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.head_ref, 'develop-') || endsWith(github.ref, '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 |