Skip to content

Commit 1f94817

Browse files
committed
Add CI
1 parent fb2d988 commit 1f94817

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

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

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
- name: Install dependencies
27+
run: |
28+
pip install -r requirements.txt
29+
pip install -e .
30+
- name: Cache pre-commit tools
31+
uses: actions/cache@v4
32+
with:
33+
path: |
34+
${{ env.MYPY_CACHE_DIR }}
35+
${{ env.RUFF_CACHE_DIR }}
36+
${{ env.PRE_COMMIT_HOME }}
37+
key: ${{ hashFiles('requirements.txt', '.pre-commit-config.yaml') }}-linter-cache
38+
- name: Run pre-commit checks
39+
run: pre-commit run --all-files --verbose --show-diff-on-failure
40+
test:
41+
name: Test jobs-infra on ${{ matrix.os }}
42+
runs-on: ${{ matrix.os }}
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
os: [ ubuntu-latest ]
47+
steps:
48+
- uses: actions/checkout@v4
49+
- name: Set up oldest supported Python on ${{ matrix.os }}
50+
uses: actions/setup-python@v5
51+
with:
52+
python-version: 3.9
53+
- name: Run tests on oldest supported Python
54+
run: |
55+
python -m pip install -r requirements.txt .
56+
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"]

0 commit comments

Comments
 (0)