Skip to content

Run Tests

Run Tests #111

Workflow file for this run

name: Run Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
schedule:
# At 1:43 UTC on every Sunday.
- cron: "43 1 * * 0"
# If you trigger a new workflow while the previous one is running,
# this will cancel the previous one.
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
# Use matrix strategy to run the tests on multiple Py versions on multiple OSs.
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
**/requirements*.txt
- name: Install the Dependencies
run: |
echo "Installing the dependencies..."
python -m pip install -e .[dev]
- name: Check Linter
run: |
echo "Checking linter formatting..."
make lint-check
- name: Run Tests
run: |
echo "Running the tests..."
make test
publish:
needs: ["test"]
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install the Dependencies
run: |
echo "Installing the dependencies..."
python -m pip install -e .[dev]
- name: Build the package
run: |
hatch build
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}