Skip to content

Commit

Permalink
WIP: ci: update for pnpm workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Dec 6, 2023
1 parent b64ca5c commit b892799
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 151 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Cypress Tests
name: Browser Tests

on: [push,pull_request]

Expand All @@ -23,17 +23,18 @@ jobs:

- name: Install
run: |
npm ci
npm i -g pnpm
pnpm install
- name: Build
run: |
npm run build
pnpm run --aggregate-output build
- name: Test with Chrome
uses: cypress-io/github-action@v6
with:
browser: chrome
command: npm run test:chrome
command: pnpm run --sequential test:browser:chrome

- uses: actions/upload-artifact@v3
if: failure()
Expand Down
23 changes: 6 additions & 17 deletions .github/workflows/javascript-typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,20 @@ jobs:

- name: Install packages
run: |
npm ci
npm i -g pnpm
pnpm i
- name: Build
run: |
npm run build
pnpm run --aggregate-output build
- name: Lint tests
run: |
npm run test:lint
pnpm run test:lint
- name: Node tests
run: |
npm run test:node
pnpm run --aggregate-output test:node
- name: Browser tests
run: |
Expand All @@ -43,23 +44,11 @@ jobs:
# To debug locally, run `./test/run.sh -d`
./test/run.sh
- name: Test building a pipeline
run: |
cd test/pipelines/median-filter-pipeline
node ../../../src/itk-wasm-cli.js build -i itkwasm/emscripten:latest .
rm -rf emscripten-build
node ../../../src/itk-wasm-cli.js build -i itkwasm/wasi:latest .
rm -rf emscripten-build
cd -
- name: Publish task
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "itk+community@discourse.itk.org"
npx semantic-release
# todo: use changeset / pnpm publish
8 changes: 6 additions & 2 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm ci

- run: |
npm i -g pnpm
- name: Lint commits
run: npx commitlint --from=${{ github.event.pull_request.base.sha }}
run: pnpx commitlint --from=${{ github.event.pull_request.base.sha }}
131 changes: 11 additions & 120 deletions .github/workflows/python-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,20 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ env.python-version }}
- name: Install dependencies
working-directory: ./packages/core/python/itkwasm
shell: bash
- uses: actions/setup-node@v3
with:
node-version: '18.16'
- name: Install packages
run: |
npm i -g pnpm
pnpm i
- name: Build
run: |
python -m pip install --upgrade pip
cd test/test-accelerator
python -m pip install -e "."
cd -
python -m pip install -e "."
python -m pip install hatch itk pytest
pnpm run --aggregate-output build
- name: Test on native
if: ${{ matrix.python-minor-version < 10 }}
working-directory: ./packages/core/python/itkwasm
run: |
hatch build -t wheel
pytest --junitxml=junit/test-results-${{ env.python-version }}.xml
- name: Download Pyodide
if: ${{ matrix.python-minor-version > 9 }}
shell: bash
working-directory: ./packages/core/python/itkwasm
run: |
curl -L https://github.com/pyodide/pyodide/releases/download/${{ env.pyodide-version }}/pyodide-${{ env.pyodide-version }}.tar.bz2 -o pyodide.tar.bz2
tar xjf pyodide.tar.bz2
rm -rf dist
mv pyodide dist
- name: Install pytest-pyodide
if: ${{ matrix.python-minor-version > 9 }}
shell: bash
run: |
python -m pip install pytest-pyodide
pnpm run --aggregate-output test:python:wasi
- uses: thewtex/pyodide-actions/install-browser@chrome-install
if: ${{ matrix.python-minor-version > 9 }}
with:
Expand All @@ -61,98 +45,5 @@ jobs:
browser-version: latest
- name: Test with chrome
if: ${{ matrix.python-minor-version > 9 }}
working-directory: ./packages/core/python/itkwasm
run: |
hatch build -t wheel
ls dist
pytest --junitxml=junit/test-results-${{ env.python-version }}.xml --dist-dir=./dist --rt=chrome
- name: Upload pytest test results
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: pytest-results-${{ env.python-version }}
path: 'packages/core/python/itkwasm/junit/test-results*.xml'

