Skip to content

Commit 62f14e0

Browse files
RoryBarnesclaude
andcommitted
Modernize GitHub Actions workflows to match bigplanet
Updated both tests.yml and docs.yml to use modern GitHub Actions patterns following the bigplanet repository's recently updated workflows. tests.yml changes: - Updated to test only ubuntu-22.04 and Python 3.9 initially (will expand after tests pass) - Removed conda dependency, now uses direct pip install - Updated actions versions: checkout@v5, setup-python@v5 - Added pip caching for faster CI runs - Removed shell: bash -l {0} requirements (not needed without conda) - Added diagnostic test step to verify pytest works - Added per-test timeout (300s) to prevent hanging tests - Updated codecov action to v4 with token support - Improved test result publishing with better naming - Removed unnecessary "Get unique id" step - Changed branch from [master, main] to just [main] docs.yml changes: - Updated actions/checkout to v5 (from v2) - Updated conda-incubator/setup-miniconda to v3 (from v2) - Updated github-pages-deploy-action to v4 (from 4.1.2) - Changed branch from [master, main] to just [main] - Removed commented pull_request section These changes align with modern GitHub Actions best practices and match the patterns successfully used in the bigplanet repository. Once tests pass on ubuntu-22.04 + Python 3.9, we can expand the matrix to include additional OS and Python versions as documented in bigplanet. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent db43991 commit 62f14e0

2 files changed

Lines changed: 44 additions & 49 deletions

File tree

.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 }})

0 commit comments

Comments
 (0)