Skip to content

Commit

Permalink
Run tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
oblador committed Oct 13, 2024
1 parent 8d9c853 commit 074a89e
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Setup
description: Setup Node.js and install dependencies

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version

- name: Install dependencies
run: yarn install --immutable
shell: bash
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#
name: CI

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
paths-ignore:
- "**/*.md"
- "**/*.yml"
- "!.github/workflows/ci.yml"
push:
branches:
- main
paths-ignore:
- "**/*.md"
- "**/*.yml"
- "!.github/workflows/ci.yml"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'main' }}

jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: macos-14
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: Boshen/setup-rust@main
with:
# warm cache factory for all other CI jobs
# cache `target` directory to avoid download crates
save-cache: ${{ github.ref_name == 'main' }}
cache-key: warm
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Fixture workspace
working-directory: fixtures/yarn-workspace
run: yarn install --immutable
shell: bash
- run: cargo check
- run: cargo test
- run: git diff --exit-code # Must commit everything

napi:
name: Test NAPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Boshen/setup-rust@main
with:
# warm cache factory for all other CI jobs
# cache `target` directory to avoid download crates
save-cache: ${{ github.ref_name == 'main' }}
cache-key: warm
- uses: ./.github/actions/setup
- run: yarn build
- run: node napi/test/sanity.spec.mjs
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.18.0
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.81.0"
profile = "default"

0 comments on commit 074a89e

Please sign in to comment.