chore(pr): add pull requests workflow #11
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
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
# cancel previous runs on the same PR | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
name: ⛷ PR tests | |
env: | |
CI: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build-and-test: | |
name: 🏗 Build Project & 🧪 Run Tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup pnpm | |
uses: pnpm/[email protected] | |
- name: Setup Node.js | |
id: setup-node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Cache Rust build | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
rust_lambdas/target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install Zig toolchain | |
uses: goto-bus-stop/setup-zig@v2 | |
- name: Install Cargo Lambda | |
uses: jaxxstorm/[email protected] | |
with: | |
repo: cargo-lambda/cargo-lambda | |
platform: linux # Other valid options: 'windows' or 'darwin' | |
arch: x86_64 # Other valid options for linux: 'aarch64' | |
- name: Build Rust Lambdas | |
run: cargo lambda build --arm64 --release --output-format zip | |
working-directory: rust_lambdas | |
- name: '🧪 Test linter' | |
run: pnpm run test-linter | |
- name: '🏗 Test types' | |
run: pnpm test-type | |
- name: '🏗 Test unit' | |
run: pnpm test-unit |