diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..93c896e --- /dev/null +++ b/.github/workflows/build.yml @@ -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 \ No newline at end of file