Skip to content

Commit

Permalink
Integrate Tox into GitHub Actions (#92)
Browse files Browse the repository at this point in the history
* Integrate Tox into GitHub Actions

Closes #91

* Perform coverage checks right after tests.

* Add XML format outputs for coverage

* Denote architecture in name of tests

* Use caching for pip in gh actions
  • Loading branch information
vivekjoshy committed Jul 9, 2023
1 parent 415612c commit 93326d2
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 25 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/black.yml

This file was deleted.

32 changes: 17 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
name: Tests
on: [push, pull_request]

concurrency:
group: check-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
name: ${{ matrix.os }} / ${{ matrix.python-version }} ${{ matrix.architecture }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [Ubuntu, MacOS, Windows]
python-version: ["3.8", "3.9", "3.10", "3.11", "pypy3.8", "pypy3.9"]
python-version: ["3.8", "3.9", "3.10", "3.11", "pypy3.8", "pypy3.9", "pypy3.10"]
architecture: ["x86", "x64"]
experimental: [false]
include:
- os: Ubuntu
Expand All @@ -25,28 +31,24 @@ jobs:
shell: bash
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Set ENV
run: |
echo "MKL_CBWR=AUTO" >> $GITHUB_ENV
echo "PYTHONHASHSEED=0" >> $GITHUB_ENV
cache-dependency-path: "**/pyproject.toml"
- name: Install Tox
run: python -m pip install tox-gh>=1.2.0
- name: Setup Test Suite
run: tox -vv --notest
- name: Run Tests
run: |
python -m pip install --upgrade pip
pip install -e.[docs,tests,release]
python -m pip install --upgrade build
python -m build
twine check dist/*
pytest . --cov --cov-report=term-missing -vv --doctest-glob="*.py"
coverage report
coverage html
coverage xml --ignore-errors
tox --skip-pkg-install
continue-on-error: ${{ matrix.experimental }}
- name: "Upload coverage to Codecov"
- name: "Upload Coverage to Codecov"
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: ${{ !matrix.experimental }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

# IDEA Folder
.idea/
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ python_files = [
]
doctest_optionflags = "NUMBER"

[tool.isort]
profile = "black"

[project]
name = "openskill"
authors = [
Expand Down Expand Up @@ -72,13 +75,15 @@ docs = [
"sphinx-intl>=2.1.0"
]
tests = [
"tox>=4.6.4",
"pytest>=7.3.1",
"pytest-cov>=4.0.0"
]
release = [
"isort>=5.12.0",
"twine>=4.0.2",
"codecov>=2.1.13",
"coverage>=7.2.7",
"bump2version>=1.0.1",
"black>=23.3.0",
"towncrier>=22.12.0",
Expand Down
55 changes: 55 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[gh]
python =
3.12-dev = py
3.12.0b3 = py3.12.0b3
3.11 = lint, build, py3.11
3.10 = py3.10
3.9 = py3.9
3.8 = py3.8
pypy3.10 = pypy3.10
pypy3.9 = pypy3.9
pypy3.8 = pypy3.8

[tox]
requires =
tox>=4
env_list =
lint
build
py
py{3.8,3.9,3.10,3.11}
py{3.8,3.9,3.10,3.11}-win32
py3.12.0b3
py3.12.0b3-win32
pypy3.{8,9,10}
coverage

[testenv]
description = Run Unit Tests
deps =
pytest>=7.3.1
pytest-cov>=4.0.0
coverage>=7.2.7
commands =
pip install -e .
pytest . --cov --cov-report=term-missing -vv --doctest-glob="*.py"
coverage report
coverage xml

[testenv:lint]
description = Run Linters
deps =
black>=23.3.0
isort>=5.12.0
commands =
isort . --check-only
black . --check --verbose

[testenv:build]
description = Run Build Checks
deps =
build>=0.10.0
twine>=4.0.2
commands =
python -m build
twine check dist/*

0 comments on commit 93326d2

Please sign in to comment.