test-pythonpackages:
runs-on: ${{ matrix.os }}
env:
python-version: ${{ format('{0}.{1}', matrix.python-major-version, matrix.python-minor-version) }}
strategy:
max-parallel: 3
matrix:
os: [ubuntu-22.04, windows-2022, macos-12]
python-major-version: [3]
python-minor-version: [8, 9, 10, 11]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install hatch pytest
- name: Install pytest-pyodide
if: ${{ matrix.python-minor-version > 9 }}
shell: bash
run: |
python -m pip install pytest-pyodide
- uses: thewtex/pyodide-actions/install-browser@chrome-install
if: ${{ matrix.python-minor-version > 9 }}
with:
runner: selenium
browser: chrome
browser-version: latest
- name: Test compress-stringify wasi native
if: ${{ matrix.python-minor-version < 10 }}
working-directory: ./packages/compress-stringify/python/itkwasm-compress-stringify-wasi
run: |
python -m pip install -e .
pytest
- name: Test compress-stringify-emscripten chrome
if: ${{ matrix.python-minor-version > 9 }}
working-directory: ./packages/compress-stringify/python/itkwasm-compress-stringify-emscripten
shell: bash
run: |
hatch run download-pyodide
hatch build -t wheel
ls dist
python -m pip install -e .
pytest --dist-dir=./dist --rt=chrome
- name: Test compress-stringify chrome
if: ${{ matrix.python-minor-version > 9 }}
working-directory: ./packages/compress-stringify/python/itkwasm-compress-stringify
shell: bash
run: |
hatch run download-pyodide
hatch build -t wheel
ls dist
python -m pip install -e .
pytest --dist-dir=./dist --rt=chrome
- uses: actions/setup-node@v3
with:
node-version: '18.16'
- name: Download test data
shell: bash
run: |
npm ci
npm run build:testData
- name: Test dicom wasi native
if: ${{ matrix.python-minor-version < 10 }}
working-directory: ./packages/dicom/python/itkwasm-dicom-wasi
run: |
python -m pip install pillow
python -m pip install -e .
pytest
- name: Test dicom-emscripten chrome
if: ${{ matrix.python-minor-version > 9 }}
working-directory: ./packages/dicom/python/itkwasm-dicom-emscripten
shell: bash
run: |
hatch run download-pyodide
hatch build -t wheel
ls dist
python -m pip install -e .
pytest --dist-dir=./dist --rt=chrome
pnpm run --aggregate-output test:python:emscripten
11 changes: 4 additions & 7 deletions .github/workflows/wasi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@ jobs:

- name: Install packages
run: |
npm ci
npm i -g pnpm
pnpm i
- name: Build
run: |
npm run build:wasi
pnpm run --aggregate-output build:wasi
- name: Test
run: |
npm run test:wasi
- name: Build WASI packages
run: |
npm run build:wasi:packages
pnpm run --aggregate-output test:wasi
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
"build:wasi": "pnpm -r build:wasi",
"build:wasi:debug": "pnpm -r build:wasi:debug",
"test:wasi": "pnpm -r test:wasi",
"test:lint": "pnpm -r test:lint",
"test:node": "pnpm -r test:node",
"test:browser:chrome": "pnpm -r test:browser:chrome",
"test:browser:firefox": "pnpm -r test:browser:firefox",
"test:python:wasi": "pnpm -r test:python:wasi",
"test:python:emscripten": "pnpm -r test:python:emscripten",
"test:python": "pnpm -r test:python",
"test": "pnpm -r test",
"clean": "git clean -fdx",
Expand Down
2 changes: 1 addition & 1 deletion test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ docker run \
--workdir /home/user/work \
${mount_local} \
$port_arg \
--env="APP=npm run test:browser --" \
--env="APP=pnpm run --aggregate-output test:browser --" \
$extra_run_args \
$debug_arg \
$image >/dev/null
Expand Down

0 comments on commit b892799

Please sign in to comment.