Skip to content

Commit

Permalink
ENH: wasm pixi configuration
Browse files Browse the repository at this point in the history
For reproducible builds.
  • Loading branch information
thewtex committed Aug 12, 2024
1 parent 39c47c4 commit 4a0389f
Show file tree
Hide file tree
Showing 43 changed files with 4,719 additions and 938 deletions.
27 changes: 4 additions & 23 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,16 @@ jobs:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: '22'

- name: Install
uses: pnpm/action-setup@v2
with:
run_install: true

- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
python-version: '3.11'

- name: Download test data
run: |
pnpm run test:data:download
- uses: prefix-dev/[email protected]

- name: Build
run: |
pnpm run build
pixi run build
- name: Test TypeScript
working-directory: ./wasm/typescript
run: |
pnpm test
pnpm run test-typescript
- name: Test Python WASI
working-directory: ./wasm/python/itkwasm-elastix-wasi
run: |
pip install pytest itkwasm-compare-images itk-io
pip install -e .
pytest -s
pixi run test-python-wasi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ emscripten-build
wasm/typescript/demo/
wasm/test
micromamba/
.pixi/
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ if(NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS 17)
set(CMAKE_CXX_STANDARD 17)
endif()


if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
Expand Down
41 changes: 41 additions & 0 deletions itk_wasm_env.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

function die() {
echo "$1"
exit 1
}

export ITK_WASM_DESCRIPTION=${ITK_WASM_DESCRIPTION:-$(cat package.json | jq -e -r '."itk-wasm"."description"')}
if [[ "${ITK_WASM_DESCRIPTION}" = "null" ]]; then
die "itk-wasm.description not set in package.json"
fi

export ITK_WASM_REPOSITORY=${ITK_WASM_REPOSITORY:-$(cat package.json | jq -e -r '."itk-wasm"."repository"')}
if [[ "${ITK_WASM_REPOSITORY}" = "null" ]]; then
die "itk-wasm.repository not set in package.json"
fi

export ITK_WASM_EMSCRIPTEN_DOCKER_IMAGE=${ITK_WASM_EMSCRIPTEN_DOCKER_IMAGE:-$(cat package.json | jq -e -r '."itk-wasm"."emscripten-docker-image" // "itkwasm/emscripten:latest"')}
export ITK_WASM_WASI_DOCKER_IMAGE=${ITK_WASM_WASI_DOCKER_IMAGE:-$(cat package.json | jq -e -r '."itk-wasm"."wasi-docker-image" // "itkwasm/wasi:latest"')}

export ITK_WASM_TEST_DATA_HASH=${ITK_WASM_TEST_DATA_HASH:-$(cat package.json | jq -e -r '."itk-wasm"."test-data-hash"')}
export ITK_WASM_TEST_DATA_URLS=${ITK_WASM_TEST_DATA_URLS:-$(cat package.json | jq -e -r '."itk-wasm"."test-data-urls" | join(" ")')}

export ITK_WASM_TYPESCRIPT_PACKAGE_NAME=${ITK_WASM_TYPESCRIPT_PACKAGE_NAME:-$(cat package.json | jq -e -r '."itk-wasm"."typescript-package-name"')}
if [[ "${ITK_WASM_TYPESCRIPT_PACKAGE_NAME}" = "null" ]]; then
die "itk-wasm.typescript-package-name not set in package.json"
fi
export ITK_WASM_TYPESCRIPT_OUTPUT_DIR=${ITK_WASM_TYPESCRIPT_OUTPUT_DIR:-$(cat package.json | jq -e -r '."itk-wasm"."typescript-output-dir" // "typescript"')}

export ITK_WASM_PYTHON_PACKAGE_NAME=${ITK_WASM_PYTHON_PACKAGE_NAME:-$(cat package.json | jq -e -r '."itk-wasm"."python-package-name"')}
if [[ "${ITK_WASM_PYTHON_PACKAGE_NAME}" = "null" ]]; then
die "itk-wasm.python-package-name not set in package.json"
fi
export ITK_WASM_PYTHON_OUTPUT_DIR=${ITK_WASM_PYTHON_OUTPUT_DIR:-$(cat package.json | jq -e -r '."itk-wasm"."python-output-dir" // "python"')}

