Skip to content

Commit 2430054

Browse files
Merge pull request #2 from project-delphi/feature/add-ci-cd
ci: add GitHub Actions workflow and Makefile
2 parents 813116f + 1914496 commit 2430054

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
branches: [main]
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@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
cache: "pip"
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -e .
29+
pip install pytest pytest-cov black isort
30+
31+
- name: Check formatting with black
32+
run: |
33+
black --check anomaly_detection/ tests/
34+
35+
- name: Check import sorting with isort
36+
run: |
37+
isort --check-only anomaly_detection/ tests/
38+
39+
- name: Run tests with coverage
40+
run: |
41+
pytest tests/ --cov=anomaly_detection --cov-report=xml -v
42+
43+
- name: Upload coverage to Codecov
44+
uses: codecov/codecov-action@v4
45+
with:
46+
file: ./coverage.xml
47+
fail_ci_if_error: true

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.PHONY: install test lint format check-format check-imports clean
2+
3+
install:
4+
pip install -e .
5+
pip install pytest pytest-cov black isort
6+
7+
test:
8+
pytest tests/ --cov=anomaly_detection --cov-report=term-missing -v
9+
10+
lint:
11+
black --check anomaly_detection/ tests/
12+
isort --check-only anomaly_detection/ tests/
13+
14+
format:
15+
black anomaly_detection/ tests/
16+
isort anomaly_detection/ tests/
17+
18+
check-format:
19+
black --check anomaly_detection/ tests/
20+
21+
check-imports:
22+
isort --check-only anomaly_detection/ tests/
23+
24+
clean:
25+
find . -type d -name "__pycache__" -exec rm -r {} +
26+
find . -type f -name "*.pyc" -delete
27+
find . -type f -name "*.pyo" -delete
28+
find . -type f -name "*.pyd" -delete
29+
find . -type f -name ".coverage" -delete
30+
find . -type d -name "*.egg-info" -exec rm -r {} +
31+
find . -type d -name "*.egg" -exec rm -r {} +
32+
find . -type d -name ".pytest_cache" -exec rm -r {} +
33+
find . -type d -name ".coverage" -exec rm -r {} +
34+
find . -type d -name "htmlcov" -exec rm -r {} +
35+
find . -type f -name "coverage.xml" -delete

0 commit comments

Comments
 (0)