Skip to content

chore: fix windows build #51

chore: fix windows build

chore: fix windows build #51

Workflow file for this run

name: Prebuild
on:
push:
# tags:
# - v*
env:
NAPI_VERSION: 7
BINDING_NAME: jpeg-turbo
MACOSX_DEPLOYMENT_TARGET: "10.13"
jobs:
build-and-test:
name: Build ${{ matrix.arch }} on ${{ matrix.os }} ${{ matrix.libc }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# windows
- os: windows-2019
arch: x64
is-native: true
- os: windows-2019
arch: ia32
is-native: false
# macos
- os: macos-11
arch: arm64
is-native: false
- os: macos-11
arch: x64
is-native: true
# linux
- os: ubuntu-latest
arch: x64
is-native: true
docker-arch: linux/amd64
docker-image: node:18-buster
extra-copy-args: --extraFiles libturbojpeg.so.0
# linux-libc
- os: ubuntu-latest
arch: arm64
is-native: false
docker-arch: linux/arm64
docker-image: node:18-buster
extra-copy-args: --extraFiles libturbojpeg.so.0
- os: ubuntu-latest
arch: arm
is-native: false
docker-arch: linux/arm/v7
docker-image: node:18-buster
extra-copy-args: --extraFiles libturbojpeg.so.0
# linux-musl
- os: ubuntu-latest
arch: x64
is-native: false
docker-arch: linux/amd64
docker-image: node:18-alpine
libc: musl
extra-copy-args: --extraFiles libturbojpeg.so.0
steps:
- uses: actions/checkout@v3
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y yasm
- name: Install Windows dependencies
if: runner.os == 'Windows'
run: |
mkdir c:\yasm
curl -o "c:\yasm\yasm.exe" http://www.tortall.net/projects/yasm/releases/yasm-1.3.0-win64.exe
echo "c:\yasm" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install macOS dependencies
if: runner.os == 'macOS'
run: |
brew install yasm
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: rebuild
if: ${{ !matrix.docker-arch }}
shell: bash
run: |
yarn
if [ -n "${{ matrix.is-native }}" ]; then
yarn test
fi
yarn rebuild --arch=${{ matrix.arch }}
yarn pkg-prebuilds-copy ${{ matrix.extra-copy-args }} \
--baseDir build/Release \
--source $BINDING_NAME.node \
--name=$BINDING_NAME \
--strip \
--napi_version=$NAPI_VERSION \
--arch=${{ matrix.arch }}
env:
CI: true
npm_config_build_from_source: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: matrix.docker-arch
- name: rebuild (in docker)
uses: addnab/docker-run-action@v3
if: matrix.docker-arch
with:
image: ${{ matrix.docker-image }}
# shell: bash
options: --platform=${{ matrix.docker-arch }} -v ${{ github.workspace }}:/work -e CI=1 -e npm_config_build_from_source=1 -e NAPI_VERSION -e BINDING_NAME
run: |
if command -v apt-get &> /dev/null
then
echo "deb http://deb.debian.org/debian buster-backports main contrib non-free" | tee -a /etc/apt/sources.list.d/backports.list
apt update
apt install -y cmake/buster-backports yasm
elif command -v apk &> /dev/null
then
apk update
apk add cmake make g++ gcc yasm
fi
cd /work
yarn
yarn test
yarn pkg-prebuilds-copy ${{ matrix.extra-copy-args }} \
--baseDir build/Release \
--source $BINDING_NAME.node \
--name=$BINDING_NAME \
--strip \
--napi_version=$NAPI_VERSION \
--arch=${{ matrix.arch }} \
--libc=${{ matrix.libc }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-${{ matrix.arch }}-${{ matrix.libc }}-prebuilds
path: prebuilds
retention-days: 1
bundle:
name: Bundle prebuilds
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
path: tmp
- name: Display structure of downloaded files
run: |
mkdir prebuilds
mv tmp/*/* prebuilds/
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: all-prebuilds
path: prebuilds
retention-days: 7