124 lines
3.9 KiB
YAML
124 lines
3.9 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
release:
|
|
types:
|
|
- released
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
os:
|
|
- ubuntu-20.04
|
|
- macos-latest
|
|
- windows-2019
|
|
node:
|
|
- 14
|
|
- 16
|
|
- 18
|
|
name: Testing Node ${{ matrix.node }} on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
- run: npm install --ignore-scripts
|
|
- run: npm run build-debug
|
|
- run: npm test
|
|
|
|
publish:
|
|
if: ${{ github.event_name == 'release' }}
|
|
name: Publishing to NPM
|
|
runs-on: ubuntu-18.04
|
|
needs: test
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: 16
|
|
registry-url: https://registry.npmjs.org
|
|
- run: npm publish
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
prebuild:
|
|
strategy:
|
|
matrix:
|
|
os:
|
|
- ubuntu-18.04
|
|
- macos-latest
|
|
- windows-2019
|
|
name: Prebuild on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
needs: publish
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: 16
|
|
- run: npm install --ignore-scripts
|
|
- run: npx --no-install prebuild -r node -t 14.0.0 -t 16.0.0 -t 18.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}
|
|
- run: npx --no-install prebuild -r electron -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}
|
|
- if: matrix.os == 'windows-2019'
|
|
run: npx --no-install prebuild -r electron -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 --include-regex 'better_sqlite3.node$' --arch ia32 -u ${{ secrets.GITHUB_TOKEN }}
|
|
- if: matrix.os == 'macos-latest'
|
|
run: npx --no-install prebuild -r electron -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 --include-regex 'better_sqlite3.node$' --arch arm64 -u ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
prebuild-alpine:
|
|
name: Prebuild on alpine
|
|
runs-on: ubuntu-latest
|
|
container: node:16-alpine
|
|
needs: publish
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- run: apk add build-base git python3 --update-cache
|
|
- run: npm install --ignore-scripts
|
|
- run: npx --no-install prebuild -r node -t 14.0.0 -t 16.0.0 -t 18.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
prebuild-alpine-arm:
|
|
strategy:
|
|
matrix:
|
|
arch:
|
|
- arm/v7
|
|
- arm64
|
|
name: Prebuild on alpine (${{ matrix.arch }})
|
|
runs-on: ubuntu-latest
|
|
needs: publish
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: docker/setup-qemu-action@v1
|
|
- run: |
|
|
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:16-alpine -c "\
|
|
apk add build-base git python3 --update-cache && \
|
|
cd /tmp/project && \
|
|
npm install --ignore-scripts && \
|
|
npx --no-install prebuild -r node -t 14.0.0 -t 16.0.0 -t 18.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
prebuild-linux-arm:
|
|
strategy:
|
|
matrix:
|
|
arch:
|
|
- arm/v7
|
|
- arm64
|
|
name: Prebuild on Linux (${{ matrix.arch }})
|
|
runs-on: ubuntu-latest
|
|
needs: publish
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: docker/setup-qemu-action@v1
|
|
- run: |
|
|
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:16 -c "\
|
|
cd /tmp/project && \
|
|
npm install --ignore-scripts && \
|
|
npx --no-install prebuild -r node -t 14.0.0 -t 16.0.0 -t 18.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}"
|