Skip to content

Commit

Permalink
Adding CI and tox target
Browse files Browse the repository at this point in the history
  • Loading branch information
raffienficiaud committed May 3, 2024
1 parent 8c4bbe1 commit d12de7c
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 1 deletion.
79 changes: 79 additions & 0 deletions .github/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Run tests

on: [pull_request]

jobs:
python-tox-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python_version:
- 3.8
- 3.9
- 3.10
- 3.11
- 3.12

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Setup Python {{ matrix.python_version }}
uses: actions/setup-python@v2
with:
python-version: "{{ matrix.python_version }}"

- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y libarchive-dev
- name: Install tox/wheel/setuptools
run: |
python -m pip install --upgrade pip
pip install wheel setuptools
pip install tox
- name: List tox environments
run: |
# runs tox
tox -l
- name: Install dependencies from tox
timeout-minutes: 15
run: |
# runs tox with exhaustive package installation
tox -e ${{ matrix.python_version }} --notest -vv
- name: Run tests from tox
timeout-minutes: 30
run: |
# disables the GDrive tests
# runs tox
tox -l
tox -e ${{ matrix.python_version }}
- name: Upload unit test results
if: always()
uses: actions/upload-artifact@v2
with:
name: Tox test results (${{ matrix.python_version }})
path: ${{ github.workspace }}/.tox/**/tmp/*.xml

publish-test-results:
name: 'publish unit tests results'
needs: [python-tox-tests]
runs-on: ubuntu-latest
# previous jobs might be skipped, we don't need to run this job then
if: success() || failure()

steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts

- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: artifacts/**/*.xml
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.tox
build
_version.py
pygsl_lite.egg-info
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
[project.urls]
homepage = "https://github.com/AEI-ACR/pygsl_lite"


[tool.setuptools_scm]
write_to = "pygsl_lite/_version.py"

[tool.pytest.ini_options]
minversion = "6.0"
testpaths = [
"test",
]
17 changes: 17 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[tox]
requires =
tox>=4
env_list =
py{39,310,311,312}
skip_missing_interpreters = true

[default]

[testenv]
description = run unit tests
package = wheel
deps =
pytest

commands =
pytest --junitxml={env_tmp_dir}/junit-{env_name}.xml {posargs:test}

0 comments on commit d12de7c

Please sign in to comment.