Skip to content

Prebuild tests (electron [-t 33.0.0]) #51

Prebuild tests (electron [-t 33.0.0])

Prebuild tests (electron [-t 33.0.0]) #51

Workflow file for this run

name: prebuild-test
run-name: Prebuild tests (${{ inputs.runtime }} [${{ inputs.targets }}])
on:
workflow_dispatch:
inputs:
runtime:
description: 'Prebuild runtime'
type: choice
required: true
default: node
options:
- node
- electron
targets:
description: 'Runtime versions (targets)'
required: true
default: -t 18.0.0
ubuntu-20.04:
description: 'Test on ubuntu-20.04'
type: boolean
default: true
windows-2019:
description: 'Test on windows-2019'
type: boolean
default: true
macos-13:
description: 'Test on macos-13'
type: boolean
default: true
alpine:
description: 'Test on Alpine-Linux'
type: boolean
arm:
description: 'Test on ARM(v7/64) architectures'
type: boolean
env:
TEST_COMMAND: npx --no-install prebuild -r ${{ inputs.runtime }} ${{ inputs.targets }} --include-regex 'better_sqlite3.node$'
jobs:
input-setup:
if: inputs['ubuntu-20.04'] == true || inputs['windows-2019'] == true || inputs['macos-13'] == true
name: Preparing tests
runs-on: ubuntu-latest
outputs:
platforms: ${{ steps.set-platforms.outputs.platforms }}
steps:
- name: Setting up platform matrix
id: set-platforms
run: |
INPUTS='${{ toJSON(inputs) }}'
PLATFORMS='{"os":[]}'
for os in 'ubuntu-20.04' 'windows-2019' 'macos-13'
do
if [ "$(jq ".[\"$os\"]" <<< "$INPUTS")" = "true" ]; then PLATFORMS=$(jq -c ".os += [\"$os\"]" <<< "$PLATFORMS"); fi
done
echo "platforms=$PLATFORMS" >> $GITHUB_OUTPUT
prebuild-test:
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.input-setup.outputs.platforms) }}
name: Testing prebuild on ${{ matrix.os }}
needs: input-setup
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- if: ${{ startsWith(matrix.os, 'windows') }}
run: pip.exe install setuptools
- if: ${{ startsWith(matrix.os, 'macos') }}
run: brew install python-setuptools
- if: ${{ !startsWith(matrix.os, 'windows') && !startsWith(matrix.os, 'macos') }}
run: python3 -m pip install setuptools
- if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt update
sudo apt install gcc-10 g++-10 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
- run: npm install --ignore-scripts
- run: ${{ env.TEST_COMMAND }}
- if: matrix.os == 'windows-2019' && inputs.arm == true
run: ${{ env.TEST_COMMAND }} --arch arm64
prebuild-test-mac-arm64:
if: inputs.macos-13 == true && inputs.arm == true
name: Testing prebuild on M1 macOS (arm64)
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: brew install python-setuptools
- run: npm install --ignore-scripts
- run: ${{ env.TEST_COMMAND }}
prebuild-test-alpine-linux:
if: inputs.alpine == true
name: Testing prebuild on Alpine-Linux (x64)
runs-on: ubuntu-latest
container: node:18-alpine
steps:
- uses: actions/checkout@v4
- run: apk add build-base git python3 py3-setuptools --update-cache
- run: npm install --ignore-scripts
- run: ${{ env.TEST_COMMAND }}
prebuild-test-alpine-linux-arm64:
if: inputs.alpine == true && inputs.arm == true
name: Testing prebuild on Alpine-Linux (arm64)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- run: |
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/arm64 node:18-alpine -c "\
apk add build-base git python3 py3-setuptools --update-cache && \
cd /tmp/project && \
npm install --ignore-scripts && \
${{ env.TEST_COMMAND }}"
prebuild-test-linux-arm:
if: inputs['ubuntu-20.04'] == true && inputs.arm == true
strategy:
fail-fast: false
matrix:
arch:
- arm/v7
- arm64
name: Testing prebuild on Linux (${{ matrix.arch }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- run: |
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:18-bullseye -c "\
cd /tmp/project && \
npm install --ignore-scripts && \
${{ env.TEST_COMMAND }}"