Skip to content

Fix exclusion

Fix exclusion #44

name: Build and Test
on:
push:
branches: [ "main", "staging" ]
pull_request:
branches: [ "main", "staging" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.11]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
run: |
python manage.py test
sonarqube:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coverage
- name: Run tests and generate coverage
run: |
coverage run --source='.' manage.py test
coverage xml -o ./coverage.xml
- name: Install SonarQube Scanner
run: |
wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip
unzip sonar-scanner-cli-4.6.2.2472-linux.zip
sudo mv sonar-scanner-4.6.2.2472-linux /opt/sonar-scanner
echo "SONAR_SCANNER_HOME=/opt/sonar-scanner" >> $GITHUB_ENV
echo "/opt/sonar-scanner/bin" >> $GITHUB_PATH
- name: Run SonarQube Scanner
run: sonar-scanner -D"sonar.projectKey=revelio" -D"sonar.sources=." -D"sonar.exclusion=**/manage.py, **/node_modules/**, **/revelio/**, **/tests.py, **/apps.py, **/admin.py, **/__init__.py" -D"sonar.host.url=https://sonarqube.cs.ui.ac.id" -D"sonar.login=$SONAR_TOKEN"
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}