-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (72 loc) · 2.27 KB
/
Copy pathci.yml
File metadata and controls
76 lines (72 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[dev,test]'
- name: Run tests with coverage
run: |
pytest --cov --cov-config=pyproject.toml --cov-report=term --cov-report=xml --cov-fail-under=95
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: coverage.xml
if-no-files-found: error
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Codacy CLI (Trivy) security scan
run: |
chmod +x ./.codacy/cli.sh || true
./.codacy/cli.sh install || true
# Exit non-zero if vulnerabilities are found
set -o pipefail
./.codacy/cli.sh analyze --tool trivy | tee trivy.txt
if grep -q 'Vulnerabilities' trivy.txt; then
if grep -qE "poetry.lock\s+\|\s+\w+\s+\|\s+\S*[1-9]\S*\s+\|" trivy.txt || \
grep -qE "requirements.txt\s+\|\s+\w+\s+\|\s+\S*[1-9]\S*\s+\|" trivy.txt; then
echo "Security scan found vulnerabilities" >&2
exit 1
fi
fi
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image
run: |
docker build -t neuroca:test .