diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6c750df --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,66 @@ +name: Publish + +on: + release: + types: [published] + +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@v4 + with: + fetch-depth: 1 + + - name: Install emscript + 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 + 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 + + - 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: Publish to npm + 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 28ae782..10ca3c8 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -15,33 +15,34 @@ 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@v4 + with: + fetch-depth: 1 + + - name: Install emscript + 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 + 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 + - 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 +51,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 +66,39 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v2 - - name: Install build and test dependencies + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Install emscript + 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 + 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 + + - 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: | 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.