export ITK_WASM_PACKAGE_VERSION=${ITK_WASM_PACKAGE_VERSION:-$(cat package.json | jq -e -r '."itk-wasm"."package-version"')}
if [[ "${ITK_WASM_PACKAGE_VERSION}" = "null" ]]; then
die "itk-wasm.package-version not set in package.json"
fi

env
42 changes: 13 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,26 @@
"packageManager": "[email protected]",
"type": "module",
"itk-wasm": {
"emscripten-docker-image": "itkwasm/emscripten:20240807-3f461e68",
"wasi-docker-image": "itkwasm/wasi:20240807-3f461e68",
"description": "A toolbox for rigid and nonrigid registration of images.",
"repository": "https://github.com/InsightSoftwareConsortium/ITKElastix",
"package-version": "0.3.1",
"test-data-hash": "bafybeie7oon27usqjgrtxodzkbd4i6sanfwobv26c3tf7adhxop46o2f3q",
"test-data-urls": [
"https://data.kitware.com/api/v1/file/65196dede7f0366cdfec199e/download",
"https://bafybeid5dvqt2z4uhyal7fws5sai7vc6vgrlicknr5tdqi2phx5q7vl3qm.ipfs.w3s.link/ipfs/bafybeid5dvqt2z4uhyal7fws5sai7vc6vgrlicknr5tdqi2phx5q7vl3qm/data.tar.gz"
],
"emscripten-docker-image": "itkwasm/emscripten:20240810-4e9a4bf0",
"wasi-docker-image": "itkwasm/wasi:20240810-4e9a4bf0",
"typescript-package-name": "@itk-wasm/elastix",
"typescript-output-dir": "wasm/typescript",
"python-package-name": "itkwasm-elastix",
"python-output-dir": "wasm/python",
"package-description": "A toolbox for rigid and nonrigid registration of images.",
"repository": "https://github.com/InsightSoftwareConsortium/ITKElastix"
"python-output-dir": "wasm/python"
},
"scripts": {
"build": "pnpm build:gen:typescript && pnpm build:gen:python",
"build:emscripten": "itk-wasm pnpm-script build:emscripten",
"build:emscripten:debug": "itk-wasm pnpm-script build:emscripten:debug",
"build:wasi": "itk-wasm pnpm-script build:wasi",
"build:wasi:debug": "itk-wasm pnpm-script build:wasi:debug",
"build:python:wasi": "itk-wasm pnpm-script build:python:wasi",
"bindgen:typescript": "itk-wasm pnpm-script bindgen:typescript",
"bindgen:python": "itk-wasm pnpm-script bindgen:python",
"build:gen:typescript": "itk-wasm pnpm-script build:gen:typescript",
"build:gen:python": "itk-wasm pnpm-script build:gen:python",
"build:micromamba": "itk-wasm pnpm-script build:micromamba",
"build:python:versionSync": "itk-wasm pnpm-script build:python:versionSync",
"publish:python": "itk-wasm pnpm-script publish:python",
"test": "pnpm test:data:download && pnpm build:gen:python && pnpm test:python",
"test:data:download": "dam download wasm/test/data wasm/test/data.tar.gz bafybeie7oon27usqjgrtxodzkbd4i6sanfwobv26c3tf7adhxop46o2f3q https://data.kitware.com/api/v1/file/65196dede7f0366cdfec199e/download https://bafybeid5dvqt2z4uhyal7fws5sai7vc6vgrlicknr5tdqi2phx5q7vl3qm.ipfs.w3s.link/ipfs/bafybeid5dvqt2z4uhyal7fws5sai7vc6vgrlicknr5tdqi2phx5q7vl3qm/data.tar.gz",
"test:data:pack": "dam pack test/data test/data.tar.gz",
"test:python:wasi": "itk-wasm pnpm-script test:python:wasi",
"test:python:emscripten": "itk-wasm pnpm-script test:python:emscripten",
"test:python:dispatch": "itk-wasm pnpm-script test:python:emscripten",
"test:python": "itk-wasm pnpm-script test:python",
"test:wasi": "itk-wasm pnpm-script test:wasi -- -V"
},
"license": "Apache-2.0",
"devDependencies": {
"@itk-wasm/dam": "^1.0.1",
"@thewtex/setup-micromamba": "^1.9.7",
"itk-wasm": "^1.0.0-b.177"
"@itk-wasm/dam": "^1.1.1",
"itk-wasm": "^1.0.0-b.178"
}
}
Loading

0 comments on commit 4a0389f

Please sign in to comment.