Skip to content

Add coordinate_space to Scene.create #706

Add coordinate_space to Scene.create

Add coordinate_space to Scene.create #706

name: python-somacore
on:
pull_request:
branches: ["*"]
push:
branches: [main]
release:
types: [published]
jobs:
format-check:
runs-on: ubuntu-latest
env:
PYTHON_VERSION: "3.9"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
cache-dependency-path: "python-spec/requirements-py${{ env.PYTHON_VERSION }}*.txt"
- name: Install static analysis packages
working-directory: python-spec
run: pip install -r requirements-py${PYTHON_VERSION}.txt -r requirements-py${PYTHON_VERSION}-lint.txt
- name: Restore pre-commit cache
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run mypy
run: mypy ./python-spec/src
# We maintain this full mypy step since running mypy in pre-commit is
# somewhat limited (cf. comments in .pre-commit-config.yaml).
- name: Pre-commit check
run: pre-commit run -a -v
run-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
# setuptools-scm needs a deep clone so it can look through history
# to find a relevant tag.
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: python-spec/requirements-py${{ matrix.python-version }}.txt
- name: Install prereqs
run: |
pip install --upgrade pip wheel pytest pytest-cov setuptools
pip install -r python-spec/requirements-py${{ matrix.python-version }}.txt
pip install .
- name: Run tests
working-directory: ./python-spec
run: |
pytest -s -v --junitxml=junit/test-results.xml --cov somacore --cov-report=xml --cov-report=html
upload-to-pypi:
needs:
- format-check
- run-tests
# Run only when tagging a release that starts with `python-`.
if: >
github.event_name == 'release'
&& github.event.action == 'published'
&& startsWith(github.event.release.tag_name, 'python-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
cache: pip
cache-dependency-path: python-spec/requirements-py3.10.txt
python-version: "3.10"
- name: Set up environment
run: |
pip install --upgrade build pip wheel setuptools setuptools-scm
python -m build .
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: dist