.github/workflows/build-test-deploy.yml #290
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
| on: | |
| push: | |
| branches: | |
| - main | |
| - maint/* | |
| pull_request: | |
| branches: | |
| - main | |
| - maint/* | |
| release: | |
| types: | |
| - published | |
| schedule: | |
| - cron: '30 12 1 * *' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| # Force tox and pytest to use color | |
| env: | |
| FORCE_COLOR: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-package: | |
| name: Build & verify package | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| attestations: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - uses: hynek/build-and-inspect-python-package@v2 | |
| with: | |
| # Use attestation only if the action is triggered inside the repo | |
| attest-build-provenance-github: ${{ github.event.action == 'published' || github.event_name == 'push' }} | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] | |
| dependencies: ['full'] | |
| include: | |
| - os: ubuntu-latest | |
| python-version: '3.10' | |
| dependencies: 'min' | |
| env: | |
| DEPENDS: ${{ matrix.dependencies }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| lfs: true | |
| - name: Set git name/email | |
| run: | | |
| git config --global user.email "bids.maintenance@gmail.com" | |
| git config --global user.name "bids-maintenance" | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install git-annex | |
| run: uv tool install git-annex | |
| - name: Show software versions | |
| run: | | |
| python -c "import sys; print(sys.version)" | |
| git annex version | |
| - name: Install tox | |
| run: | | |
| uv tool install --with=tox-uv --with=tox-gh-actions tox | |
| - name: Show tox config | |
| run: tox c | |
| - name: Setup test suite | |
| run: tox run -vv --notest | |
| - name: Run test suite | |
| id: pre | |
| run: tox -v --skip-pkg-install --exit-and-dump-after 1200 | |
| - uses: codecov/codecov-action@v5 | |
| if: ${{ always() }} | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| release-pypi: | |
| name: Publish released package to pypi.org | |
| environment: release-pypi | |
| if: github.event.action == 'published' | |
| runs-on: ubuntu-latest | |
| needs: [build-package, test] | |
| permissions: | |
| id-token: write | |
| attestations: write | |
| steps: | |
| - name: Download packages built by build-and-inspect-python-package | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: Packages | |
| path: dist | |
| - name: Upload package to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |