-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (54 loc) · 1.78 KB
/
build.yaml
File metadata and controls
65 lines (54 loc) · 1.78 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
name: Build
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
pytest-tests:
name: pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update environment
run: |
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update -y
sudo apt-get install python3.12-venv
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Run pytest unit tests
run: poetry run bin/test
- name: Upload pytest test report
uses: actions/upload-artifact@v4
with:
name: pytest-coverage-report
path: coverage/coverage.xml
sonarcloud:
name: SonarCloud
needs: [pytest-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Download pytest test report
uses: actions/download-artifact@v4
with:
name: pytest-coverage-report
path: coverage/
- name: Normalize source path in pytest test report
run: |
sed -i "s/<source>.*\/app/<source>\/github\/workspace/g" coverage/coverage.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}