install cups #6
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: Pure Rust project build on Linux | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
DEBUG: 'napi:*' | |
MACOSX_DEPLOYMENT_TARGET: '10.13' | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
targets: | |
[ | |
'x86_64-apple-darwin', | |
'aarch64-apple-darwin', | |
'x86_64-pc-windows-msvc', | |
'i686-pc-windows-msvc', | |
'aarch64-pc-windows-msvc', | |
'x86_64-unknown-linux-gnu', | |
'aarch64-unknown-linux-gnu', | |
'x86_64-unknown-linux-musl', | |
'aarch64-unknown-linux-musl', | |
'armv7-unknown-linux-gnueabihf', | |
'aarch64-linux-android', | |
'armv7-linux-androideabi', | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
targets: ${{ matrix.targets }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- name: Install ziglang | |
uses: goto-bus-stop/setup-zig@v1 | |
with: | |
version: 0.11.0 | |
- run: apt update && apt install -y cups libcups2-dev | |
- run: cargo install cargo-xwin | |
- run: yarn install | |
- run: yarn build --target ${{ matrix.targets }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: bindings-${{ matrix.targets }} | |
path: node-printer-rust/*.node | |
if-no-files-found: error | |
test-host: | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- target: x86_64-apple-darwin | |
host: macos-latest | |
- target: x86_64-pc-windows-msvc | |
host: windows-latest | |
- target: i686-pc-windows-msvc | |
host: windows-latest | |
node: ['18', '20'] | |
runs-on: ${{ matrix.settings.host }} | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'yarn' | |
- name: Setup node x86 | |
if: matrix.settings.target == 'i686-pc-windows-msvc' | |
run: yarn config set supportedArchitectures.cpu "ia32" | |
shell: bash | |
- name: Install dependencies | |
run: yarn install | |
- name: Setup node x86 | |
uses: actions/setup-node@v4 | |
if: matrix.settings.target == 'i686-pc-windows-msvc' | |
with: | |
node-version: 18 | |
cache: yarn | |
architecture: x86 | |
- name: Download bindings | |
uses: actions/download-artifact@v4 | |
with: | |
name: bindings-${{ matrix.settings.target }} | |
path: node-printer-rust/ | |
- name: Run tests | |
run: yarn test | |
test-docker: | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- target: x86_64-unknown-linux-gnu | |
docker: node:18-slim | |
args: '' | |
- target: aarch64-unknown-linux-gnu | |
docker: node:18-slim | |
args: '--platform linux/arm64' | |
- target: x86_64-unknown-linux-musl | |
docker: node:18-alpine | |
args: '' | |
- target: aarch64-unknown-linux-musl | |
docker: node:18-alpine | |
args: '--platform linux/arm64' | |
- target: armv7-unknown-linux-gnueabihf | |
docker: node:18-bullseye-slim | |
args: '--platform linux/arm/v7' | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install | |
- name: Download bindings | |
uses: actions/download-artifact@v4 | |
with: | |
name: bindings-${{ matrix.settings.target }} | |
path: node-printer-rust/ | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64,arm | |
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: Run tests | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: ${{ matrix.settings.docker }} | |
options: ${{ matrix.settings.args }} -v ${{ github.workspace }}:/build -w /build | |
run: | | |
set -e | |
yarn test |