Skip to content

fix(neon): Require TryFromJs::Error to implement TryIntoJs #485

fix(neon): Require TryFromJs::Error to implement TryIntoJs

fix(neon): Require TryFromJs::Error to implement TryIntoJs #485

Workflow file for this run

name: CI
on:
push:
# Prevent duplicate runs of this workflow on our own internal PRs.
branches:
- main
- next/*
pull_request:
types: [opened, synchronize, reopened, labeled]
branches:
- main
- next/*
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
jobs:
matrix:
runs-on: ubuntu-latest
outputs:
node_version: ${{ steps.set_matrix.outputs.node_version }}
rust_toolchain: ${{ steps.set_matrix.outputs.rust_toolchain }}
steps:
- name: Set Matrix
id: set_matrix
env:
FULL_NODE_VERSIONS: '["18.x", "20.x"]'
FULL_RUST_TOOLCHAINS: '["stable", "nightly"]'
PARTIAL_NODE_VERSIONS: '["20.x"]'
PARTIAL_RUST_TOOLCHAINS: '["stable"]'
HAS_FULL_MATRIX_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'full matrix') }}
IS_PUSHED: ${{ github.event_name == 'push' }}
run: |
if [[ "$HAS_FULL_MATRIX_LABEL" == "true" ]] || [[ "$IS_PUSHED" == "true" ]]; then
echo "node_version=$FULL_NODE_VERSIONS" >> $GITHUB_OUTPUT
echo "rust_toolchain=$FULL_RUST_TOOLCHAINS" >> $GITHUB_OUTPUT
else
echo "node_version=$PARTIAL_NODE_VERSIONS" >> $GITHUB_OUTPUT
echo "rust_toolchain=$PARTIAL_RUST_TOOLCHAINS" >> $GITHUB_OUTPUT
fi
build:
needs: matrix
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: ${{fromJson(needs.matrix.outputs.node_version)}}
rust-toolchain: ${{fromJson(needs.matrix.outputs.rust_toolchain)}}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Use Rust ${{ matrix.rust-toolchain }}
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.rust-toolchain }}
components: clippy,rustfmt
- name: Linkme nightly workaround
if: matrix.rust-toolchain == 'nightly' && matrix.os == 'ubuntu-latest'
# Workaround for linkme with `rust-lld`
# https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html#possible-drawbacks
run: echo RUSTFLAGS=${RUSTFLAGS}\ -Clink-arg=-Wl,-z,nostart-stop-gc >> $GITHUB_ENV
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Cache Electron (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/cache@v4
with:
key: ${{ runner.os }}-electron-${{ hashFiles('./package-lock.json') }}
path: ~/.cache/electron
- name: Cache Electron (Windows)
if: matrix.os == 'windows-latest'
uses: actions/cache@v4
with:
key: ${{ runner.os }}-electron-${{ hashFiles('./package-lock.json') }}
path: "%LOCALAPPDATA%\\electron\\Cache"
- name: Cache Electron (macOS)
if: matrix.os == 'macos-latest'
uses: actions/cache@v4
with:
key: ${{ runner.os }}-electron-${{ hashFiles('./package-lock.json') }}
path: ~/Library/Caches/electron
- name: npm install
run: npm ci --prefer-offline --no-audit --no-fund
- name: Test (Linux)
if: matrix.os == 'ubuntu-latest'
run: xvfb-run --auto-servernum npm test -- --nocapture
- name: Test
if: matrix.os != 'ubuntu-latest'
run: npm test