Merge pull request #12 from fga-eps-mds/develop #37
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: Análise de Código | |
on: push | |
jobs: | |
sonarcloud: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:alpine | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Creating env file | |
run: | | |
echo "${{ vars.ENV_FILE }}" > .env | |
- name: Setup virtual environment | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Executa Pytest | |
run: PYTHONPATH=src python -m coverage run -m pytest --continue-on-collection-errors --junitxml=./junit.xml | |
env: | |
MAIL_USERNAME: ${{ secrets.MAIL_USERNAME }} | |
MAIL_PASSWORD: ${{ secrets.MAIL_PASSWORD }} | |
MAIL_PORT: ${{ secrets.MAIL_PORT }} | |
MAIL_SERVER: ${{ secrets.MAIL_SERVER }} | |
MAIL_FROM: ${{ secrets.MAIL_FROM }} | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST: localhost | |
POSTGRES_DB: postgres | |
POSTGRES_PORT: 5432 | |
- name: Gera arquivos de testes no formato .xml | |
run: python3 -m coverage xml | |
- name: Executa SonarCloud Scan | |
if: ${{ always() }} | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.API_TOKEN_GITHUB }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |