[ENH] microelectrode electrophysiology specification (BEP032) #5304
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: "schemacode_ci" | |
on: | |
push: | |
branches: | |
- "master" | |
- "maint/*" | |
tags: | |
- "schema-*" | |
pull_request: | |
branches: | |
- "master" | |
- "maint/*" | |
- "*" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: Build & verify package | |
runs-on: ubuntu-latest | |
permissions: | |
attestations: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v6 | |
if: ${{ startsWith(github.ref, 'refs/tags/schema-') }} | |
- name: "Build archive on tag" | |
run: | | |
uv run --extra=tests pytest -k make_archive | |
working-directory: tools/schemacode | |
env: | |
BIDSSCHEMATOOLS_RELEASE: 1 | |
if: ${{ startsWith(github.ref, 'refs/tags/schema-') }} | |
- uses: hynek/build-and-inspect-python-package@v2 | |
with: | |
path: tools/schemacode | |
attest-build-provenance-github: ${{ github.event_name != 'pull_request' }} | |
test: | |
runs-on: ${{ matrix.os }} | |
needs: [build] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest"] | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
include: | |
- os: macos-latest | |
python-version: 3.13 | |
- os: windows-latest | |
python-version: 3.13 | |
name: ${{ matrix.os }} with Python ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v5 | |
- name: Set up Python ${{ matrix.python-version }} (uv) | |
uses: astral-sh/setup-uv@v6 | |
with: | |
python-version: ${{ matrix.python-version }} | |
activate-environment: true | |
- name: "Display Python version" | |
run: python -c "import sys; print(sys.version)" | |
- name: "Fetch packages" | |
uses: actions/download-artifact@v5 | |
with: | |
name: Packages | |
path: dist | |
- name: "Install package" | |
run: | | |
uv pip install $( ls dist/*.whl )[all] | |
- name: "Run tests" | |
run: | | |
python -m pytest -vs --doctest-modules -m "not validate_schema" \ | |
--cov-append --cov-report=xml --cov-report=term --cov=src/bidsschematools | |
working-directory: tools/schemacode | |
- name: "Validate generated types" | |
run: | | |
uvx --with=. mypy tests | |
working-directory: tools/schemacode | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unit_${{ matrix.os }}_${{ matrix.python-version }} | |
path: tools/schemacode/coverage.xml | |
if: success() | |
publish: | |
name: Publish Python Package | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
needs: [test] | |
permissions: | |
attestations: write | |
id-token: write | |
steps: | |
- name: Download packages built by build-and-inspect-python-package | |
uses: actions/download-artifact@v5 | |
with: | |
name: Packages | |
path: dist | |
- name: "Test PyPI upload" | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository-url: https://test.pypi.org/legacy/ | |
skip-existing: true | |
- name: "Upload to PyPI (on tags)" | |
if: startsWith(github.ref, 'refs/tags/schema-') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
validate_schema: | |
runs-on: ubuntu-latest | |
name: Validate schema | |
steps: | |
- uses: actions/checkout@v5 | |
- name: Set Up Python environment | |
uses: actions/setup-python@v6 | |
with: | |
python-version: "3.11" | |
- name: Install the schemacode package | |
run: | | |
python -m pip install --progress-bar off --upgrade pip setuptools wheel | |
python -m pip install -e ./tools/schemacode[all] | |
- name: Run schema validation tests | |
run: | | |
python -m pytest -vs --doctest-modules -m "validate_schema" \ | |
--cov-append --cov-report=xml --cov-report=term --cov=src/bidsschematools | |
working-directory: tools/schemacode | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: schema_validation | |
path: tools/schemacode/coverage.xml | |
if: success() | |
upload_to_codecov: | |
runs-on: "ubuntu-latest" | |
name: Upload coverage | |
needs: [test, validate_schema] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
- name: Download artifacts | |
uses: actions/download-artifact@v5 | |
- name: Upload to CodeCov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # not required but might help API rate limits | |
fail_ci_if_error: true |