-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add .yml workflow for github action
- Loading branch information
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Build and Retrieve Compiled Files | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-22.04, macos-11, windows-2019] | ||
include: | ||
- os: ubuntu-22.04 | ||
dockerfile: ./npm/linux-x64/Dockerfile | ||
platform: linux-x64 | ||
- os: ubuntu-22.04 | ||
dockerfile: ./npm/linuxmusl-x64/Dockerfile | ||
platform: linuxmusl-x64 | ||
- os: macos-11 | ||
platform: darwin-x64 | ||
- os: windows-2019 | ||
platform: windows-x64 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Create a folder for the tarball | ||
run: mkdir release | ||
|
||
- name: Build with Docker (${{ matrix.platform }}) | ||
if: contains(matrix.os, 'ubuntu') && matrix.dockerfile != '' | ||
run: | | ||
docker build -t ${{ matrix.platform }} -f ${{ matrix.dockerfile }} . | ||
docker run --name ${{ matrix.platform }} ${{ matrix.platform }} | ||
docker cp ${{ matrix.platform }}:/heif-converter/src/build/Release/converter.node ./release/converter.${{ matrix.platform }}.node | ||
docker container rm ${{ matrix.platform }} | ||
# - name: Build natively (Windows) | ||
# if: runner.os == 'Windows' | ||
# run: | | ||
# git clone https://github.com/microsoft/vcpkg.git | ||
# .\vcpkg\bootstrap-vcpkg.bat | ||
# .\vcpkg\vcpkg.exe install libheif | ||
# echo "::add-path::$(pwd)\vcpkg\installed\x64-windows\bin" | ||
# echo "::add-path::$(pwd)\vcpkg\installed\x64-windows\lib" | ||
# npm install -g node-gyp | ||
# node-gyp configure -C src | ||
# node-gyp build -C src | ||
# cp ./src/build/Release/converter.node ./src/build/Release/converter-windows-x64.node | ||
|
||
- name: Create tarball of the release folder | ||
run: tar -czf ${{ matrix.platform }}.tar.gz -C release . | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: release | ||
path: ${{ matrix.platform }}.tar.gz |