feat: CI workflows #3
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: CI | |
on: | |
merge_group: | |
types: [checks_requested] | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)" | |
required: false | |
default: false | |
pull_request: | |
types: [opened, synchronize] | |
paths-ignore: | |
- "**/*.md" | |
branches-ignore: | |
- "release-**" | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "**/*.md" | |
tags-ignore: | |
- "**" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: ${{ github.ref_name != 'main' }} | |
jobs: | |
rust_changes: | |
name: Rust Changes | |
runs-on: ubuntu-latest | |
outputs: | |
changed: ${{ steps.filter.outputs.changed }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
changed: | |
- '.github/workflows/ci.yml' | |
- 'crates/**' | |
- 'Cargo.lock' | |
- 'Cargo.toml' | |
- 'rust-toolchain.toml' | |
rust_check: | |
name: Rust check | |
needs: rust_changes | |
if: ${{ needs.rust_changes.outputs.changed == 'true' }} | |
runs-on: ${{ fromJSON(vars.LINUX_RUNNER_LABELS || '"ubuntu-latest"') }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust Toolchain | |
uses: ./.github/actions/rustup | |
with: | |
clippy: true | |
fmt: true | |
shared-key: check | |
- name: Pnpm Cache # Required by some tests | |
uses: ./.github/actions/pnpm-cache | |
- name: Run Setup | |
run: pnpm setup-crates | |
- name: Run Cargo Check | |
run: cargo check --workspace --all-targets --locked # Not using --release because it uses too much cache, and is also slow. | |
- name: Run Clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --workspace --all-targets -- -D warnings | |
# - name: Run rustfmt | |
# uses: actions-rs/cargo@v1 | |
# with: | |
# command: fmt | |
# args: --all -- --check | |
rust_test: | |
name: Rust test | |
needs: rust_changes | |
if: ${{ needs.rust_changes.outputs.changed == 'true' }} | |
runs-on: ${{ fromJSON(vars.LINUX_RUNNER_LABELS || '"ubuntu-latest"') }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Pnpm Cache # Required by some tests | |
uses: ./.github/actions/pnpm-cache | |
- uses: actions/checkout@v4 | |
- run: pnpm setup-crates | |
- name: Install Rust Toolchain | |
uses: ./.github/actions/rustup | |
with: | |
save-cache: ${{ github.ref_name == 'main' }} | |
shared-key: check | |
# Compile test without debug info for reducing the CI cache size | |
- name: Change profile.test | |
shell: bash | |
run: | | |
echo '[profile.test]' >> Cargo.toml | |
echo 'debug = false' >> Cargo.toml | |
- name: Run test | |
run: pnpm test |