From 28ae216a1ea20c8fe7eec3cdf35d659fc5d7773e Mon Sep 17 00:00:00 2001 From: Nicolas MARTEAU Date: Thu, 1 Aug 2024 11:29:25 +0200 Subject: [PATCH] ci: update build.yml to run on macos --- .github/Dockerfile | 2 +- .github/workflows/build.yml | 42 +++++++++++++++++------------------- platform/darwin-x64/.gitkeep | 0 3 files changed, 21 insertions(+), 23 deletions(-) create mode 100644 platform/darwin-x64/.gitkeep diff --git a/.github/Dockerfile b/.github/Dockerfile index f5335aa..c16f8e8 100644 --- a/.github/Dockerfile +++ b/.github/Dockerfile @@ -5,7 +5,7 @@ LABEL maintainer="Nicolas Marteau " 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 \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f673b5a..134089e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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') @@ -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') @@ -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 @@ -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: | diff --git a/platform/darwin-x64/.gitkeep b/platform/darwin-x64/.gitkeep new file mode 100644 index 0000000..e69de29