Skip to content

Commit

Permalink
ci: add .yml workflow for github action
Browse files Browse the repository at this point in the history
  • Loading branch information
Dafyh committed Jul 4, 2024
1 parent 3f752de commit 50a5976
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/build.yml
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

0 comments on commit 50a5976

Please sign in to comment.