This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
Merge pull request #428 from OBDDimal/dependabot/pip/backend/django-4… #1421
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |