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 28ae216
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LABEL maintainer="Nicolas Marteau <[email protected]>"

WORKDIR heif-converter
COPY . .
RUN npm install
RUN npm install --omit-optional
RUN npm run configure -- --target=v18.12.0
RUN npm run build -- --target=v18.12.0
RUN npm run test
42 changes: 20 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,18 @@ 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
docker cp ${{ matrix.PLATFORM }}:/heif-converter/src/build/Release/heif.dll ./release/lib/heif.dll
docker cp ${{ matrix.PLATFORM }}:/heif-converter/src/build/Release/turbojpeg.dll ./release/lib/turbojpeg.dll
docker cp ${{ matrix.PLATFORM }}:/heif-converter/src/build/Release/jpeg62.dll ./release/lib/jpeg62.dll
docker cp ${{ matrix.PLATFORM }}:/heif-converter/src/build/Release/libde265.dll ./release/lib/libde265.dll
docker cp ${{ matrix.PLATFORM }}:/heif-converter/src/build/Release/libx265.dll ./release/lib/libx265.dll
docker cp ${{ matrix.PLATFORM }}:/heif-converter/src/build/Release/libpng16.dll ./release/lib/libpng16.dll
docker cp ${{ matrix.PLATFORM }}:/heif-converter/src/build/Release/zlib1.dll ./release/lib/zlib1.dll
- name: Clean up the Docker container (Windows and Linux)
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'windows')
Expand All @@ -107,7 +99,12 @@ jobs:
if: contains(matrix.os, 'mac')
run: |
# Install nasm (useful for vcpkg)
brew update
brew install nasm
brew install llvm
brew link --force --overwrite llvm
brew install make
brew link --force --overwrite make
# Install python setup tools
pip3 install setuptools
Expand All @@ -118,14 +115,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
Empty file added platform/darwin-x64/.gitkeep
Empty file.

0 comments on commit 28ae216

Please sign in to comment.