Skip to content

Commit 591bbd8

Browse files
jeremymanningclaude
andcommitted
Add comprehensive GitHub Actions CI/CD workflow
Features: - Test matrix across Python 3.9, 3.10, 3.11, 3.12 - Cross-platform testing: Ubuntu, Windows, macOS - Dependency caching for faster builds - System dependencies (FFmpeg) installation - Coverage reporting on Ubuntu Python 3.12 - Parallel execution with fail-fast disabled - Triggers on push/PR to master and dev branches The workflow runs 12 parallel jobs (4 Python versions × 3 OS) to ensure comprehensive compatibility testing across all supported environments. Also added importlib_metadata fallback dependency for Python < 3.8 compatibility in requirements.txt. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 812afec commit 591bbd8

File tree

3 files changed

+122
-0
lines changed

3 files changed

+122
-0
lines changed

.github/workflows/test.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ master, dev ]
6+
pull_request:
7+
branches: [ master, dev ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
python-version: ['3.9', '3.10', '3.11', '3.12']
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Cache pip dependencies
27+
uses: actions/cache@v3
28+
with:
29+
path: ~/.cache/pip
30+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
31+
restore-keys: |
32+
${{ runner.os }}-pip-${{ matrix.python-version }}-
33+
${{ runner.os }}-pip-
34+
35+
- name: Install system dependencies (Ubuntu)
36+
if: matrix.os == 'ubuntu-latest'
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get install -y ffmpeg
40+
41+
- name: Install system dependencies (macOS)
42+
if: matrix.os == 'macos-latest'
43+
run: |
44+
brew install ffmpeg
45+
46+
- name: Install system dependencies (Windows)
47+
if: matrix.os == 'windows-latest'
48+
run: |
49+
choco install ffmpeg
50+
continue-on-error: true
51+
52+
- name: Install Python dependencies
53+
run: |
54+
python -m pip install --upgrade pip
55+
pip install pytest pytest-cov
56+
pip install -r requirements.txt
57+
58+
- name: Install package in development mode
59+
run: |
60+
pip install -e .
61+
62+
- name: Run pytest
63+
run: |
64+
pytest -v --tb=short
65+
66+
- name: Run pytest with coverage (Ubuntu Python 3.12 only)
67+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
68+
run: |
69+
pytest --cov=hypertools --cov-report=xml --cov-report=term-missing
70+
71+
- name: Upload coverage to Codecov (Ubuntu Python 3.12 only)
72+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
73+
uses: codecov/codecov-action@v3
74+
with:
75+
file: ./coverage.xml
76+
flags: unittests
77+
name: codecov-umbrella
78+
fail_ci_if_error: false

notes/github_actions_info.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# GitHub Actions CI/CD Setup
2+
3+
## Test Matrix
4+
The GitHub Actions workflow (`/.github/workflows/test.yml`) runs comprehensive tests on:
5+
6+
### Python Versions
7+
- Python 3.9
8+
- Python 3.10
9+
- Python 3.11
10+
- Python 3.12
11+
12+
### Operating Systems
13+
- Ubuntu Latest (Linux)
14+
- Windows Latest
15+
- macOS Latest
16+
17+
### Features
18+
- **Dependency caching**: Pip cache is used to speed up builds
19+
- **System dependencies**: FFmpeg is installed for animation support
20+
- **Coverage reporting**: Coverage is collected on Ubuntu Python 3.12 and uploaded to Codecov
21+
- **Matrix strategy**: Tests run in parallel across all combinations (12 total jobs)
22+
- **Fail-fast disabled**: All combinations run even if one fails
23+
24+
## Triggers
25+
- Push to `master` or `dev` branches
26+
- Pull requests to `master` or `dev` branches
27+
28+
## Badge
29+
Add this badge to README.md to show build status:
30+
```markdown
31+
[![Tests](https://github.com/ContextLab/hypertools/workflows/Tests/badge.svg)](https://github.com/ContextLab/hypertools/actions)
32+
```
33+
34+
## Local Testing
35+
To run the same tests locally:
36+
```bash
37+
pytest -v --tb=short
38+
```
39+
40+
For coverage:
41+
```bash
42+
pytest --cov=hypertools --cov-report=xml --cov-report=term-missing
43+
```

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ numpy>=2.0.0
88
umap-learn>=0.5.5
99
requests>=2.31.0
1010
ipympl>=0.9.3
11+
importlib_metadata>=1.0.0; python_version < "3.8"

0 commit comments

Comments
 (0)