Skip to content

Commit 80a2763

Browse files
authored
Update Workflows (#366)
* separate lint and test workflows, improve modularity of test workflows (subject to testing) * revert separating workflows into jobs * fix backend install if else * more spacing
1 parent 4649cbd commit 80a2763

File tree

2 files changed

+73
-53
lines changed

2 files changed

+73
-53
lines changed

.github/workflows/style.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Check Code Style
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- main
8+
- dev
9+
- update-workflows
10+
push:
11+
branches:
12+
- main
13+
- dev
14+
- update-workflows
15+
16+
jobs:
17+
check-code-style:
18+
name: Check Code Style
19+
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout Repository
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.10"
30+
31+
- name: Install Ruff
32+
run: |
33+
pip install -U pip setuptools wheel
34+
pip install ruff
35+
36+
- name: Run Linter
37+
run: ruff check --config pyproject.toml --verbose
38+
39+
- name: Run Formatter
40+
run: ruff format --config pyproject.toml --check --verbose

.github/workflows/tests.yaml

Lines changed: 33 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,85 @@
11

2-
name: Tests
2+
name: Multi-Backend Tests
33

44
on:
55
workflow_dispatch:
66
pull_request:
77
branches:
88
- main
99
- dev
10+
- update-workflows
1011
push:
1112
branches:
1213
- main
1314
- dev
15+
- update-workflows
1416

17+
defaults:
18+
run:
19+
shell: bash
1520

16-
jobs:
17-
lint:
18-
runs-on: ubuntu-latest
19-
defaults:
20-
run:
21-
shell: bash -el {0}
22-
23-
steps:
24-
- name: Checkout code
25-
uses: actions/checkout@v4
26-
27-
- name: Set up Conda
28-
uses: conda-incubator/setup-miniconda@v3
29-
with:
30-
environment-file: environment.yaml
31-
python-version: "3.10"
32-
33-
- name: Show Environment Info
34-
run: |
35-
conda info
36-
conda list
37-
conda config --show-sources
38-
conda config --show
39-
printenv | sort
40-
41-
- name: Run Linter
42-
run: |
43-
ruff check --config pyproject.toml --verbose
44-
45-
- name: Run Formatter
46-
run: |
47-
ruff format --check --config pyproject.toml --verbose
4821

22+
jobs:
4923
test:
50-
runs-on: ${{ matrix.os }}
24+
name: Run Multi-Backend Tests
25+
5126
strategy:
52-
fail-fast: false
5327
matrix:
5428
os: [ubuntu-latest, windows-latest]
5529
python-version: ["3.10", "3.11"]
5630
backend: ["jax", "tensorflow", "torch"]
57-
defaults:
58-
run:
59-
shell: bash -el {0}
31+
32+
runs-on: ${{ matrix.os }}
33+
6034
env:
6135
KERAS_BACKEND: ${{ matrix.backend }}
6236

6337
steps:
64-
- name: Checkout code
38+
- name: Checkout Repository
6539
uses: actions/checkout@v4
6640

67-
- name: Set up Conda
68-
uses: conda-incubator/setup-miniconda@v3
41+
- name: Set up Python
42+
uses: actions/setup-python@v5
6943
with:
70-
environment-file: environment.yaml
7144
python-version: ${{ matrix.python-version }}
7245

46+
- name: Install Dependencies
47+
run: |
48+
pip install -U pip setuptools wheel
49+
pip install .[test]
50+
7351
- name: Install JAX
7452
if: ${{ matrix.backend == 'jax' }}
7553
run: |
7654
pip install -U jax
77-
- name: Install NumPy
78-
if: ${{ matrix.backend == 'numpy' }}
79-
run: |
80-
conda install numpy
81-
- name: Install Tensorflow
55+
56+
- name: Install TensorFlow
8257
if: ${{ matrix.backend == 'tensorflow' }}
8358
run: |
8459
pip install -U tensorflow
60+
8561
- name: Install PyTorch
8662
if: ${{ matrix.backend == 'torch' }}
8763
run: |
88-
conda install pytorch torchvision torchaudio cpuonly -c pytorch
64+
pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
8965
9066
- name: Show Environment Info
9167
run: |
92-
conda info
93-
conda list
94-
conda config --show-sources
95-
conda config --show
68+
python --version
69+
pip --version
9670
printenv | sort
97-
conda env export
71+
pip list
9872
9973
- name: Run Tests
10074
run: |
10175
pytest -x
10276
77+
- name: Upload test results to Codecov
78+
if: ${{ !cancelled() }}
79+
uses: codecov/codecov-action@v4
80+
with:
81+
token: ${{ secrets.CODECOV_TOKEN }}
82+
10383
- name: Create Coverage Report
10484
run: |
10585
coverage xml

0 commit comments

Comments
 (0)