Skip to content

Commit 3109612

Browse files
committed
Added CI
1 parent 8e518b8 commit 3109612

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- devel
8+
pull_request:
9+
branches:
10+
- main
11+
- devel
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
# Checkout the repository
19+
- name: Checkout code
20+
uses: actions/checkout@v3
21+
22+
# Set up Python
23+
- name: Set up Python
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: '3.10' # Adjust as needed
27+
28+
# Cache pip dependencies
29+
- name: Cache pip
30+
uses: actions/cache@v3
31+
with:
32+
path: ~/.cache/pip
33+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
34+
restore-keys: |
35+
${{ runner.os }}-pip-
36+
37+
# Create virtual environment and install project from pyproject.toml
38+
- name: Set up virtual environment and install project
39+
run: |
40+
python -m venv env
41+
source env/bin/activate
42+
pip install --upgrade pip
43+
pip install .
44+
45+
# Run a basic command to check installation
46+
- name: Check installation
47+
run: |
48+
source env/bin/activate
49+
src/app -h
50+
51+
# Run tests
52+
- name: Run tests
53+
run: |
54+
source env/bin/activate
55+
pytest --doctest-modules --junitxml=junit/test-results.xml
56+
env:
57+
CI: true
58+
59+
# Upload test results
60+
- name: Upload test results
61+
if: always()
62+
uses: actions/upload-artifact@v3
63+
with:
64+
name: test-results
65+
path: junit/test-results.xml
66+
67+
# Code formatting check with black
68+
- name: Code formatting with black
69+
run: |
70+
source env/bin/activate
71+
pip install black
72+
black --check src/

0 commit comments

Comments
 (0)