Skip to content

Merge pull request #217 from glotzerlab/dependabot-pip-main-pip-versi… #306

Merge pull request #217 from glotzerlab/dependabot-pip-main-pip-versi…

Merge pull request #217 from glotzerlab/dependabot-pip-main-pip-versi… #306

Workflow file for this run

name: Run Unit Tests
on:
# trigger on pull requests
pull_request:
# trigger on all commits to main
push:
branches:
- 'main'
# trigger on request
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
test:
name: test (${{ matrix.os }}, ${{ matrix.python }}, ${{ matrix.dependencies }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
include:
# Default to newest dependencies
- dependencies: 'newest'
# Test the oldest Python with the oldest supported dependencies.
- python: '3.8'
dependencies: 'oldest'
# Test macOS and windows on oldest and latest versions.
- os: 'macos-latest'
python: '3.12'
dependencies: 'newest'
- os: 'windows-latest'
python: '3.12'
dependencies: 'newest'
- os: 'windows-latest'
python: '3.8'
dependencies: 'oldest'
- os: 'macos-latest'
python: '3.8'
dependencies: 'oldest'
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Get pip cache dir
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- uses: actions/[email protected]
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: dashboard-unit-test-${{ matrix.os }}-${{ matrix.python }}-${{ matrix.dependencies }}-pip-${{ hashFiles('requirements/requirements-test.txt', '.github/workflows/ci-oldest-reqs.txt') }}
restore-keys: |
dashboard-unit-test-${{ matrix.os }}-${{ matrix.python }}-${{ matrix.dependencies }}-pip-
- name: Install newest dependencies
run: |
pip install -r requirements/requirements-test.txt
if: ${{ matrix.dependencies == 'newest' }}
- name: Install oldest supported dependencies
# To prevent Dependabot from updating the pinnings in this "oldest"
# dependency list, we have to avoid the word "requirements" in the
# filename. That's why it is in the .github/ directory and named "reqs"
# instead of "requirements."
run: |
pip install -r .github/workflows/ci-oldest-reqs.txt
if: ${{ matrix.dependencies == 'oldest' }}
- name: Install the package
run: |
pip install -e .
- name: Test with pytest
run: |
pytest --cov=signac_dashboard --cov-config=pyproject.toml --cov-report=xml tests/ -v
- uses: codecov/codecov-action@v4