-
Notifications
You must be signed in to change notification settings - Fork 10
77 lines (67 loc) · 2.14 KB
/
run-pytest-and-sonarcloud-scan.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
name: Run pytest and SonarCloud Scan
on:
push:
branches:
- '**'
pull_request:
types: [opened, synchronize, reopened, edited]
branches:
- develop
- main
concurrency:
group: run-pytest-tests_${{ github.ref }}
cancel-in-progress: true
jobs:
run-pytest:
if: ${{ !github.event.repository.fork }}
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Fix Directory Structure
run: |
mkdir /home/runner/_work/claasp_backup
mv -f /home/runner/_work/claasp/claasp/* /home/runner/_work/claasp_backup
rm -rf /home/runner/_work/claasp/
mkdir /home/runner/_work/claasp
mv -f /home/runner/_work/claasp_backup/* /home/runner/_work/claasp
chmod g+w /home/runner/_work/claasp/ -R
rm -rf /home/runner/_work/claasp_backup
- name: Run remote-pytest
run: |
cd /home/runner/_work/claasp
make remote-pytest
env:
GUROBI_COMPUTE_SERVER: ${{ secrets.GUROBI_COMPUTE_SERVER }}
- name: Upload Coverage.xml to artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: /home/runner/_work/claasp/coverage.xml
run-code-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Download Latest Coverage.xml from Artifacts
uses: actions/download-artifact@v4
with:
name: coverage-report
- name: Override Coverage Source Path for Sonar
run: sed -i "s/<source>\/home\/runner\/_work\/claasp\/claasp<\/source>/<source>\/github\/workspace\/claasp<\/source>/g" coverage.xml
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
with:
args: >
-Dsonar.branch.name=${{ env.GITHUB_HEAD_REF }}
-Dsonar.python.coverage.reportPaths=coverage.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
needs: run-pytest