-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (70 loc) · 2.35 KB
/
CI.yaml
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
77
78
79
80
81
82
---
name: CI
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
id: setup-py
uses: actions/setup-python@v4
with:
python-version: 3.8
- id: python_cache
uses: actions/cache@v4
with:
path: .tenv
key: pip-tenv-${{ steps.setup-py.outputs.python-version }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
pip-tenv-${{ steps.setup-py.outputs.python-version }}
- name: Create test-venv
if: steps.python_cache.outputs.cache-hit != 'true'
shell: bash
run: |
python -m venv .tenv
- name: Create test-venv
run: |
python3 -m venv .tenv
source .tenv/bin/activate
pip install -U pip build
- name: Install insight
run: |
source .tenv/bin/activate
python -m build --wheel
pip install $(ls dist/*.whl)[db,test] -c requirements.txt --cache-dir .pip-cache
- name: Run unit tests
run: |
source .tenv/bin/activate
pytest -v --junitxml=test-results/junit.xml --cov=insight --cov-report=xml:coverage-reports/cobertura.xml --cov-branch --log-cli-level=INFO
sed -ie 's#/home/runner/work/insight/insight#/github/workspace/src#g' coverage-reports/cobertura.xml
sed -ie 's#.tenv/lib/python3.8/site-packages/##g' coverage-reports/cobertura.xml
sed -ie 's#.tenv.lib.python3.8.site-packages.##g' coverage-reports/cobertura.xml
env:
SYNTHESIZED_KEY: ${{ secrets.SYNTHESIZED_KEY }}
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage-reports/cobertura.xml
- uses: codecov/codecov-action@v3
with:
flags: unittests
files: ./coverage-reports/cobertura.xml
verbose: true
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
with:
projectBaseDir: .
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
...