Type extractors for common container types #560
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: 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: Install cargo-llvm-cov | |
if: matrix.os == 'ubuntu-latest' && matrix.rust-toolchain == 'stable' | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Set coverage environment variables | |
if: matrix.os == 'ubuntu-latest' && matrix.rust-toolchain == 'stable' | |
run: cargo llvm-cov show-env | tr -d "'" >> $GITHUB_ENV | |
- name: npm install | |
run: npm ci --prefer-offline --no-audit --no-fund | |
- name: Allow unprivileged X server | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 | |
- 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 | |
- name: Generate coverage report | |
if: matrix.os == 'ubuntu-latest' && matrix.rust-toolchain == 'stable' | |
run: cargo llvm-cov report --ignore-filename-regex test --codecov --output-path target/codecov.json | |
- name: Upload coverage to Codecov | |
if: matrix.os == 'ubuntu-latest' && matrix.rust-toolchain == 'stable' | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: neon-bindings/neon | |
files: target/codecov.json |