From 9ff246b7497eec9d8f3ba01e8a71a9f4f4571139 Mon Sep 17 00:00:00 2001 From: "Flamand, Raf" Date: Thu, 11 Dec 2025 08:33:31 +0000 Subject: [PATCH 1/5] Test simplified run_unit_test workflow --- .github/workflows/run_unit_tests.yml | 64 ++++++++++------------------ 1 file changed, 22 insertions(+), 42 deletions(-) diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 28ae782..d1cc370 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -15,33 +15,22 @@ jobs: matrix: os: [ubuntu-latest] steps: - - uses: actions/checkout@v2 - - name: Install build and test dependencies - run: | - export DEBIAN_FRONTEND=noninteractive - export DEBCONF_NONINTERACTIVE_SEEN=true - sudo apt-get update - sudo apt-get install -y --no-install-suggests --no-install-recommends \ - autogen \ - dh-autoreconf \ - build-essential \ - clang \ - cmake \ - git \ - liblcms2-dev \ - llvm \ - libtool \ - nodejs \ - npm \ - pkg-config \ - python3 \ - shtool \ - valgrind - sudo apt-get clean + - name: Checkout + uses: actions/checkout@v2 - name: Install yarn package manager run: npm install --global yarn + - name: Install emscript + uses: mymindstorm/setup-emsdk@v14 + with: + version: 4.0.19 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y liblcms2-dev autoconf + - name: Build and install library run: | mkdir build @@ -50,26 +39,13 @@ jobs: make sudo make install - - name: Build and install Emscripten SDK - run: | - git clone https://github.com/emscripten-core/emsdk.git - cd emsdk - git pull - ./emsdk install latest - ./emsdk activate latest - source ./emsdk_env.sh - - name: Build WebAssembly bindings run: | yarn run clean - sh ./emsdk/emsdk activate latest - source ./emsdk/emsdk_env.sh yarn run build - name: Perform npm package publish dry run run: | - sh ./emsdk/emsdk activate latest - source ./emsdk/emsdk_env.sh npm publish . --dry-run macos: @@ -78,20 +54,24 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v2 - - name: Install build and test dependencies + - name: Checkout + uses: actions/checkout@v2 + + - name: Install emscript + uses: mymindstorm/setup-emsdk@v14 + with: + version: 4.0.19 + + - name: Install dependencies run: | brew update brew upgrade brew install \ autoconf \ automake \ - emscripten \ libtool \ little-cms2 \ - llvm \ - node \ - yarn + llvm - name: Build and install library run: | From 50f7977a4cfd0376240fa9531092b8c4b48e1856 Mon Sep 17 00:00:00 2001 From: Raf Flamand Date: Thu, 11 Dec 2025 09:33:56 +0000 Subject: [PATCH 2/5] Small update to run_unit_tests and created publish actions --- .github/workflows/publish.yml | 45 ++++++++++++++++++++++++++++ .github/workflows/run_unit_tests.yml | 9 ++++-- 2 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d64193a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,45 @@ +name: Publish + +on: + release: + types: [published] + +jobs: + publish: + name: Publish npm package on release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install emscript + uses: mymindstorm/setup-emsdk@v14 + with: + version: 4.0.19 + + - name: Install yarn package manager + run: npm install --global yarn + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y liblcms2-dev autoconf + + - name: Build and install library + run: | + mkdir build + cd build + cmake .. + make + sudo make install + + - name: Build WebAssembly bindings + run: | + yarn run clean + yarn run build + + - name: Perform npm package publish dry run + run: | + npm publish . + env: + NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index d1cc370..fcb5e37 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -18,13 +18,13 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Install yarn package manager - run: npm install --global yarn - - name: Install emscript uses: mymindstorm/setup-emsdk@v14 with: version: 4.0.19 + + - name: Install yarn package manager + run: npm install --global yarn - name: Install dependencies run: | @@ -62,6 +62,9 @@ jobs: with: version: 4.0.19 + - name: Install yarn package manager + run: npm install --global yarn + - name: Install dependencies run: | brew update From 1d82175110419dcd40291f34fb1c09c40f3b323f Mon Sep 17 00:00:00 2001 From: Raf Flamand Date: Thu, 11 Dec 2025 10:01:17 +0000 Subject: [PATCH 3/5] Added caching + some guard rails --- .github/workflows/publish.yml | 24 ++++++++++++++++++++++-- .github/workflows/run_unit_tests.yml | 27 +++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d64193a..3b0623b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,15 +8,35 @@ jobs: publish: name: Publish npm package on release runs-on: ubuntu-latest + # Guard rails: only publish from canonical repo, never from forks + if: >- + github.event.repository.fork == false && + github.repository_owner == 'ImagingDataCommons' + permissions: + contents: read + concurrency: + group: npm-publish-${{ github.ref }} + cancel-in-progress: false steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 + with: + fetch-depth: 1 - name: Install emscript uses: mymindstorm/setup-emsdk@v14 with: version: 4.0.19 + - name: Setup Node with yarn cache + uses: actions/setup-node@v4 + with: + node-version: '22.16.0' + cache: 'yarn' + cache-dependency-path: | + package.json + yarn.lock + - name: Install yarn package manager run: npm install --global yarn @@ -38,7 +58,7 @@ jobs: yarn run clean yarn run build - - name: Perform npm package publish dry run + - name: Publish to npm run: | npm publish . env: diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index fcb5e37..4f4fc55 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -16,13 +16,25 @@ jobs: os: [ubuntu-latest] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 + with: + fetch-depth: 1 - name: Install emscript uses: mymindstorm/setup-emsdk@v14 with: version: 4.0.19 + # The action internally caches emsdk; enabling default cache behavior + - name: Setup Node with yarn cache + uses: actions/setup-node@v4 + with: + node-version: '22.16.0' + cache: 'yarn' + cache-dependency-path: | + package.json + yarn.lock + - name: Install yarn package manager run: npm install --global yarn @@ -55,13 +67,24 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 + with: + fetch-depth: 1 - name: Install emscript uses: mymindstorm/setup-emsdk@v14 with: version: 4.0.19 + - name: Setup Node with yarn cache + uses: actions/setup-node@v4 + with: + node-version: '22.16.0' + cache: 'yarn' + cache-dependency-path: | + package.json + yarn.lock + - name: Install yarn package manager run: npm install --global yarn From 2a30285ab3f19930e5f2a0bd494a083e6e6473c5 Mon Sep 17 00:00:00 2001 From: Raf Flamand Date: Thu, 11 Dec 2025 10:06:39 +0000 Subject: [PATCH 4/5] Supply emcmake with caching folder. Should speed up runner --- .github/workflows/publish.yml | 1 + .github/workflows/run_unit_tests.yml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3b0623b..6c750df 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,6 +27,7 @@ jobs: uses: mymindstorm/setup-emsdk@v14 with: version: 4.0.19 + actions-cache-folder: '.emsdk-cache' - name: Setup Node with yarn cache uses: actions/setup-node@v4 diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 4f4fc55..10ca3c8 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -24,7 +24,7 @@ jobs: uses: mymindstorm/setup-emsdk@v14 with: version: 4.0.19 - # The action internally caches emsdk; enabling default cache behavior + actions-cache-folder: '.emsdk-cache' - name: Setup Node with yarn cache uses: actions/setup-node@v4 @@ -75,6 +75,7 @@ jobs: uses: mymindstorm/setup-emsdk@v14 with: version: 4.0.19 + actions-cache-folder: '.emsdk-cache' - name: Setup Node with yarn cache uses: actions/setup-node@v4 From 9734a860750dd5be32d00b87909cae22ae92c681 Mon Sep 17 00:00:00 2001 From: Raf Flamand Date: Thu, 11 Dec 2025 10:20:30 +0000 Subject: [PATCH 5/5] Update version in build instructions --- BUILDING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILDING.md b/BUILDING.md index 4abd245..bf146a6 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -44,7 +44,7 @@ The examples expects the lcms2, dicom, and dicomicc libraries to be already inst The build dependencies used for building the WASM binding are as follows: * CMake 3.16 -* Emscripten SDK 1.39.4 +* Emscripten SDK 4.19.0 Earlier versions may work but have not been tested.