Skip to content

Commit

Permalink
Merge pull request #1275 from thewtex/create-itk-wasm-pixi
Browse files Browse the repository at this point in the history
create itk wasm pixi
  • Loading branch information
thewtex authored Nov 21, 2024
2 parents 0b21e7c + e020a4b commit a276413
Show file tree
Hide file tree
Showing 17 changed files with 581 additions and 96 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cxx-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ env:
jobs:
cxx-build-workflow:
# itk-wasm branch
uses: thewtex/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-cxx.yml@6868c9879405def5d7532e0437b57e78cbe0b6ea
uses: thewtex/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-cxx.yml@l@6868c9879405def5d7532e0437b57e78cbe0b6ea
with:
itk-module-deps: '[email protected]'
ctest-options: '-E itkPipelineTest'
# release-5.4 2025-07-02
itk-git-tag: '276a52a5c0b1a5df67c9a2b0fdcd0bc75504e011'
# release-5.4 2024-11-21
itk-git-tag: '49413c3a9e8ecf0f912534e7c13f4c7bc3799d60'

#python-build-workflow:
## itk-wasm branch
Expand Down
17 changes: 11 additions & 6 deletions packages/core/typescript/create-itk-wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ CLI to create a new [ITK-Wasm](https://wasm.itk.org) project or add a pipeline t
npm install -g pnpm
```

and [pixi](https://pixi.sh/latest/), e.g.

```sh
curl -fsSL https://pixi.sh/install.sh | bash
```

Then,

```sh
Expand All @@ -19,16 +25,15 @@ cd my-project
pnpm create itk-wasm
# Answers the questions

pnpm install
pnpm build
pnpm test
pixi run build
pixi run test

# Add your C++ logic code to the *.cxx files
pnpm build
pnpm test
pixi run build
pixi run test

# For more granular targets, see the output of
pnpm run
pixi task list
```

For more information, see the [ITK-Wasm documentation](https://wasm.itk.org).
Expand Down
2 changes: 1 addition & 1 deletion packages/core/typescript/create-itk-wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"lint": "prettier --check .",
"lint:fix": "prettier --write .",
"test": "pnpm test:help && pnpm test:defaultPipeline && pnpm test:imagePipeline && pnpm test:meshPipeline && pnpm test:polyDataPipeline",
"test:defaultPipeline": "shx rm -rf test/default && node dist/create-itk-wasm.js -o test/default -n \"default-pipeline\" -a \"Test Monkey\" -d \"Default pipeline description\" --pipeline-name default-pipeline --pipeline-description \"Default pipeline description\" -r \"http://test.repo\" --pipeline-inputs \"default-input:string:A default input\" --pipeline-parameters \"a-double-param:double:A double param\" --pipeline-outputs \"a-json-output:JsonCompatible:A JSON compatible output\" --no-input --build-and-test",
"test:defaultPipeline": "shx rm -rf test/default && node dist/create-itk-wasm.js -o test/default -n \"default-pipeline\" -a \"Test Monkey\" -d \"Default pipeline description\" --pipeline-name default-pipeline --pipeline-description \"Default pipeline description\" -r \"http://test.repo\" --pipeline-inputs \"default-input:string:A default input\" --pipeline-parameters \"a-double-param:double:A double param\" --pipeline-outputs \"a-json-output:JsonCompatible:A JSON compatible output\" --no-input && cd test/default && pixi run build && pixi run test",
"test:imagePipeline": "shx rm -rf test/image && node dist/create-itk-wasm.js -o test/image -n \"image-pipeline\" -a \"Test Monkey\" -d \"Image pipeline description\" --pipeline-name image-pipeline --pipeline-description \"Image pipeline description\" -r \"http://test.repo\" --pipeline-inputs \"input-image:Image:An input image\" --pipeline-parameters \"a-float-param:float:A float param\" --pipeline-outputs \"output-image:Image:An output image\" --pipeline-dispatch Image --no-input --build-and-test",
"test:meshPipeline": "shx rm -rf test/mesh && node dist/create-itk-wasm.js -o test/mesh -n \"mesh-pipeline\" -a \"Test Monkey\" -d \"Mesh pipeline description\" --pipeline-name mesh-pipeline --pipeline-description \"Mesh pipeline description\" -r \"http://test.repo\" --pipeline-inputs \"input-mesh:Mesh:An input mesh\" --pipeline-parameters \"a-float-param:float:A float param\" --pipeline-outputs \"output-mesh:Mesh:An output mesh\" --pipeline-dispatch Mesh --no-input --build-and-test",
"test:polyDataPipeline": "shx rm -rf test/poly-data && node dist/create-itk-wasm.js -o test/poly-data -n \"poly-data-pipeline\" -a \"Test Monkey\" -d \"PolyData pipeline description\" --pipeline-name poly-data-pipeline --pipeline-description \"PolyData pipeline description\" -r \"http://test.repo\" --pipeline-inputs \"input-poly-data:PolyData:An input poly-data\" --pipeline-parameters \"a-float-param:float:A float param\" --pipeline-outputs \"output-poly-data:PolyData:An output poly-data\" --pipeline-dispatch PolyData --no-input --build-and-test",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import fs from 'fs'
import path from 'path'

import ProjectSpec from '../project-spec.js'

function generateItkWasmEnvBash(project: ProjectSpec) {
const itkWasmEnvBashPath = path.join(project.directory, 'itk_wasm_env.bash')
if (fs.existsSync(itkWasmEnvBashPath)) {
return
}

const content = `#!/usr/bin/env bash
function die() {
echo "$1"
exit 1
}
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_ITK_REPOSITORY=\${ITK_WASM_ITK_REPOSITORY:-"https://github.com/thewtex/ITK"}
export ITK_WASM_ITK_BRANCH=\${ITK_WASM_ITK_BRANCH:-"itkwasm-2024-05-20-5db055d7ad3b-4"}
export ITK_WASM_NATIVE_WORKSPACE=\${ITK_WASM_NATIVE_WORKSPACE:-$(pwd)/native}
export ITK_WASM_ITK_SOURCE_DIR=\${ITK_WASM_ITK_SOURCE_DIR:-\${ITK_WASM_NATIVE_WORKSPACE}/ITK}
export ITK_WASM_ITK_BUILD_DIR=\${ITK_WASM_ITK_BUILD_DIR:-\${ITK_WASM_NATIVE_WORKSPACE}/ITK-build}
mkdir -p \${ITK_WASM_ITK_BUILD_DIR} || die "Could not create ITK build directory"
export ITK_WASM_WEBASSEMBLY_INTERFACE_REPOSITORY=\${ITK_WASM_WEBASSEMBLY_INTERFACE_REPOSITORY:-"https://github.com/InsightSoftwareConsortium/ITK-Wasm"}
export ITK_WASM_WEBASSEMBLY_INTERFACE_BRANCH=\${ITK_WASM_WEBASSEMBLY_INTERFACE_BRANCH:-"main"}
export ITK_WASM_WEBASSEMBLY_INTERFACE_SOURCE_DIR=\${ITK_WASM_WEBASSEMBLY_INTERFACE_SOURCE_DIR:-\${ITK_WASM_NATIVE_WORKSPACE}/ITK-Wasm}
export ITK_WASM_WEBASSEMBLY_INTERFACE_BUILD_DIR=\${ITK_WASM_WEBASSEMBLY_INTERFACE_BUILD_DIR:-\${ITK_WASM_NATIVE_WORKSPACE}/ITK-Wasm-build}
mkdir -p \${ITK_WASM_WEBASSEMBLY_INTERFACE_BUILD_DIR} || die "Could not create ITK-Wasm build directory"
`

fs.writeFileSync(itkWasmEnvBashPath, content)
}

export default generateItkWasmEnvBash
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ function generatePackageJson(project: ProjectSpec) {
}

const itkWasm = {
'test-data-hash':
'bafkreidnoz54py66bn56uq6itwkfgngflaqilflfvwkxlps4ycmygstzja',
'test-data-urls': [
'https://github.com/InsightSoftwareConsortium/ITK-Wasm/releases/download/itk-wasm-v1.0.0-b.179/sample-data.tar.gz',
'https://bafybeidxatrsrrphfmntdyze6ec3jbiak527wj3kalwjptv4bimpcnzxdq.ipfs.w3s.link/ipfs/bafybeidxatrsrrphfmntdyze6ec3jbiak527wj3kalwjptv4bimpcnzxdq/sample-data.tar.gz'
],
'package-description': project.packageDescription,
'typescript-package-name': project.typescriptPackageName,
'python-package-name': project.pythonPackageName
'python-package-name': project.pythonPackageName,
repository: project.repositoryUrl
}
if (project.repositoryUrl) {
// @ts-ignore
Expand All @@ -25,7 +32,7 @@ function generatePackageJson(project: ProjectSpec) {
name: `${project.name}-build`,
version: '0.1.0',
private: true,
description: `Scripts to generate ${project.name} itk-wasm artifacts.`,
description: `Scripts to generate ${project.name} ITK-Wasm artifacts.`,
type: 'module',
'itk-wasm': itkWasm,
license: project.license,
Expand All @@ -35,29 +42,18 @@ function generatePackageJson(project: ProjectSpec) {
'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',
'build:python:wasi':
"echo 'No build:python:wasi script required with pixi'",
'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 test/data test/data.tar.gz bafkreigpkk3pqcoqzjzcauogw6dml52yig3ksmcrobau5pkoictymizzri https://github.com/InsightSoftwareConsortium/ITK-Wasm/releases/download/itk-wasm-v1.0.0-b.163/create-itk-wasm-test-data.tar.gz https://bafybeiczuxeuma5cjuli5mtapqnjqypeaum5ikd45zcmfhtt2emp365tca.ipfs.w3s.link/ipfs/bafybeiczuxeuma5cjuli5mtapqnjqypeaum5ikd45zcmfhtt2emp365tca/create-itk-wasm-test-data.tar.gz https://ipfs.filebase.io/ipfs/QmcxyvUKnaoTTwUqEPXwp1sdcbrFh3XnnwckLKVRpctJx9',
'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: 'pixi run download-test-data && pnpm build:gen:python',
'test:wasi': 'itk-wasm pnpm-script test:wasi'
},
devDependencies: {
'@itk-wasm/dam': '^1.1.1',
'@thewtex/setup-micromamba': '^1.9.7',
'itk-wasm': '1.0.0-b.178'
'itk-wasm': '1.0.0-b.182'
}
}
if (project.author) {
Expand Down
Loading

0 comments on commit a276413

Please sign in to comment.