PR validation pipeline #1
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: PR Validation | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
checkout-repo: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Ensure unambiguous `main` | |
if: github.ref != 'refs/heads/main' | |
run: | | |
git remote set-branches origin main | |
git fetch --depth 1 origin main | |
git branch main origin/main | |
setup-rust: | |
runs-on: ubuntu-latest | |
needs: checkout-repo | |
steps: | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-setup-rust-${{ hashFiles('**/Cargo.toml') }} | |
- name: Set default Rust toolchain | |
run: rustup default stable | |
- name: Verify Rust setup | |
run: rustup show | |
setup-node: | |
runs-on: ubuntu-latest | |
needs: checkout-repo | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/ | |
key: ${{ runner.os }}-setup-node-${{ hashFiles('**/package.json', '**/package-lock.json') }} | |
- name: Install node dependencies | |
run: npm ci | |
validate-affected: | |
runs-on: ubuntu-latest | |
needs: | |
- setup-rust | |
- setup-node | |
steps: | |
- name: nx affected | |
run: npx nx affected -t format lint test --configuration ci |