Skip to content

Commit f2b83a5

Browse files
committed
ci: Add CI workflow for Python projects
1 parent d6722c6 commit f2b83a5

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
cancel-previous-runs:
12+
concurrency_group: ci-${{ github.ref }}
13+
concurrency: ${{ github.sha }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build-and-test:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
python-version: [3.8, 3.9, 3.10]
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
cache-dependencies: true
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install -r requirements.txt
36+
37+
- name: Run tests
38+
run: |
39+
pytest
40+
41+
lint:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
47+
- name: Set up Python 3.10
48+
uses: actions/setup-python@v4
49+
with:
50+
python-version: '3.10'
51+
52+
- name: Install dependencies
53+
run: |
54+
python -m pip install --upgrade pip
55+
pip install flake8
56+
57+
- name: Run linting
58+
run: |
59+
flake8 .

0 commit comments

Comments
 (0)