Skip to content

Push & PR

Push & PR #78

Workflow file for this run

name: Push & PR
on:
# We explicitly filter on `main` to avoid triggering on pushes to PR branches,
# which would otherwise be triggered by the `pull_request.synchronize` event
# and cause multiple runs of the same workflow for the same push.
# When the merge queue merges to main, it will trigger this workflow.
push:
branches:
- main
# This trigger will trigger on pushes to PR branches via the `synchronize`
# event type.
pull_request:
types: [opened, synchronize, reopened]
# This is required for the merge queue to work properly with the CI-required
# check. `checks_requested` is currently the only event type supported, but
# we're being explicit to avoid the potential addition of types like
# `checks_completed`, `queue_position`, etc. in the future from causing
# multiple CI runs for the same merge queue entry.
merge_group:
types: [checks_requested]
permissions: read-all
concurrency:
# Ensure that this workflow only runs once at a time for each PR or push,
# cancelling any in-progress runs for the same HEAD (PR) or branch (Push).
group: push-pr-${{ github.head_ref || github.ref_name || github.run_id}}
cancel-in-progress: true
env:
NODE_VERSION: 24.14.1
NEXTEST_VERSION: 0.9.88
CARGO_VET_VERSION: 0.10.0
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_STRIP: "debuginfo"
jobs:
# Runs various lints and checks for the project, including Rustfmt and Clippy
lint:
name: Run Lints
runs-on: ubuntu-24.04
steps:
- name: Setup Mold
id: setup_mold
uses: stacks-sbtc/actions/setup-mold@ed353a33594a2fa97ea6702d838e4a935cce374d
with:
make-default: true
- name: Checkout Repository
id: checkout_Repository
uses: stacks-sbtc/actions/checkout@ed353a33594a2fa97ea6702d838e4a935cce374d
- name: Setup Rust
id: setup_rust
uses: stacks-sbtc/actions/setup-rust-toolchain@ed353a33594a2fa97ea6702d838e4a935cce374d
with:
components: clippy, rustfmt
cache-key: "rust-tests"
- name: Lint (Rustfmt)
id: lint_rustfmt
run: cargo fmt --all -- --check
- name: Lint (Clippy)
id: lint_clippy
run: cargo clippy -- -D warnings
# Builds the Rust test artifacts for the project, packages them as Nextest
# archives and uploads them as artifacts. This job is used as a dependency for
# the `unit-tests` job.
build-tests:
name: Build Test Artifacts
runs-on: ubuntu-24.04
steps:
- name: Setup Mold
id: setup_mold
uses: stacks-sbtc/actions/setup-mold@ed353a33594a2fa97ea6702d838e4a935cce374d
with:
make-default: true
- name: Checkout Repository
id: checkout_Repository
uses: stacks-sbtc/actions/checkout@ed353a33594a2fa97ea6702d838e4a935cce374d
- name: Setup Rust
id: setup_rust
uses: stacks-sbtc/actions/setup-rust-toolchain@ed353a33594a2fa97ea6702d838e4a935cce374d
with:
cache-key: "rust-tests"
- name: Install Action
id: install_action
uses: stacks-sbtc/actions/install-action@ed353a33594a2fa97ea6702d838e4a935cce374d
with:
tool: nextest@${{ env.NEXTEST_VERSION }}
- name: Build Tests
id: build_tests
run: make test-build
- name: Create Nextest Archives
id: create_nextest_archives
run: make nextest-archive
- name: Upload Nextest Archives
id: upload_nextest_archives
uses: stacks-sbtc/actions/upload-artifact@ed353a33594a2fa97ea6702d838e4a935cce374d
with:
name: nextest-archives
path: ./target/nextest/*.tar.zst
# Runs the unit tests for the project. It depends on the `build-tests` job to
# build the Nextest test archives and upload them as artifacts. Note that
# since we are using nextest archives, we do not need Rust to be installed in
# this job.
unit-tests:
name: Run Unit Tests
runs-on: ubuntu-24.04
needs: build-tests
steps:
- name: Checkout Repository
id: checkout_Repository
uses: stacks-sbtc/actions/checkout@ed353a33594a2fa97ea6702d838e4a935cce374d
- name: Setup Pnpm
id: setup_pnpm
uses: stacks-sbtc/actions/setup-pnpm@ed353a33594a2fa97ea6702d838e4a935cce374d
- name: Setup Node
id: setup_node
uses: stacks-sbtc/actions/setup-node@ed353a33594a2fa97ea6702d838e4a935cce374d
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
- name: Install Action
id: install_action
uses: stacks-sbtc/actions/install-action@ed353a33594a2fa97ea6702d838e4a935cce374d
with:
tool: nextest@${{ env.NEXTEST_VERSION }}
- name: Download Nextest Archives
id: download_nextest_archives
uses: stacks-sbtc/actions/download-artifact@ed353a33594a2fa97ea6702d838e4a935cce374d
with:
name: nextest-archives
path: .
- name: Run Unit Tests (Rust)
id: run_rust_tests
run: cargo-nextest nextest --color always run --no-fail-fast --archive-file nextest-archive.tar.zst
- name: Install node dependencies
id: install_node_deps
run: pnpm --recursive install --frozen-lockfile
- name: Run Unit Tests (Node)
id: run_node_tests
run: pnpm --recursive test