forked from UnBTV/UnB-TV-VideoService
-
Notifications
You must be signed in to change notification settings - Fork 2
executable file
·58 lines (48 loc) · 1.56 KB
/
code-analysis.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
name: Análise de Código
on: push
jobs:
sonarcloud:
runs-on: ubuntu-latest
environment: actions
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:
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 }}