Skip to content

Commit 59ca7b1

Browse files
authored
Merge pull request #98 from imedslab/update-pipelines
Update pipelines
2 parents b6d82df + e79188e commit 59ca7b1

File tree

3 files changed

+77
-23
lines changed

3 files changed

+77
-23
lines changed

.github/workflows/ci.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI (Test & Lint)
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
test-all:
11+
name: Test Master Branch
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
16+
fail-fast: false
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Update pip
28+
run: python -m pip install --upgrade pip
29+
30+
- name: Install wheel and build tools
31+
run: python -m pip install --upgrade wheel build
32+
33+
- name: Install PyTorch and dependencies
34+
run: |
35+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
36+
pip install -r ci/requirements.txt
37+
pip install . --no-deps
38+
39+
- name: Run tests
40+
run: pytest tests --cov solt --cov-report=xml --junitxml=./junit.xml
41+
42+
- name: Check code formatting
43+
run: black --config=black.toml --check .
44+
45+
- name: Run flake8 linter
46+
run: flake8
47+
48+
- name: Upload test results to Codecov
49+
if: ${{ !cancelled() }}
50+
uses: codecov/test-results-action@v1
51+
with:
52+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/prod-release.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
name: CI/CD Pipeline
1+
name: Publish to PyPI
22

33
on:
4-
push:
5-
branches: [master]
64
release:
75
types: [published]
86

97
jobs:
108
test-all:
11-
name: Test Master Branch
12-
if: github.event_name == 'push'
9+
name: Run Tests and Linting
1310
runs-on: ubuntu-latest
1411
strategy:
1512
matrix:
1613
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1714
fail-fast: false
18-
1915
steps:
2016
- name: Checkout code
2117
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ github.event.release.tag_name || github.sha }}
2220

2321
- name: Set up Python
2422
uses: actions/setup-python@v5
@@ -51,12 +49,11 @@ jobs:
5149
uses: codecov/test-results-action@v1
5250
with:
5351
token: ${{ secrets.CODECOV_TOKEN }}
54-
52+
5553
build-and-publish:
5654
name: Build and Publish to PyPI
5755
runs-on: ubuntu-latest
5856
needs: test-all
59-
if: github.event_name == 'release'
6057
environment:
6158
name: pypi
6259
url: https://pypi.org/project/solt/
@@ -77,7 +74,7 @@ jobs:
7774
python -m pip install --upgrade pip
7875
python -m pip install --upgrade wheel build twine
7976
80-
- name: Build distributions
77+
- name: Build package
8178
run: python -m build
8279

8380
- name: Validate built packages with twine

.github/workflows/test-release.yaml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ on:
99
type: string
1010

1111
jobs:
12-
validate-release:
13-
name: Validate Release Across Python Versions
12+
test-all:
13+
name: Run Tests and Linting
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ["3.9", "3.10", "3.11", "3.12"]
17+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1818
fail-fast: false
19-
2019
steps:
2120
- name: Checkout code
2221
uses: actions/checkout@v4
@@ -31,27 +30,34 @@ jobs:
3130
- name: Update pip
3231
run: python -m pip install --upgrade pip
3332

34-
- name: Install wheel
35-
run: python -m pip install --upgrade wheel
33+
- name: Install wheel and build tools
34+
run: python -m pip install --upgrade wheel build
3635

37-
- name: Install dependencies
36+
- name: Install PyTorch and dependencies
3837
run: |
38+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
3939
pip install -r ci/requirements.txt
40-
pip install .
40+
pip install . --no-deps
4141
4242
- name: Run tests
43-
run: pytest tests --cov solt --cov-report term-missing -v
43+
run: pytest tests --cov solt --cov-report=xml --junitxml=./junit.xml
4444

45-
- name: Run black
45+
- name: Check code formatting
4646
run: black --config=black.toml --check .
4747

48-
- name: Run flake8
48+
- name: Run flake8 linter
4949
run: flake8
5050

51+
- name: Upload test results to Codecov
52+
if: ${{ !cancelled() }}
53+
uses: codecov/test-results-action@v1
54+
with:
55+
token: ${{ secrets.CODECOV_TOKEN }}
56+
5157
build-and-publish:
5258
name: Build and Publish to TestPyPI
5359
runs-on: ubuntu-latest
54-
needs: validate-release
60+
needs: test-all
5561

5662
steps:
5763
- name: Checkout code
@@ -74,8 +80,7 @@ jobs:
7480
sed -i "s/name=\"solt\"/name=\"solt-test\"/" setup.py
7581
7682
- name: Build package
77-
run: |
78-
python -m build
83+
run: python -m build
7984

8085
- name: Validate built packages with twine
8186
run: |

0 commit comments

Comments
 (0)