This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
76 lines (64 loc) · 2.2 KB
/
django.yml
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: Django CI
on: [push, pull_request]
jobs:
install-migrations-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
strategy:
max-parallel: 4
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: make env
run: |
mv './ddueruemweb/.env.testing' './ddueruemweb/.env'
cat ./ddueruemweb/.env
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Migrations
run: |
python manage.py makemigrations
python manage.py migrate --run-syncdb
- name: Run Tests & Create Coverage
run: |
coverage erase
coverage run manage.py test
coverage xml -i
- name: Upload Sonar Test Coverage Backend
uses: actions/upload-artifact@v2
with:
name: sonar-coverage-backend
path: ${{ github.workspace }}/backend/coverage.xml
sonarqube:
needs: install-migrations-test
name: SonarQube Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Download Sonar Test Coverage Backend
uses: actions/download-artifact@v2
with:
name: sonar-coverage-backend
path: ${{ github.workspace }}/backend
- name: Set Sonarqube Project Name
run: |
sed -ir "s/^[#]*\s*sonar\.projectKey=.*/sonar\.projectKey=ddueruem\-web\-backend\-$(echo "${{ github.ref_name }}" | sed -r 's/[\/]+/_/g' | sed -r 's/[-]+/\\\-/g')/" ${{ github.workspace }}/backend/sonar-project.properties
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
with:
projectBaseDir: "./backend"
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}