Merge pull request #881 from thewtex/worker-exports #935
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Wasm | |
on: [push,pull_request] | |
env: | |
pyodide-version: 0.23.1 | |
jobs: | |
test-itkwasm: | |
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: [7, 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 | |
working-directory: ./packages/core/python/itkwasm | |
shell: bash | |
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 | |
- 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 | |
- uses: thewtex/pyodide-actions/install-browser@chrome-install | |
if: ${{ matrix.python-minor-version > 9 }} | |
with: | |
runner: selenium | |
browser: chrome | |
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: [7, 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 | |
build-sphinx-docs: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
working-directory: ./packages/core/python/itkwasm | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -e "." | |
python -m pip install hatch itk pytest | |
- name: Build Sphinx documentation | |
working-directory: ./packages/core/python/itkwasm/docs | |
run: | | |
python -m pip install -r requirements.txt | |
make html |