Skip to content

feat: use vcpkg binary files to compile .node on github action #9

feat: use vcpkg binary files to compile .node on github action

feat: use vcpkg binary files to compile .node on github action #9

Workflow file for this run

name: Build Node.js Artifact
on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]
jobs:
push_on_main:
if: github.event_name == 'push'
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-22.04
platform: linuxmusl-x64
- os: ubuntu-22.04
platform: linux-x64
- os: macos-12
platform: darwin-x64
- os: windows-latest
platform: win32-x64
- os: windows-latest
platform: win32-ia32
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies and test
run: |
npm install
npm run test
pull_request:
if: github.event_name == 'pull_request'
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-22.04
platform: linuxmusl-x64
- os: ubuntu-22.04
platform: linux-x64
- os: macos-12
platform: darwin-x64
- os: windows-latest
platform: win32-x64
- os: windows-latest
platform: win32-ia32
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Create a folder for the tarball
run: mkdir -p release/${{ matrix.PLATFORM }}/lib
- name: Configure and Build projects
run: |
# Build project
npm install --omit-optional
npm run configure
npm run build
# Copy .node in the release folder
cp ./src/build/Release/converter.node ./release/${{ matrix.PLATFORM }}/lib/converter.${{ matrix.PLATFORM }}.node
- name: Copy .dll files for artifacts and tests (Windows)
if: contains(matrix.os, 'windows')
run: |
# Copy for artifact
cp platform/${{ matrix.PLATFORM }}/bin/heif.dll ./release/${{ matrix.PLATFORM }}/lib/heif.dll
cp platform/${{ matrix.PLATFORM }}/bin/turbojpeg.dll ./release/${{ matrix.PLATFORM }}/lib/turbojpeg.dll
cp platform/${{ matrix.PLATFORM }}/bin/libde265.dll ./release/${{ matrix.PLATFORM }}/lib/libde265.dll
cp platform/${{ matrix.PLATFORM }}/bin/libx265.dll ./release/${{ matrix.PLATFORM }}/lib/libx265.dll
cp platform/${{ matrix.PLATFORM }}/bin/libpng16.dll ./release/${{ matrix.PLATFORM }}/lib/libpng16.dll
- name: Run tests
run: npm run test
- name: Create tarball of the release folder
run: |
cd ./release
tar -czf ${{ matrix.platform }}.tar.gz *
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: release
path: ./release/${{ matrix.platform }}.tar.gz