[MAINT]: Add tests back to the wheel #68
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
name: pytest | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
# Run every Monday at 3:42 AM UTC | |
# Note cron-scheduled workflows will get disabled under specific circumstances, see: | |
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule | |
# specifically: | |
# - "If the repository is public and the repository is inactive for 60 days" | |
# - "When the last user to commit to the cron schedule of a workflow is removed from the organization" | |
- cron: '42 03 * * MON' | |
jobs: | |
test: | |
strategy: | |
fail-fast: false # run all matrix jobs even if one fails | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
suffix: [''] # placeholder as an alternative to "-min" | |
include: | |
- os: ubuntu-latest | |
# run with minimal versions of dependencies | |
# this is also used to upload the coverage report | |
python-version: "3.8" | |
suffix: -min | |
exclude: | |
- os: macos-latest | |
# exclude this version because its PyYAML version does not work (only in macos) | |
python-version: "3.8" | |
runs-on: ${{ matrix.os }} | |
env: | |
# Dev requirement filename, e.g., ci/requirements-py3.9-min.txt or ci/requirements-py3.9.txt | |
# these are pip-compatible requirements files | |
REQUIREMENTS: ci/requirements-py${{ matrix.python-version }}${{ matrix.suffix }}.txt | |
steps: | |
# Check out only a limited depth and then pull tags to save time | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 100 | |
- name: Get tags | |
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- name: Install Python ${{ matrix.python-version }}${{ matrix.suffix }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up test requirements | |
# sets versions of dependencies in the requirements file first to avoid installing newer versions | |
run: | | |
pip install -r ${{ env.REQUIREMENTS }} | |
pip freeze | |
- name: Set up environment | |
run: | | |
pip install .[test] | |
pip freeze | |
- name: Run tests | |
shell: bash -l {0} | |
run: | | |
pytest pvpltools --cov=./ --cov-report=xml | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v4 | |
# only upload coverage report once, for the minimal version of dependencies | |
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8' && matrix.suffix == '-min' | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true |