Skip to content

Commit

Permalink
Updated test workflow to include upload to CodeCov for each OS, impro…
Browse files Browse the repository at this point in the history
…ved Noxfile so only the last test generates coverage report, added PyPI classifiers
  • Loading branch information
fjwillemsen committed Sep 15, 2023
1 parent 72744e7 commit 09aa0e9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 37 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/build-test-python-package.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/test-python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will use Nox to run tests and lint for the supported Python versions, and upload the test coverage data.

name: Test

on:
push:
branches:
- master
- release/*
pull_request:
branches:
- master

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
name: Test on ${{ matrix.os }} with all supported Python versions
runs-on: ${{ format('{0}-latest', matrix.os) }} # "-latest" is added here so we can use OS in the format expected by CodeCov

strategy:
matrix:
os: [ubuntu, macos]

steps:
- uses: actions/checkout@v4
- name: Run tests with Nox
uses: fjwillemsen/setup-nox2@v3.0.0
- run: nox
- name: Upload Coverage report to CodeCov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage
os: ${{ matrix.os }}
fail_ci_if_error: false # option to Specify if CI pipeline should fail when Codecov runs into errors during upload
10 changes: 9 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ def tests(session: nox.Session) -> None:
"""Run the tests for the specified Python versions."""
session.install("poetry")
session.run("poetry", "install", "--with", "test", external=True)
session.run("pytest")

# for the last Python version session:
if session.python == python_versions_to_test[-1]:
# run pytest on the package without C-extensions to generate the correct coverage report
session.run("pytest")
else:
# for the other Python version sessions:
# run pytest without coverage reporting
session.run("pytest", "--no-cov")
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@ keywords = [
]
classifiers = [
"Environment :: Console",
"Environment :: GPU",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Topic :: Scientific/Engineering",
"Topic :: Software Development",
"Topic :: System :: Distributed Computing",
"Development Status :: 5 - Production/Stable",
]
include = [
{ path = "doc/source/*.ipynb" },
Expand Down

0 comments on commit 09aa0e9

Please sign in to comment.