Skip to content

Commit 5401730

Browse files
committed
Add CI
1 parent fb2d988 commit 5401730

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

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

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