basic fix avoiding writing to package files #510
Workflow file for this run
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: Test (and Deploy to PyPI on tag) | |
on: | |
# Only run on pushes to main, or when version tags are pushed | |
push: | |
branches: | |
- "main" | |
tags: | |
- "v**" | |
# Run on all pull-requests | |
pull_request: | |
# Allow workflow dispatch from GitHub | |
workflow_dispatch: | |
concurrency: | |
# Cancel this workflow if it is running, | |
# and then changes are applied on top of the HEAD of the branch, | |
# triggering another run of the workflow | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
linting: | |
runs-on: ubuntu-latest | |
name: Check Linting | |
steps: | |
- uses: neuroinformatics-unit/actions/lint@v2 | |
manifest: | |
name: Check Manifest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: neuroinformatics-unit/actions/check_manifest@v2 | |
test: | |
needs: [linting, manifest] | |
name: Run package tests | |
timeout-minutes: 60 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# Run all supported Python versions on linux | |
os: [ubuntu-latest] | |
python-version: ["3.9", "3.10"] | |
# Include one windows, one macos run | |
include: | |
- os: macos-latest | |
python-version: "3.10" | |
- os: windows-latest | |
python-version: "3.10" | |
steps: | |
# Cache the tensorflow model so we don't have to remake it every time | |
- name: Cache tensorflow model | |
uses: actions/cache@v3 | |
with: | |
path: "~/.cellfinder" | |
key: models-${{ hashFiles('~/.cellfinder/**') }} | |
# Setup pyqt libraries | |
- name: Setup qtpy libraries | |
uses: tlambert03/setup-qt-libs@v1 | |
# Setup VTK with headless display | |
- uses: pyvista/setup-headless-display-action@v2 | |
# Run all tests | |
- uses: neuroinformatics-unit/actions/test@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
use-xvfb: true | |
test_numba_disabled: | |
needs: [linting, manifest] | |
name: Run tests with numba disabled | |
runs-on: ubuntu-latest | |
env: | |
NUMBA_DISABLE_JIT: "1" | |
steps: | |
- name: Cache tensorflow model | |
uses: actions/cache@v3 | |
with: | |
path: "~/.cellfinder" | |
key: models-${{ hashFiles('~/.cellfinder/**') }} | |
# Setup pyqt libraries | |
- name: Setup qtpy libraries | |
uses: tlambert03/setup-qt-libs@v1 | |
# Setup VTK with headless display | |
- uses: pyvista/setup-headless-display-action@v2 | |
# Run test suite with numba disabled | |
- uses: neuroinformatics-unit/actions/test@v2 | |
with: | |
python-version: "3.10" | |
codecov-flags: "numba" | |
# Run brainglobe-workflows brainmapper-CLI tests to check for | |
# breakages | |
test_brainmapper_cli: | |
needs: [linting, manifest] | |
name: Run brainmapper tests to check for breakages | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cache tensorflow model | |
uses: actions/cache@v3 | |
with: | |
path: "~/.cellfinder" | |
key: models-${{ hashFiles('~/.cellfinder/**') }} | |
- name: Checkout brainglobe-workflows | |
uses: actions/checkout@v3 | |
with: | |
repository: 'brainglobe/brainglobe-workflows' | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install test dependencies | |
run: | | |
python -m pip install --upgrade pip wheel | |
# Install latest SHA on this brainglobe-workflows branch | |
python -m pip install git+$GITHUB_SERVER_URL/$GITHUB_REPOSITORY@$GITHUB_SHA | |
# Install checked out copy of brainglobe-workflows | |
python -m pip install .[dev] | |
- name: Run brainmapper tests in brainglobe-workflows | |
run: | | |
python -m pytest --color=yes -v tests/brainmapper | |
build_sdist_wheel: | |
name: Build source distribution and wheel | |
needs: [test, test_numba_disabled] | |
if: github.event_name == 'push' && github.ref_type == 'tag' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: neuroinformatics-unit/actions/build_sdist_wheels@v2 | |
upload_all: | |
name: Publish build distributions | |
needs: [build_sdist_wheel] | |
if: github.event_name == 'push' && github.ref_type == 'tag' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: neuroinformatics-unit/actions/upload_pypi@v2 | |
with: | |
secret-pypi-key: ${{ secrets.TWINE_API_KEY }} |