1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [main, master, develop]
6+ pull_request :
7+ branches : [main, master, develop]
8+ workflow_dispatch :
9+
10+ jobs :
11+ test :
12+ name : Test Python ${{ matrix.python-version }}
13+ runs-on : ubuntu-latest
14+ strategy :
15+ matrix :
16+ python-version : ["3.8", "3.9", "3.10", "3.11", "3.12"]
17+
18+ steps :
19+ - uses : actions/checkout@v4
20+
21+ - name : Set up Python ${{ matrix.python-version }}
22+ uses : actions/setup-python@v5
23+ with :
24+ python-version : ${{ matrix.python-version }}
25+
26+ - name : Cache pip packages
27+ uses : actions/cache@v3
28+ with :
29+ path : ~/.cache/pip
30+ key : ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
31+ restore-keys : |
32+ ${{ runner.os }}-pip-
33+
34+ - name : Install dependencies
35+ run : |
36+ python -m pip install --upgrade pip
37+ pip install -r requirements-dev.txt
38+ pip install -e .
39+
40+ - name : Run linting
41+ run : |
42+ flake8 src/ tests/ --max-line-length=100 --extend-ignore=E203,W503
43+ black --check src/ tests/ --line-length=100
44+ isort --check-only src/ tests/ --profile black --line-length 100
45+
46+ - name : Run type checking
47+ run : |
48+ mypy src/ --ignore-missing-imports
49+
50+ - name : Run tests
51+ run : |
52+ pytest tests/ -v
53+
54+ security :
55+ name : Security Check
56+ runs-on : ubuntu-latest
57+
58+ steps :
59+ - uses : actions/checkout@v4
60+
61+ - name : Run Bandit Security Check
62+ uses : gaurav-nelson/bandit-action@v1
63+ with :
64+ path : " src/"
65+
66+ - name : Run Safety Check
67+ run : |
68+ pip install safety
69+ safety check --json
70+
71+ build :
72+ name : Build Distribution
73+ runs-on : ubuntu-latest
74+ needs : [test]
75+
76+ steps :
77+ - uses : actions/checkout@v4
78+
79+ - name : Set up Python
80+ uses : actions/setup-python@v5
81+ with :
82+ python-version : " 3.11"
83+
84+ - name : Install build dependencies
85+ run : |
86+ python -m pip install --upgrade pip
87+ pip install build
88+
89+ - name : Build package
90+ run : python -m build
91+
92+ - name : Upload artifacts
93+ uses : actions/upload-artifact@v3
94+ with :
95+ name : dist
96+ path : dist/
0 commit comments