Skip to content

chore: change version (#58) #123

chore: change version (#58)

chore: change version (#58) #123

Workflow file for this run

name: CI
env:
DEBUG: napi:*
APP_NAME: node-screenshots
MACOSX_DEPLOYMENT_TARGET: '10.13'
CARGO_INCREMENTAL: '1'
on:
push:
branches:
- master
tags:
- v*.*.*
paths-ignore:
- '**/*.md'
- LICENSE
- '**/*.gitignore'
- .editorconfig
- docs/**
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 24
cache: yarn
- name: Install
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libclang-dev libxcb1-dev libxrandr-dev libdbus-1-dev libpipewire-0.3-dev
- name: Install dependencies
run: yarn install
- name: Oxlint
run: yarn lint
- name: Cargo fmt
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy
build:
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
build: yarn build --target x86_64-apple-darwin
- host: macos-latest
target: aarch64-apple-darwin
build: yarn build --target aarch64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
build: yarn build --target x86_64-pc-windows-msvc
- host: windows-latest
target: aarch64-pc-windows-msvc
build: yarn build --target aarch64-pc-windows-msvc
- host: windows-latest
target: i686-pc-windows-msvc
build: yarn build --target i686-pc-windows-msvc
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
docker: node:24-bullseye
build: bash ./scripts/x86_64-unknown-linux-gnu.sh
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: node:24-alpine
build: ash ./scripts/x86_64-unknown-linux-musl.sh
- host: ubuntu-latest
target: loongarch64-unknown-linux-gnu
docker: --platform linux/loong64 ghcr.io/loong64/node:24-trixie
build: bash ./scripts/loongarch64-unknown-linux-gnu.sh
name: stable - ${{ matrix.settings.target }} - node@22
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v6
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 24
cache: yarn
- name: Install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.settings.target }}
- name: Cache cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.napi-rs
.cargo-cache
target/
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
- name: Setup toolchain
run: ${{ matrix.settings.setup }}
if: ${{ matrix.settings.setup }}
shell: bash
- name: Install dependencies
run: yarn install
- name: Set up QEMU
if: ${{ matrix.settings.docker }}
uses: docker/setup-qemu-action@v3
- name: Build in docker
if: ${{ matrix.settings.docker }}
run: docker run --rm -v ${{ github.workspace }}:/build -w /build ${{ matrix.settings.docker }} ${{ matrix.settings.build }}
shell: bash
- name: Build
if: ${{ !matrix.settings.docker }}
run: ${{ matrix.settings.build }}
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v5
with:
name: bindings-${{ matrix.settings.target }}
path: |
${{ env.APP_NAME }}.*.node
${{ env.APP_NAME }}.*.wasm
if-no-files-found: error
test-macOS-windows-binding:
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
needs:
- build
strategy:
fail-fast: false
matrix:
settings:
- host: windows-latest
target: x86_64-pc-windows-msvc
architecture: x64
- host: windows-11-arm
target: aarch64-pc-windows-msvc
architecture: arm64
- host: macos-latest
target: aarch64-apple-darwin
architecture: arm64
- host: macos-latest
target: x86_64-apple-darwin
architecture: x64
node:
- '20'
- '22'
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v6
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
cache: yarn
architecture: ${{ matrix.settings.architecture }}
- name: Install dependencies
run: yarn install
- name: Download artifacts
uses: actions/download-artifact@v6
with:
name: bindings-${{ matrix.settings.target }}
path: .
- name: List packages
run: ls -R .
shell: bash
- name: Test bindings
run: yarn test
# test-linux-binding:
# name: Test x86_64 - node@${{ matrix.node }}
# needs:
# - build
# strategy:
# fail-fast: false
# matrix:
# node:
# - 18
# - 20
# - 22
# - 24
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v6
# - name: Download artifacts
# uses: actions/download-artifact@v6
# with:
# pattern: bindings-x86_64-unknown-linux-*
# merge-multiple: true
# path: .
# - name: List packages
# run: ls -R .
# shell: bash
# - name: Test bindings (gnu)
# run: docker run --rm -v ${{ github.workspace }}:/build -w /build ghcr.io/nashaofu/node-screenshots/node-desktop:${{ matrix.node }}-debian yarn install && yarn test
# - name: Test bindings (musl)
# run: docker run --rm -v ${{ github.workspace }}:/build -w /build ghcr.io/nashaofu/node-screenshots/node-desktop:${{ matrix.node }}-apline yarn install && yarn test
publish:
name: Publish
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
permissions:
contents: write
id-token: write
needs:
- lint
- test-macOS-windows-binding
# - test-linux-binding
steps:
- uses: actions/checkout@v6
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
cache: yarn
- name: Install dependencies
run: yarn install
- name: create npm dirs
run: yarn napi create-npm-dirs
- name: Download all artifacts
uses: actions/download-artifact@v6
with:
path: artifacts
- name: Move artifacts
run: yarn artifacts
- name: List packages
run: ls -R ./npm
shell: bash
- name: Publish
run: |
npm config set provenance true
if [ -z "$IS_NEXT" ]; then
npm publish --access public
else
npm publish --access public --tag next
fi
env:
IS_NEXT: ${{ endsWith(github.ref_name, '-next') }}
- name: Release drafter
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
publish: true
name: ${{ github.ref_name }}
tag: ${{ github.ref_name }}