@@ -2,74 +2,71 @@ name: tests
22
33on :
44 push :
5- branches : [master, main]
5+ branches : [main]
66 pull_request :
7- branches : [master, main]
7+ branches : [main]
88
99jobs :
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 }})
0 commit comments