Skip to content

Commit

Permalink
Add workflow to build
Browse files Browse the repository at this point in the history
  • Loading branch information
catloversg committed Aug 9, 2024
1 parent d23b91f commit 299b7fc
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Build

on: workflow_dispatch

env:
DEBUG: 'napi:*'
MACOSX_DEPLOYMENT_TARGET: '10.13'

jobs:
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Check formatting
run: cargo fmt --all --check

- name: Clippy
run: cargo clippy

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: x86_64-pc-windows-msvc, x86_64-unknown-linux-gnu

- uses: Swatinem/rust-cache@v2

- run: cargo install cargo-xwin

- name: Node install
run: npm ci

- name: Build Linux
run: npm run build -- --target x86_64-unknown-linux-gnu

- name: Build Windows
run: npm run build -- --target x86_64-pc-windows-msvc

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: OS specific binaries
path: dist
if-no-files-found: error

build-mac:
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: x86_64-apple-darwin, aarch64-apple-darwin

- uses: Swatinem/rust-cache@v2

- name: Node install
run: npm ci

- name: Build Mac x64
run: npm run build -- --target x86_64-apple-darwin

- name: Build Mac arm64
run: npm run build -- --target aarch64-apple-darwin

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: OS specific binaries
path: dist
if-no-files-found: error

0 comments on commit 299b7fc

Please sign in to comment.