Skip to content

Commit b44fc53

Browse files
authored
Merge pull request #8 from rflamand/feature/rflamand/add_github_actions
Update github actions
2 parents 1f2c469 + 1d03a81 commit b44fc53

4 files changed

Lines changed: 148 additions & 94 deletions

File tree

.github/workflows/publish.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Publish
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
publish:
7+
name: Publish npm package on release
8+
runs-on: ubuntu-latest
9+
# Guard rails: only publish from canonical repo, never from forks
10+
if: >-
11+
github.event.repository.fork == false &&
12+
github.repository_owner == 'ImagingDataCommons'
13+
permissions:
14+
contents: read
15+
id-token: write
16+
concurrency:
17+
group: npm-publish-${{ github.ref }}
18+
cancel-in-progress: false
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 1
24+
- name: Install emscripten
25+
uses: mymindstorm/setup-emsdk@v14
26+
with:
27+
version: 4.0.19
28+
actions-cache-folder: ".emsdk-cache"
29+
- name: Setup Node
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: "22.16.0"
33+
registry-url: "https://registry.npmjs.org"
34+
- name: Install yarn package manager
35+
run: npm install --global yarn
36+
- name: Install dependencies
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get install -y liblcms2-dev autoconf cmake
40+
- name: Build and install library
41+
run: |
42+
mkdir build
43+
cd build
44+
cmake ..
45+
make
46+
sudo make install
47+
- name: Build WebAssembly bindings
48+
run: |
49+
yarn run clean
50+
yarn run build
51+
- name: Verify package version matches tag
52+
run: |
53+
set -euo pipefail
54+
PKG_VERSION=$(node -p "require('./package.json').version")
55+
TAG="${{ github.event.release.tag_name }}"
56+
if [ -z "$TAG" ]; then TAG="${GITHUB_REF#refs/tags/}"; fi
57+
if [ -z "$TAG" ]; then
58+
echo "Error: could not determine release tag from github.event.release.tag_name or GITHUB_REF"
59+
exit 1
60+
fi
61+
TAG="${TAG#v}"
62+
if [ "$PKG_VERSION" != "$TAG" ]; then
63+
echo "Version mismatch: package.json=$PKG_VERSION tag=$TAG"
64+
exit 1
65+
fi
66+
echo "Version OK: $PKG_VERSION"
67+
- name: Publish to npm
68+
run: |
69+
npm publish . --provenance --access public
Lines changed: 77 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
name: build and test
2-
32
on:
43
push:
5-
branches: [ master ]
4+
branches: [master]
65
pull_request:
7-
branches: [ master ]
8-
6+
branches: [master]
97
jobs:
108
linux:
119
name: Build and run tests on Linux
@@ -15,96 +13,83 @@ jobs:
1513
matrix:
1614
os: [ubuntu-latest]
1715
steps:
18-
- uses: actions/checkout@v2
19-
- name: Install build and test dependencies
20-
run: |
21-
export DEBIAN_FRONTEND=noninteractive
22-
export DEBCONF_NONINTERACTIVE_SEEN=true
23-
sudo apt-get update
24-
sudo apt-get install -y --no-install-suggests --no-install-recommends \
25-
autogen \
26-
dh-autoreconf \
27-
build-essential \
28-
clang \
29-
cmake \
30-
git \
31-
liblcms2-dev \
32-
llvm \
33-
libtool \
34-
nodejs \
35-
npm \
36-
pkg-config \
37-
python3 \
38-
shtool \
39-
valgrind
40-
sudo apt-get clean
41-
42-
- name: Install yarn package manager
43-
run: npm install --global yarn
44-
45-
- name: Build and install library
46-
run: |
47-
mkdir build
48-
cd build
49-
cmake ..
50-
make
51-
sudo make install
52-
53-
- name: Build and install Emscripten SDK
54-
run: |
55-
git clone https://github.com/emscripten-core/emsdk.git
56-
cd emsdk
57-
git pull
58-
./emsdk install latest
59-
./emsdk activate latest
60-
source ./emsdk_env.sh
61-
62-
- name: Build WebAssembly bindings
63-
run: |
64-
yarn run clean
65-
sh ./emsdk/emsdk activate latest
66-
source ./emsdk/emsdk_env.sh
67-
yarn run build
68-
69-
- name: Perform npm package publish dry run
70-
run: |
71-
sh ./emsdk/emsdk activate latest
72-
source ./emsdk/emsdk_env.sh
73-
npm publish . --dry-run
74-
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 1
20+
- name: Install emscripten
21+
uses: mymindstorm/setup-emsdk@v14
22+
with:
23+
version: 4.0.19
24+
actions-cache-folder: ".emsdk-cache"
25+
- name: Setup Node
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: "22.16.0"
29+
- name: Install yarn package manager
30+
run: npm install --global yarn
31+
- name: Install dependencies
32+
run: |
33+
sudo apt-get update
34+
sudo apt-get install -y liblcms2-dev autoconf cmake
35+
- name: Build and install library
36+
run: |
37+
mkdir build
38+
cd build
39+
cmake ..
40+
make
41+
sudo make install
42+
- name: Build WebAssembly bindings
43+
run: |
44+
yarn run clean
45+
yarn run build
46+
- name: Perform npm package publish dry run
47+
run: |
48+
npm publish . --dry-run
7549
macos:
7650
name: Build and run tests on macOS
77-
runs-on: macos-latest
51+
runs-on: ${{ matrix.os }}
7852
strategy:
7953
fail-fast: false
54+
matrix:
55+
os: [macos-latest]
8056
steps:
81-
- uses: actions/checkout@v2
82-
- name: Install build and test dependencies
83-
run: |
84-
brew update
85-
brew upgrade
86-
brew install \
87-
autoconf \
88-
automake \
89-
emscripten \
90-
libtool \
91-
little-cms2 \
92-
llvm \
93-
node \
94-
yarn
95-
96-
- name: Build and install library
97-
run: |
98-
mkdir build
99-
cd build
100-
cmake -DCMAKE_PREFIX_PATH=$PWD/install -DCMAKE_INSTALL_PREFIX=$PWD/install ..
101-
make
102-
make install
103-
104-
- name: Build WebAssembly bindings
105-
run: |
106-
yarn run clean
107-
yarn run build
108-
109-
- name: Perform npm package publish dry run
110-
run: npm publish . --dry-run
57+
- name: Checkout
58+
uses: actions/checkout@v4
59+
with:
60+
fetch-depth: 1
61+
- name: Install emscripten
62+
uses: mymindstorm/setup-emsdk@v14
63+
with:
64+
version: 4.0.19
65+
actions-cache-folder: ".emsdk-cache"
66+
- name: Setup Node
67+
uses: actions/setup-node@v4
68+
with:
69+
node-version: "22.16.0"
70+
- name: Install yarn package manager
71+
run: npm install --global yarn
72+
- name: Install dependencies
73+
run: |
74+
brew update
75+
brew upgrade
76+
brew install \
77+
autoconf \
78+
automake \
79+
libtool \
80+
little-cms2 \
81+
llvm \
82+
cmake
83+
- name: Build and install library
84+
run: |
85+
mkdir build
86+
cd build
87+
cmake -DCMAKE_PREFIX_PATH=$PWD/install -DCMAKE_INSTALL_PREFIX=$PWD/install ..
88+
make
89+
make install
90+
- name: Build WebAssembly bindings
91+
run: |
92+
yarn run clean
93+
yarn run build
94+
- name: Perform npm package publish dry run
95+
run: npm publish . --dry-run

BUILDING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The examples expects the lcms2, dicom, and dicomicc libraries to be already inst
4444
The build dependencies used for building the WASM binding are as follows:
4545

4646
* CMake 3.16
47-
* Emscripten SDK 1.39.4
47+
* Emscripten SDK 4.0.19
4848

4949
Earlier versions may work but have not been tested.
5050

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@imagingdatacommons/dicomicc",
3-
"version": "0.2.1",
3+
"version": "0.2.2",
44
"description": "WASM bindings and JavaScript API for the dicomicc C library",
55
"main": "dist/dicomiccwasm.js",
66
"publishConfig": {

0 commit comments

Comments
 (0)