Skip to content

Commit

Permalink
ci: update build.yml to run on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
Dafyh committed Aug 5, 2024
1 parent 03bc9df commit 40b0ea7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
33 changes: 11 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ jobs:
platform: linuxmusl-x64
- os: ubuntu-22.04
platform: linux-x64
# - os: macos-12
# platform: darwin-x64
- os: macos-12
platform: darwin-x64
- os: windows-latest
platform: win32-x64
- os: windows-latest
Expand All @@ -59,20 +59,14 @@ jobs:
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
run: npm install --omit=optional

- name: Create a folder for the tarball
run: |
mkdir release
cd release
mkdir lib
run: mkdir -p release/${{ matrix.PLATFORM }}/lib

- name: Build and run Docker container
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'windows')
Expand All @@ -84,20 +78,14 @@ jobs:
docker run --name ${{ matrix.PLATFORM }} ${{ matrix.PLATFORM }}
# Copy .node file from the container
docker cp ${{ matrix.PLATFORM }}:/heif-converter/src/build/Release/converter.node ./release/lib/converter.${{ matrix.PLATFORM }}.node
docker cp ${{ matrix.PLATFORM }}:/heif-converter/src/build/Release/converter.node ./release/${{ matrix.PLATFORM }}/lib/converter.${{ matrix.PLATFORM }}.node
- name: Copy .dll files from the container (Windows)
if: contains(matrix.os, 'windows')
env:
SRC_PATH: /heif-converter/src/build/Release
run: |
docker cp ${{ matrix.PLATFORM }}:${{ env.SRC_PATH }}/heif.dll ./release/lib/heif.dll
docker cp ${{ matrix.PLATFORM }}:${{ env.SRC_PATH }}/turbojpeg.dll ./release/lib/turbojpeg.dll
docker cp ${{ matrix.PLATFORM }}:${{ env.SRC_PATH }}/jpeg62.dll ./release/lib/jpeg62.dll
docker cp ${{ matrix.PLATFORM }}:${{ env.SRC_PATH }}/libde265.dll ./release/lib/libde265.dll
docker cp ${{ matrix.PLATFORM }}:${{ env.SRC_PATH }}/libx265.dll ./release/lib/libx265.dll
docker cp ${{ matrix.PLATFORM }}:${{ env.SRC_PATH }}/libpng16.dll ./release/lib/libpng16.dll
docker cp ${{ matrix.PLATFORM }}:${{ env.SRC_PATH }}/zlib1.dll ./release/lib/zlib1.dll
for dll in heif.dll turbojpeg.dll jpeg62.dll libde265.dll libx265.dll libpng16.dll zlib1.dll; do
docker cp ${{ matrix.platform }}:/heif-converter/src/build/Release/$dll ./release/${{ matrix.PLATFORM }}/lib/$dll
done
- name: Clean up the Docker container (Windows and Linux)
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'windows')
Expand All @@ -118,14 +106,15 @@ jobs:
./vcpkg/vcpkg install libheif
# Build project
npm install --omit-optional
npm run configure
npm run build
# Run tests
# npm run test
npm run test
# Copy .node in the release folder
cp ./src/build/Release/converter.node ./release/lib/converter.${{ matrix.PLATFORM }}.node
cp ./src/build/Release/converter.node ./release/${{ matrix.PLATFORM }}/lib/converter.${{ matrix.PLATFORM }}.node
- name: Create tarball of the release folder
run: |
Expand Down
2 changes: 1 addition & 1 deletion src/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
[
'"<!(echo $VCPKG_LIB_ROOT)" == ""',
{
"VCPKG_LIB_ROOT%": "<(module_root_dir)/../vcpkg/installed/x64-osx"
"VCPKG_LIB_ROOT%": "<(module_root_dir)/../platform/darwin-x64"
}
]
]
Expand Down

0 comments on commit 40b0ea7

Please sign in to comment.