Skip to content

Merge pull request #257 from unb-mds/256-corrigir-bug-de-formatacao-d… #166

Merge pull request #257 from unb-mds/256-corrigir-bug-de-formatacao-d…

Merge pull request #257 from unb-mds/256-corrigir-bug-de-formatacao-d… #166

Workflow file for this run

name: SonarCloud
on:
push:
branches:
- main
- Development
pull_request:
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- name: Checkout projeto
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Install PostgreSQL
run: |
sudo apt-get update
sudo apt-get install -y postgresql postgresql-contrib
- name: Start PostgreSQL
run: |
sudo service postgresql start
- name: Configure PostgreSQL
run: |
sudo -u postgres psql -c "CREATE DATABASE forunb_db;"
sudo -u postgres psql -c "CREATE USER forunb WITH PASSWORD 'balao123';"
sudo -u postgres psql -c "ALTER USER forunb CREATEDB;"
sudo -u postgres psql -c "ALTER ROLE forunb SET client_encoding TO 'utf8';"
sudo -u postgres psql -c "ALTER ROLE forunb SET default_transaction_isolation TO 'read committed';"
sudo -u postgres psql -c "ALTER ROLE forunb SET timezone TO 'UTC';"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE forunb_db TO forunb;"
- name: Configure enviroment
run: make config
- name: Run tests with coverage
run: |
coverage run ./forunb/manage.py test forunb
coverage xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.python.coverage.reportPaths=coverage.xml