Skip to content

Commit baa5447

Browse files
committed
Phase 16: Add GitHub Actions CI/CD workflows for testing and publishing
1 parent 2453315 commit baa5447

3 files changed

Lines changed: 90 additions & 11 deletions

File tree

.github/workflows/publish.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: "3.10"
18+
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install build twine
23+
24+
- name: Build package
25+
run: python -m build
26+
27+
- name: Publish to PyPI
28+
uses: pypa/gh-action-pypi-publish@release/v1
29+
with:
30+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/tests.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -r requirements-dev.txt
29+
30+
- name: Run Black
31+
run: black --check steadfast tests examples
32+
33+
- name: Run Flake8
34+
run: flake8 steadfast tests examples
35+
36+
- name: Run MyPy
37+
run: mypy steadfast
38+
39+
- name: Run tests with coverage
40+
run: pytest tests/ --cov=steadfast --cov-report=xml --cov-report=term
41+
42+
- name: Upload coverage to Codecov
43+
uses: codecov/codecov-action@v3
44+
with:
45+
file: ./coverage.xml
46+
flags: unittests
47+
name: codecov-umbrella
48+
fail_ci_if_error: false

docs/steadfast_implementation_checklist.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -422,17 +422,18 @@ All examples are runnable and well-documented.
422422

423423
## Phase 16: CI/CD Setup
424424

425-
- [ ] **.github/workflows/tests.yml**
426-
- [ ] Test on Python 3.8-3.12
427-
- [ ] Run linting
428-
- [ ] Run type checking
429-
- [ ] Run tests with coverage
430-
- [ ] Upload coverage
431-
432-
- [ ] **.github/workflows/publish.yml**
433-
- [ ] Triggered on release
434-
- [ ] Build package
435-
- [ ] Publish to PyPI
425+
- [x] **.github/workflows/tests.yml**
426+
- [x] Test on Python 3.8-3.12
427+
- [x] Test on Ubuntu, macOS, Windows
428+
- [x] Run linting (Black, Flake8)
429+
- [x] Run type checking (MyPy)
430+
- [x] Run tests with coverage
431+
- [x] Upload coverage to Codecov
432+
433+
- [x] **.github/workflows/publish.yml**
434+
- [x] Triggered on release
435+
- [x] Build package
436+
- [x] Publish to PyPI
436437

437438
---
438439

0 commit comments

Comments
 (0)