Skip to content

Run tests

Run tests #36

Workflow file for this run

name: Run tests
on:
schedule:
- cron: '19 3 * * 1-5'
push:
pull_request:
workflow_dispatch:
workflow_call:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Black
uses: psf/black@stable
with:
options: "--check --verbose"
jupyter: true
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run flake8
uses: py-actions/flake8@v2
- name: Install mypy
run: pip install mypy
- name: Install types
run: mypy --install-types --non-interactive
- name: Run mypy
run: mypy
- name: Install numpydoc
run: pip install numpydoc
- name: Run docstring validation
run: ./run_validate_docstrings
tests:
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout swiftgalaxy
uses: actions/checkout@v4
with:
path: swiftgalaxy
- name: Checkout SOAP (dependency)
uses: actions/checkout@v4
with:
repository: SWIFTSIM/SOAP
path: SOAP
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v3
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f swiftgalaxy/requirements.txt ]; then pip install -r swiftgalaxy/requirements.txt; fi
if [ -f swiftgalaxy/optional_requirements.txt ]; then pip install -r swiftgalaxy/optional_requirements.txt; fi
pip install -e swiftgalaxy/
- name: Test with pytest
run: |
cd swiftgalaxy
pytest