Skip to content

Commit

Permalink
Merge pull request #1 from fga-eps-mds/merge-2024-1
Browse files Browse the repository at this point in the history
Merge com as atualizações feitas por EPS/MDS em 2024.1
  • Loading branch information
arthurfernandesj authored Sep 23, 2024
2 parents a4e5107 + 7f08013 commit 5bfb4fa
Show file tree
Hide file tree
Showing 25 changed files with 1,378 additions and 552 deletions.
10 changes: 5 additions & 5 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ CLIENT_SECRET=
FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=

POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_HOST=
POSTGRES_DB=
POSTGRES_PORT=
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_HOST=localhost
POSTGRES_DB=unbtv
POSTGRES_PORT=
10 changes: 9 additions & 1 deletion .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on: push
jobs:
sonarcloud:
runs-on: ubuntu-latest
environment: actions

services:
postgres:
Expand Down Expand Up @@ -45,6 +46,13 @@ jobs:
POSTGRES_HOST: localhost
POSTGRES_DB: postgres
POSTGRES_PORT: 5432
SECRET: nono
ALGORITHM: HS256
MAIL_USERNAME: [email protected]
MAIL_PASSWORD: 777
MAIL_FROM: [email protected]
MAIL_PORT: 587
MAIL_SERVER: smtp.gmail.com

- name: Gera arquivos de testes no formato .xml
run: python3 -m coverage xml
Expand All @@ -54,4 +62,4 @@ jobs:
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN_GITHUB }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Trigger Fork Workflow

on:
push:
branches:
- main
- develop

jobs:
trigger-workflow:
runs-on: ubuntu-latest
environment: actions

steps:
- name: Trigger workflow in forked repo
run: |
curl -X POST https://api.github.com/repos/victorleaoo/2024.1-UnB-TV-Users/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-H 'Authorization: token ${{ secrets.API_TOKEN_GITHUB }}' \
--data '{"event_type": "Trigger Workflow", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'
59 changes: 34 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,49 @@
name: Release
name: Export de métricas

on:
pull_request:
branches:
- main
- develop
types: [ closed ]

jobs:
release:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'NOT RELEASE') == false
runs-on: "ubuntu-latest"

environment: actions

steps:
- uses: actions/checkout@v2
with:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install dotenv
run: pip install python-dotenv packaging

- name: Cria arquivo .env
run: |
touch ./sonar_scripts/.env
echo GITHUB_TOKEN=${{ secrets.API_TOKEN_GITHUB }} >> ./sonar_scripts/.env
echo RELEASE_MAJOR=${{ contains(github.event.pull_request.labels.*.name, 'MAJOR RELEASE') }} >> ./sonar_scripts/.env
echo RELEASE_MINOR=${{ contains(github.event.pull_request.labels.*.name, 'MINOR RELEASE') }} >> ./sonar_scripts/.env
echo RELEASE_FIX=${{ contains(github.event.pull_request.labels.*.name, 'FIX RELEASE') }} >> ./sonar_scripts/.env
echo DEVELOP=${{ contains(github.event.pull_request.labels.*.name, 'DEVELOP') }} >> ./sonar_scripts/.env
- name: Criar diretório
run: mkdir -p analytics-raw-data

- name: Cria arquivo .env
run: |
touch ./scripts/.env
echo TOKEN=${{ secrets.API_TOKEN_GITHUB }} >> ./scripts/.env
echo RELEASE_MAJOR=${{ contains(github.event.pull_request.labels.*.name, 'MAJOR RELEASE') }} >> ./scripts/.env
echo RELEASE_MINOR=${{ contains(github.event.pull_request.labels.*.name, 'MINOR RELEASE') }} >> ./scripts/.env
echo RELEASE_FIX=${{ contains(github.event.pull_request.labels.*.name, 'FIX RELEASE') }} >> ./scripts/.env
echo DEVELOP=${{ contains(github.event.pull_request.labels.*.name, 'DEVELOP') }} >> ./scripts/.env
- name: Coletar métricas no SonarCloud
run: python ./sonar_scripts/parser.py

- name: Gera release e envia métricas para repositório de DOC
run: |
cd scripts && yarn install && node release.js
git config --global user.email "${{secrets.GIT_USER_EMAIL}}"
git config --global user.name "${{secrets.GIT_USER_NAME}}"
git clone --single-branch --branch main "https://x-access-token:${{secrets.API_TOKEN_GITHUB}}@github.com/fga-eps-mds/${{secrets.GIT_DOC_REPO}}" ${{secrets.GIT_DOC_REPO}}
mkdir -p ${{secrets.GIT_DOC_REPO}}/analytics-raw-data
cp -R analytics-raw-data/*.json ${{secrets.GIT_DOC_REPO}}/analytics-raw-data
cd ${{secrets.GIT_DOC_REPO}}
git add .
git commit -m "Adicionando métricas do repositório ${{ github.event.repository.name }} ${{ github.ref_name }}"
git push
- name: Envia métricas para repo de Doc
run: |
git config --global user.email "${{secrets.USER_EMAIL}}"
git config --global user.name "${{secrets.USER_NAME}}"
git clone --single-branch --branch main "https://x-access-token:${{secrets.API_TOKEN_GITHUB}}@github.com/fga-eps-mds/2024.1-UnB-TV-DOC" doc
mkdir -p doc/analytics-raw-data
cp -R analytics-raw-data/*.json doc/analytics-raw-data
cd doc
git add .
git commit -m "Adicionando métricas do repositório ${{ github.event.repository.name }} ${{ github.ref_name }}"
git push
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ data/postgress
.pytest_cache
data
.coverage
.vercel
*junit*
.vercel
Loading

0 comments on commit 5bfb4fa

Please sign in to comment.