Skip to content

Commit dbf94ba

Browse files
Merge pull request #128 from amyssnippet:workflowfix
PiperOrigin-RevId: 861371765
2 parents 5175b84 + 1ef9865 commit dbf94ba

File tree

2 files changed

+109
-25
lines changed

2 files changed

+109
-25
lines changed

.github/workflows/ci.yml

Lines changed: 75 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,57 +7,110 @@ on:
77
branches: ["main"]
88

99
jobs:
10-
build-and-test:
11-
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }}"
12-
runs-on: "${{ matrix.os }}"
13-
10+
lint:
11+
name: "Lint: Python ${{ matrix.python-version }} on ${{ matrix.os }}"
12+
runs-on: ${{ matrix.os }}
1413
strategy:
1514
matrix:
1615
python-version: ["3.11"]
1716
os: [ubuntu-latest]
18-
1917
steps:
2018
- uses: "actions/checkout@v6"
2119
- uses: "actions/setup-python@v6"
2220
with:
23-
python-version: "${{ matrix.python-version }}"
24-
- name: Install dependencies
21+
python-version: ${{ matrix.python-version }}
22+
cache: "pip"
23+
- name: Install Linting Tools
2524
run: |
2625
python -m pip install --upgrade pip
27-
pip install build wheel
28-
pip install pylint pytype flake8 pylint-exit pydocstyle
29-
pip install -e .[dev]
30-
pip install -r docs/requirements.txt
31-
pip install crc32c
32-
- name: Run flake8
33-
run: flake8 jax_privacy tests examples
26+
pip install -e ".[lint,examples,test]"
27+
- name: Run flake
28+
run: |
29+
flake8 jax_privacy tests examples
3430
- name: Run pydocstyle
3531
run: |
3632
pydocstyle --convention=google --add-ignore=D101,D102,D103,D105,D202,D402 jax_privacy/
3733
- name: Run pylint
34+
shell: bash
3835
run: |
3936
pylint jax_privacy || pylint-exit -efail -wfail -cfail -rfail $?
4037
pylint examples || pylint-exit -efail -wfail -cfail -rfail $?
4138
pylint tests -d W0101,W0212,C0114 || pylint-exit -efail -wfail -cfail -rfail $?
42-
shell: bash
4339
- name: Run pytype
4440
run: |
4541
pytype jax_privacy -k
4642
pytype tests -k
4743
pytype examples -k
48-
- name: Run doctests
44+
45+
test:
46+
name: "Unit Test: Python ${{ matrix.python-version }} on ${{ matrix.os }}"
47+
runs-on: ${{ matrix.os }}
48+
strategy:
49+
matrix:
50+
python-version: ["3.11"]
51+
os: [ubuntu-latest]
52+
steps:
53+
- uses: "actions/checkout@v6"
54+
- uses: "actions/setup-python@v6"
55+
with:
56+
python-version: ${{ matrix.python-version }}
57+
cache: "pip"
58+
- name: Install Test Dependencies
59+
run: |
60+
python -m pip install --upgrade pip
61+
pip install -e ".[test,examples]"
62+
- name: Run Doctests
4963
run: |
50-
pytest --doctest-modules jax_privacy/
51-
- name: Run tests
64+
pytest --doctest-modules jax_privacy
65+
- name: Run Standard Tests
5266
run: |
5367
pytest -n auto tests/ -k "not matrix_factorization and not distributed_noise_generation_test and not sharding_utils_test"
5468
pytest -n auto tests/ -k "distributed_noise_generation_test"
5569
pytest -n auto tests/ -k "sharding_utils_test"
70+
71+
matrix-tests:
72+
name: "Matrix Tests: Python ${{ matrix.python-version }} on ${{ matrix.os }}"
73+
needs: lint
74+
runs-on: "${{ matrix.os }}"
75+
strategy:
76+
matrix:
77+
python-version: ["3.11"]
78+
os: [ubuntu-latest]
79+
steps:
80+
- uses: "actions/checkout@v6"
81+
- uses: "actions/setup-python@v6"
82+
with:
83+
python-version: "${{ matrix.python-version }}"
84+
cache: "pip"
85+
- name: Install Dependencies
86+
run: |
87+
python -m pip install --upgrade pip
88+
pip install -e ".[test]"
89+
- name: Run Heavy Tests
90+
run: |
5691
export HYPOTHESIS_PROFILE=dpftrl_default
5792
pytest -n auto tests/ -k "matrix_factorization" --ignore=tests/matrix_factorization/buffered_toeplitz_test.py
5893
shell: bash
59-
- name: Build docs
94+
95+
docs:
96+
name: "Docs: Python ${{ matrix.python-version }} on ${{ matrix.os }}"
97+
needs: lint
98+
runs-on: "${{ matrix.os }}"
99+
strategy:
100+
matrix:
101+
python-version: ["3.11"]
102+
os: [ubuntu-latest]
103+
steps:
104+
- uses: "actions/checkout@v6"
105+
- uses: "actions/setup-python@v6"
106+
with:
107+
python-version: "${{ matrix.python-version }}"
108+
cache: "pip"
109+
- name: Install Docs Dependencies
110+
run: |
111+
python -m pip install --upgrade pip
112+
pip install -e ".[docs]"
113+
- name: Build Sphinx
60114
run: |
61-
cd docs
62-
sphinx-build -W -b html . _build/html
63-
cd ..
115+
cd docs
116+
sphinx-build -W -b html . _build/html

pyproject.toml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,49 @@ dependencies = [
2424
]
2525

2626
[project.optional-dependencies]
27-
dev = [
27+
lint = [
28+
"flake8",
29+
"pydocstyle",
30+
"pylint",
31+
"pylint-exit",
32+
"pytype",
33+
]
34+
35+
test = [
36+
"pytest",
37+
"pytest-xdist",
38+
"hypothesis",
39+
"crc32c",
40+
"keras",
41+
]
42+
43+
examples = [
2844
"dinosaur",
2945
"equinox",
3046
"orbax",
3147
"scikit-learn==1.5.0",
32-
"pytest-xdist",
33-
"hypothesis",
3448
"grain",
3549
"keras",
3650
"tensorflow",
3751
]
3852

53+
docs = [
54+
"sphinx<9.0.0",
55+
"sphinx-rtd-theme",
56+
"myst-nb",
57+
"sphinx-collections",
58+
"ipykernel",
59+
"sphinx_autodoc_typehints",
60+
"tensorflow",
61+
"keras",
62+
]
63+
64+
dev = [
65+
"jax_privacy[lint,test,examples,docs]",
66+
"build",
67+
"wheel",
68+
]
69+
3970
[project.urls]
4071
Homepage = "https://github.com/google-deepmind/jax_privacy"
4172

0 commit comments

Comments
 (0)