Move tests from TraP #29
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Format, lint, type check, test! | |
on: | |
push: | |
branches: [ "master" ] | |
paths-ignore: | |
- "*.md" | |
- "*.rst" | |
- "docs" | |
- "*.sh" | |
- ".github/workflows/publish-pypi.yml" | |
pull_request: | |
branches: [ "master" ] | |
paths-ignore: | |
- "*.md" | |
- "*.rst" | |
- "docs" | |
- "*.sh" | |
- ".github/workflows/publish-pypi.yml" | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11"] | |
# lint with min & max supported versions | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install tools | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install hatch | |
hatch env create lint | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
hatch run lint:flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
hatch run lint:flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
build: | |
needs: [lint] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install hatch | |
hatch env create test | |
- name: Run pytest | |
run: | | |
hatch run test:pytest | |
- name: Integration test | |
run: | | |
hatch run scripts/pyse --detection 5 --radius 400 --csv --force-beam test/data/GRB120422A-120429.fits | |
type-check: | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11"] | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
allow-prereleases: true | |
python-version: ${{ matrix.python-version }} | |
- name: Install tools | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install hatch | |
hatch env create lint | |
- name: Type check w/ mypy | |
run: hatch run lint:mypy --install-types --non-interactive --pretty |