Skip to content

Test and check

Test and check #187

name: Test and check
on:
push:
branches:
- main
pull_request:
schedule:
# <minute [0,59]> <hour [0,23]> <day of the month [1,31]> <month of the year [1,12]> <day of the week [0,6]>
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07
# Run every Monday at 18:00:00 UTC (Monday at 10:00:00 PST)
- cron: '0 18 * * 1'
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.9]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@f38219332975fe8f9c04cca981d674bf22aea1d3 # v2.3.1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install .[dev]
- name: Test with pytest
run: |
python -m pytest camera_alignment_core/tests/
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
- name: Set up Python
uses: actions/setup-python@f38219332975fe8f9c04cca981d674bf22aea1d3 # v2.3.1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install .[dev]
- name: Type check
run: |
python -m mypy --ignore-missing-imports camera_alignment_core
- name: Lint
run: |
python -m flake8 camera_alignment_core --count --verbose --show-source --statistics
- name: Check for code format compatibility
run: |
python -m black --check camera_alignment_core
- name: Check for proper import sort order
run: |
python -m isort --check --diff camera_alignment_core
# Publish if test passed.
# Mostly cloned from https://github.com/aics-int/aicsfiles-python/blob/main/.github/workflows/ci.yml
publish:
if: "success() && startsWith(github.ref, 'refs/tags/')"
needs: [test]
runs-on: [self-hosted, build]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install .[build]
- name: Build Package
run: |
make build
- name: Publish to internal package index
env:
TWINE_USERNAME: ${{ secrets.ARTIFACTORY_USER }}
TWINE_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
TWINE_NON_INTERACTIVE: true
run: twine upload --verbose --repository-url='https://artifactory.corp.alleninstitute.org/artifactory/api/pypi/pypi-release-local' dist/*