Skip to content

Commit ab85f8b

Browse files
authored
Create ci.yml
1 parent cac1cbe commit ab85f8b

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ['3.9', '3.10', '3.11']
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Cache pip packages
25+
uses: actions/cache@v3
26+
with:
27+
path: ~/.cache/pip
28+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
29+
restore-keys: |
30+
${{ runner.os }}-pip-
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install -r requirements.txt
36+
pip install -r requirements-dev.txt
37+
pip install -e .
38+
39+
- name: Run tests
40+
run: |
41+
pytest -v -m "not requires_api_key"
42+
43+
- name: Run tests with coverage
44+
if: matrix.python-version == '3.11'
45+
run: |
46+
pytest --cov=gate --cov-report=xml --cov-report=term -m "not requires_api_key"
47+
48+
- name: Upload coverage
49+
if: matrix.python-version == '3.11'
50+
uses: codecov/codecov-action@v3
51+
with:
52+
file: ./coverage.xml
53+
fail_ci_if_error: false
54+
55+
lint:
56+
runs-on: ubuntu-latest
57+
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- name: Set up Python
62+
uses: actions/setup-python@v4
63+
with:
64+
python-version: '3.11'
65+
66+
- name: Install dependencies
67+
run: |
68+
python -m pip install --upgrade pip
69+
pip install black ruff
70+
71+
- name: Run black
72+
run: black --check gate/ tests/ || echo "Black formatting needed - run 'black gate/ tests/' locally"
73+
74+
- name: Run ruff
75+
run: ruff check gate/ tests/ || echo "Ruff linting needed - run 'ruff check gate/ tests/ --fix' locally"

0 commit comments

Comments
 (0)