-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 2.22 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
---
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@v3.0.2
with:
fetch-depth: 0
- name: Set up Python
id: setup-py
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Cache test venv
uses: actions/cache@v3
with:
path: .pip-cache
key: ${{ runner.os }}-pip-tenv-${{ steps.setup-py.outputs.python-version }}-${{ hashFiles('./pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-tenv-${{ steps.setup-py.outputs.python-version }}
- 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] --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.7/site-packages/##g' coverage-reports/cobertura.xml
sed -ie 's#.tenv.lib.python3.7.site-packages.##g' coverage-reports/cobertura.xml
env:
SYNTHESIZED_KEY: ${{ secrets.SYNTHESIZED_KEY }}
- name: Upload coverage
uses: actions/upload-artifact@v3
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 }}
...