🔧 Add codespell configuration and fix existing typos #242
Workflow file for this run
This file contains hidden or 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: Build | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| pull_request: | |
| branches: | |
| - 'main' | |
| release: | |
| types: | |
| - published | |
| workflow_dispatch: | |
| jobs: | |
| lint: | |
| name: Lint and type-check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| with: | |
| enable-cache: true | |
| - name: Ruff check | |
| run: uvx ruff check | |
| - name: Ruff format check | |
| run: uvx ruff format --check | |
| - name: Install dev dependencies | |
| run: uv sync --group dev -v | |
| - name: Pyright | |
| run: uvx pyright | |
| wheels-build: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest] | |
| python-versions: [ | |
| {version: '3.11', glob: cp311*}, | |
| {version: '3.12', glob: cp312*}, | |
| {version: '3.13', glob: cp313*}, | |
| {version: '3.14', glob: cp314-*}, | |
| {version: '3.14t', glob: cp314t*} | |
| ] | |
| name: Python ${{ matrix.python-versions.version }} wheel on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Build wheel | |
| uses: pypa/cibuildwheel@v3.4.1 | |
| env: | |
| CIBW_BUILD: ${{ matrix.python-versions.glob }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| - name: Set up Python | |
| run: uv python install ${{ matrix.python-versions.version }} | |
| - name: Test wheel | |
| run: | | |
| uv venv --python ${{ matrix.python-versions.version }} .venv-test | |
| uv pip install --python .venv-test/bin/python ./wheelhouse/*${{ matrix.python-versions.glob }}.whl pytest pybids | |
| uv run --no-project --python .venv-test/bin/python pytest --import-mode=append | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheel-${{ matrix.os }}-cp${{ matrix.python-versions.version }} | |
| path: ./wheelhouse/*.whl | |
| binaries-build-linux: | |
| name: PyInstaller bundle (${{ matrix.target }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: linux-x86_64 | |
| runner: ubuntu-latest | |
| container: quay.io/pypa/manylinux_2_28_x86_64 | |
| - target: linux-aarch64 | |
| runner: ubuntu-24.04-arm | |
| container: quay.io/pypa/manylinux_2_28_aarch64 | |
| runs-on: ${{ matrix.runner }} | |
| container: ${{ matrix.container }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Trust workspace dir for git (container UID mismatch) | |
| run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Build extension + install dev deps | |
| run: uv sync --group dev -v | |
| - name: Install PyInstaller | |
| run: uv pip install --python .venv/bin/python pyinstaller | |
| - name: Build bundle | |
| run: .venv/bin/python packaging/pyinstaller/build_bundle.py --target ${{ matrix.target }} | |
| - name: Smoke test (--version per binary) | |
| run: | | |
| BUNDLE=$(ls -d packaging/pyinstaller/dist/warpkit-*/ | head -1) | |
| for bin in "$BUNDLE"wk-*; do | |
| "$bin" --version | |
| done | |
| - name: Smoke test (wk-unwrap-phase end-to-end) | |
| run: | | |
| BUNDLE=$(ls -d packaging/pyinstaller/dist/warpkit-*/ | head -1) | |
| mkdir -p smoke-out | |
| "$BUNDLE/wk-unwrap-phase" \ | |
| --magnitude tests/data/test_data/*part-mag_bold.nii.gz \ | |
| --phase tests/data/test_data/*part-phase_bold.nii.gz \ | |
| --metadata tests/data/test_data/*part-mag_bold.json \ | |
| --out-prefix smoke-out/unwrap | |
| ls smoke-out/ | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: binaries-${{ matrix.target }} | |
| path: packaging/pyinstaller/dist/warpkit-*-${{ matrix.target }}.zip | |
| if-no-files-found: error | |
| binaries-build-macos: | |
| name: PyInstaller bundle (macos-arm64) | |
| runs-on: macos-latest | |
| env: | |
| MACOSX_DEPLOYMENT_TARGET: "11.0" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Build extension + install dev deps | |
| run: uv sync --group dev -v | |
| - name: Install PyInstaller | |
| run: uv pip install --python .venv/bin/python pyinstaller | |
| - name: Build bundle | |
| run: .venv/bin/python packaging/pyinstaller/build_bundle.py --target macos-arm64 | |
| - name: Smoke test (--version per binary) | |
| run: | | |
| BUNDLE=$(ls -d packaging/pyinstaller/dist/warpkit-*/ | head -1) | |
| for bin in "$BUNDLE"wk-*; do | |
| "$bin" --version | |
| done | |
| - name: Smoke test (wk-unwrap-phase end-to-end) | |
| run: | | |
| BUNDLE=$(ls -d packaging/pyinstaller/dist/warpkit-*/ | head -1) | |
| mkdir -p smoke-out | |
| "$BUNDLE/wk-unwrap-phase" \ | |
| --magnitude tests/data/test_data/*part-mag_bold.nii.gz \ | |
| --phase tests/data/test_data/*part-phase_bold.nii.gz \ | |
| --metadata tests/data/test_data/*part-mag_bold.json \ | |
| --out-prefix smoke-out/unwrap | |
| ls smoke-out/ | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: binaries-macos-arm64 | |
| path: packaging/pyinstaller/dist/warpkit-*-macos-arm64.zip | |
| if-no-files-found: error | |
| binaries-publish: | |
| name: Attach binaries to release | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| needs: [binaries-build-linux, binaries-build-macos] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| path: bins | |
| pattern: binaries-* | |
| merge-multiple: true | |
| - name: Upload zips to release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release upload "${{ github.event.release.tag_name }}" bins/*.zip --clobber --repo "${{ github.repository }}" | |
| sdist-build: | |
| name: Sdist and coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Install in dev mode and test with coverage | |
| run: | | |
| uv sync --group dev -v | |
| uv run coverage run | |
| uv run coverage report -m | |
| uv run coverage xml | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| files: ./coverage.xml | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Build sdist | |
| run: uv build --sdist | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: sdist | |
| path: dist/*.tar.gz | |
| py-publish: | |
| name: Publish to PyPI | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| needs: [wheels-build, sdist-build] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: release | |
| url: https://pypi.org/project/warpkit/ | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| path: dist | |
| pattern: '{wheel-*,sdist}' | |
| merge-multiple: true | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| docker-build: | |
| name: Docker build (${{ matrix.platform }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: linux/amd64 | |
| runner: ubuntu-latest | |
| pair: linux-amd64 | |
| - platform: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| pair: linux-arm64 | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| packages: write | |
| env: | |
| REGISTRY_IMAGE: ghcr.io/vanandrew/warpkit | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Docker meta (labels) | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY_IMAGE }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to GitHub Container Registry | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build (and push by digest on release) | |
| id: build | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| platforms: ${{ matrix.platform }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=${{ github.event_name == 'release' && github.event.action == 'published' }} | |
| - name: Export digest | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| run: | | |
| mkdir -p "${{ runner.temp }}/digests" | |
| digest="${{ steps.build.outputs.digest }}" | |
| touch "${{ runner.temp }}/digests/${digest#sha256:}" | |
| - name: Upload digest | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: digests-${{ matrix.pair }} | |
| path: ${{ runner.temp }}/digests/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| docker-publish: | |
| name: Publish multi-arch Docker manifest | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| needs: [docker-build] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| environment: | |
| name: release | |
| env: | |
| REGISTRY_IMAGE: ghcr.io/vanandrew/warpkit | |
| steps: | |
| - name: Download digests | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: ${{ runner.temp }}/digests | |
| pattern: digests-* | |
| merge-multiple: true | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Docker meta (tags) | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY_IMAGE }} | |
| tags: | | |
| type=semver,pattern={{raw}} | |
| type=raw,value=latest | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create manifest list and push | |
| working-directory: ${{ runner.temp }}/digests | |
| run: | | |
| docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
| $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) | |
| - name: Inspect image | |
| run: | | |
| docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true |