Skip to content

Commit

Permalink
chore: improve build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Dafyh committed Jul 5, 2024
1 parent 50a5976 commit 1716c25
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@ jobs:
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: ubuntu-22.04
platform: linux-x64
- os: macos-11
platform: darwin-x64
- os: windows-2019
- os: windows-2020
platform: windows-x64

steps:
Expand All @@ -42,9 +39,9 @@ jobs:
run: mkdir release

- name: Build with Docker (${{ matrix.platform }})
if: contains(matrix.os, 'ubuntu') && matrix.dockerfile != ''
if: contains(matrix.os, 'ubuntu')
run: |
docker build -t ${{ matrix.platform }} -f ${{ matrix.dockerfile }} .
docker build --build-arg PLATFORM=${{ matrix.platform }} --build-arg LIBHEIF_V=v1.17.6 -t test . -f ./platform/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 }}
Expand All @@ -63,10 +60,12 @@ jobs:
# 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 .
run: |
cd ./release
tar -czf ${{ matrix.platform }}.tar.gz *
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: release
path: ${{ matrix.platform }}.tar.gz
path: ./release/${{ matrix.platform }}.tar.gz
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"types": "index.d.ts",
"main": "index.js",
"scripts": {
"test": "node --test test/test.spec.js"
"test": "node --test test/test.spec.js",
"build": "node-gyp configure --directory=src && node-gyp build --directory=src"
},
"publishConfig": {
"@myunisoft:registry": "https://registry.npmjs.org/"
Expand Down
10 changes: 10 additions & 0 deletions platform/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ARG PLATFORM
ARG LIBHEIF_V
FROM myunisoft91/heif-converter.$PLATFORM:$LIBHEIF_V
LABEL maintainer="Nicolas Marteau <[email protected]>"

WORKDIR heif-converter
COPY . .
RUN npm install && \
npm run build && \
npm run test

0 comments on commit 1716c25

Please sign in to comment.