Build #43
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: Build | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '*' | |
env: | |
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
MACOSX_DEPLOYMENT_TARGET: 10.11 | |
jobs: | |
build: | |
name: Build ${{ matrix.target }} | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: | |
- 18.x | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
architecture: | |
- x64 | |
- arm64 | |
# Don't build arm64 bins for windows and ubuntu | |
exclude: | |
- os: ubuntu-latest | |
architecture: arm64 | |
- os: windows-latest | |
architecture: arm64 | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os: macos-latest | |
architecture: x64 | |
target: x86_64-apple-darwin | |
- os: macos-latest | |
architecture: arm64 | |
target: aarch64-apple-darwin | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 | |
- name: Configure git for private repos | |
env: | |
TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
git config --global url."https://${TOKEN}:[email protected]/".insteadOf "https://github.com/" | |
- name: Cache cargo registry | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/registry | |
key: cargo-registry-${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }} | |
- name: Cache cargo bin | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/bin | |
key: cargo-bin-${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }} | |
- name: Cache cargo build | |
uses: actions/cache@v2 | |
with: | |
path: target | |
key: cargo-build-target-${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }} | |
- name: Install latest Rust stable | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
override: true | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: yarn --ignore-scripts | |
- name: Build | |
run: yarn build --target=${{ matrix.target }} | |
# Until GH action adds M1 runners, can't run aarch64 libs | |
- name: Test | |
if: ${{ matrix.architecture == 'x64' }} | |
run: yarn test | |
- name: Publish | |
run: | | |
yarn package --target_arch=${{ matrix.architecture }} | |
yarn upload-binary |