Skip to content

Commit cfa3681

Browse files
committed
Add CI
1 parent fb2d988 commit cfa3681

File tree

3 files changed

+80
-3
lines changed

3 files changed

+80
-3
lines changed

.github/workflows/test-and-lint.yaml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Lint and test jobs poc
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
env:
15+
MYPY_CACHE_DIR: "${{ github.workspace }}/.cache/mypy"
16+
RUFF_CACHE_DIR: "${{ github.workspace }}/.cache/ruff"
17+
PRE_COMMIT_HOME: "${{ github.workspace }}/.cache/pre-commit"
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- name: Set up Python and dependencies
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: 3.11
26+
cache: pip
27+
cache-dependency-path: |
28+
requirements.txt
29+
pyproject.toml
30+
- name: Install dependencies
31+
run: |
32+
pip install -r requirements.txt
33+
pip install -e .
34+
- name: Cache pre-commit tools
35+
uses: actions/cache@v4
36+
with:
37+
path: |
38+
${{ env.MYPY_CACHE_DIR }}
39+
${{ env.RUFF_CACHE_DIR }}
40+
${{ env.PRE_COMMIT_HOME }}
41+
key: ${{ hashFiles('requirements.txt', '.pre-commit-config.yaml') }}-linter-cache
42+
- name: Run pre-commit checks
43+
run: pre-commit run --all-files --verbose --show-diff-on-failure
44+
test:
45+
name: Test jobs-infra on ${{ matrix.os }}
46+
runs-on: ${{ matrix.os }}
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
os: [ ubuntu-latest ]
51+
steps:
52+
- uses: actions/checkout@v4
53+
- name: Set up oldest supported Python on ${{ matrix.os }}
54+
uses: actions/setup-python@v5
55+
with:
56+
python-version: 3.11
57+
- name: Run tests on oldest supported Python
58+
run: |
59+
python -m pip install -r requirements.txt .
60+
pytest

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies = ["docker", "kubernetes", "ray[train]", "tensorflow"]
1414
jobs_execute = "jobs.execute:execute"
1515

1616
[project.optional-dependencies]
17-
dev = ["black", "ruff", "ruff-lsp", "pytest"]
17+
dev = ["black", "ruff", "ruff-lsp", "pytest","pre-commit>=3.3.3"]
1818

1919
[tool.ruff]
2020
src = ["src"]

requirements.txt

+19-2
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,21 @@ certifi==2024.2.2
2626
# via
2727
# kubernetes
2828
# requests
29+
cfgv==3.4.0
30+
# via pre-commit
2931
charset-normalizer==3.3.2
3032
# via requests
3133
click==8.1.7
3234
# via
3335
# black
3436
# ray
37+
distlib==0.3.8
38+
# via virtualenv
3539
docker==7.0.0
3640
filelock==3.13.4
37-
# via ray
41+
# via
42+
# ray
43+
# virtualenv
3844
flatbuffers==24.3.25
3945
# via tensorflow
4046
frozenlist==1.4.1
@@ -57,6 +63,8 @@ h5py==3.10.0
5763
# via
5864
# keras
5965
# tensorflow
66+
identify==2.5.35
67+
# via pre-commit
6068
idna==3.6
6169
# via requests
6270
iniconfig==2.0.0
@@ -92,6 +100,8 @@ mypy-extensions==1.0.0
92100
# via black
93101
namex==0.0.7
94102
# via keras
103+
nodeenv==1.8.0
104+
# via pre-commit
95105
numpy==1.26.4
96106
# via
97107
# h5py
@@ -125,9 +135,12 @@ pandas==2.2.1
125135
pathspec==0.12.1
126136
# via black
127137
platformdirs==4.2.0
128-
# via black
138+
# via
139+
# black
140+
# virtualenv
129141
pluggy==1.4.0
130142
# via pytest
143+
pre-commit==3.7.0
131144
protobuf==4.25.3
132145
# via
133146
# ray
@@ -156,6 +169,7 @@ pytz==2024.1
156169
pyyaml==6.0.1
157170
# via
158171
# kubernetes
172+
# pre-commit
159173
# ray
160174
ray==2.10.0
161175
referencing==0.34.0
@@ -184,6 +198,7 @@ ruff==0.3.4
184198
ruff-lsp==0.0.53
185199
setuptools==69.2.0
186200
# via
201+
# nodeenv
187202
# tensorboard
188203
# tensorflow
189204
six==1.16.0
@@ -217,6 +232,8 @@ urllib3==2.2.1
217232
# docker
218233
# kubernetes
219234
# requests
235+
virtualenv==20.25.3
236+
# via pre-commit
220237
websocket-client==1.7.0
221238
# via kubernetes
222239
werkzeug==3.0.2

0 commit comments

Comments
 (0)