Skip to content

Commit 794e372

Browse files
authored
Merge pull request #27 from VirtualPlanetaryLaboratory/comprehensive-testing
Comprehensive testing
2 parents 34bd188 + eb0fe1a commit 794e372

108 files changed

Lines changed: 5311 additions & 50 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,18 @@ name: docs
22

33
on:
44
push:
5-
branches: [master, main]
6-
#pull_request: TODO: Enable me
7-
# branches:[master, main]
5+
branches: [main]
86

97
jobs:
108
tests:
119
name: "Build docs"
1210
runs-on: ubuntu-latest
1311
steps:
14-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v5
1513

1614
- name: Set up Python
1715
id: setup_python
18-
uses: conda-incubator/setup-miniconda@v2
16+
uses: conda-incubator/setup-miniconda@v3
1917
with:
2018
activate-environment: vplanet
2119
environment-file: environment.yml
@@ -41,7 +39,7 @@ jobs:
4139
touch _build/html/.nojekyll
4240
4341
- name: Publish
44-
uses: JamesIves/github-pages-deploy-action@4.1.2
42+
uses: JamesIves/github-pages-deploy-action@v4
4543
# NOTE: Triggered only when the PR is *merged* (event_name == 'push')
4644
if: steps.build.outcome == 'success' && github.event_name == 'push'
4745
with:

.github/workflows/tests.yml

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,74 +2,71 @@ name: tests
22

33
on:
44
push:
5-
branches: [master, main]
5+
branches: [main]
66
pull_request:
7-
branches: [master, main]
7+
branches: [main]
88

99
jobs:
1010
tests:
11-
name: 'Run tests on py${{ matrix.python-version }}'
12-
runs-on: ubuntu-latest
11+
name: 'py${{ matrix.python-version }} on ${{ matrix.os }}'
12+
runs-on: ${{ matrix.os }}
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
include:
17-
- python-version: '3.6'
18-
- python-version: '3.7'
19-
- python-version: '3.8'
20-
- python-version: '3.9'
21-
# - python-version: '3.10'
16+
os: [ubuntu-22.04]
17+
python-version: ["3.9"]
2218

2319
steps:
24-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v5
2521
with:
2622
fetch-depth: 0
2723

28-
- name: Set up Python
29-
id: setup_python
30-
uses: conda-incubator/setup-miniconda@v2
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v5
3126
with:
32-
activate-environment: vplanet
33-
environment-file: environment.yml
3427
python-version: ${{ matrix.python-version }}
28+
cache: 'pip'
3529

36-
- name: Install vplanet
37-
id: install
38-
if: steps.setup_python.outcome == 'success'
39-
shell: bash -l {0}
30+
- name: Install VPLanet
4031
run: |
32+
python -m pip install --upgrade pip
4133
python -m pip install vplanet
4234
4335
- name: Install vspace
44-
id: tools
45-
if: steps.install.outcome == 'success'
46-
shell: bash -l {0}
4736
run: |
4837
python -m pip install -e .
4938
50-
- name: Run tests
51-
if: steps.install.outcome == 'success'
52-
shell: bash -l {0}
53-
run: python -m pytest -v tests --junitxml=junit/test-results.xml --cov=vspace/ --cov-report=xml
39+
- name: Install test dependencies
40+
run: |
41+
python -m pip install pytest pytest-cov pytest-timeout
5442
55-
- name: Get unique id
56-
id: unique-id
57-
env:
58-
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
43+
- name: Run diagnostic test
44+
timeout-minutes: 3
5945
run: |
60-
export JOB_ID=`echo $STRATEGY_CONTEXT | md5sum`
61-
echo "::set-output name=id::$JOB_ID"
46+
# First run a simple unit test to verify pytest works
47+
echo "Running single unit test as diagnostic..."
48+
python -m pytest tests/Vspace_Explicit/test_vspace_explicit.py -v -s
6249
63-
- name: Publish unit test results
64-
uses: EnricoMi/publish-unit-test-result-action@v2
65-
if: always()
66-
with:
67-
files: junit/test-*.xml
50+
- name: Run tests
51+
timeout-minutes: 20
52+
run: |
53+
# Run all tests with verbose output, capture disabled to see subprocess output, and per-test timeout
54+
python -m pytest tests/ -v -s --timeout=300 --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml --cov=vspace --cov-report=xml --cov-report=term
6855
69-
- name: CodeCov
70-
uses: codecov/codecov-action@v2.1.0
56+
- name: Upload coverage to Codecov
57+
# Only upload from one runner to avoid redundant API calls
58+
if: matrix.os == 'ubuntu-22.04' && matrix.python-version == '3.9'
59+
uses: codecov/codecov-action@v4
7160
with:
61+
token: ${{ secrets.CODECOV_TOKEN }}
7262
files: ./coverage.xml
73-
#shell: bash -l {0}
74-
#run: |
75-
# bash <(curl -s https://codecov.io/bash)
63+
flags: ${{ matrix.os }}-py${{ matrix.python-version }}
64+
name: ${{ matrix.os }}-py${{ matrix.python-version }}
65+
fail_ci_if_error: false
66+
67+
- name: Publish test results
68+
uses: EnricoMi/publish-unit-test-result-action@v2
69+
if: always() && runner.os == 'Linux'
70+
with:
71+
files: junit/test-*.xml
72+
check_name: Test Results (py${{ matrix.python-version }} on ${{ matrix.os }})

.gitignore

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,21 @@ dmypy.json
129129
.pyre/
130130

131131

132-
# Test folders
132+
# Test folders - output directories from test runs
133133
tests/Vspace_Explicit/Explict_Test/
134134
tests/Vspace_Linear/Linear_Test/
135135
tests/Vspace_Log/Log_Test/
136+
tests/Vspace_PreDefPrior_npy/Npy_PredefPrior_Test/
137+
tests/Vspace_PreDefPrior_txt/Txt_PredefPrior_Test/
138+
tests/Random/*_Test*/
139+
tests/Errors/*_Test*/
140+
tests/ErrorHandling/*_Test*/
141+
tests/GridMode/*_Test*/
142+
tests/FileOps/*_Test*/
143+
tests/Integration/*_Test*/
144+
145+
# Backup files
146+
*.backup
136147

137148
# SCM version
138149
vspace/vspace_version.py

0 commit comments

Comments
 (0)