Skip to content

Commit

Permalink
Merge pull request #1 from fga-eps-mds/chore/adapt-for-2024-1
Browse files Browse the repository at this point in the history
Adapta repositório para 2024
  • Loading branch information
VictorJorgeFGA authored Aug 4, 2024
2 parents 67f50cb + 2ac42b4 commit 45b82ad
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 59 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ on:
branches:
- main
- develop
- sonar/teste
- release-sonar
- master
pull_request:
types: [opened, synchronize, reopened]
types: [opened, synchronize, reopened, closed]
jobs:
test-unit:
name: Test Unit & Scan
Expand All @@ -21,7 +20,7 @@ jobs:
- name: Test Unit
id: test-unit
run: |
docker-compose -f docker-compose.test.yml up -V --force-recreate --build --abort-on-container-exit --exit-code-from gerocuidado-forum-api-test
docker compose -f docker-compose.test.yml up -V --force-recreate --build --abort-on-container-exit --exit-code-from gerocuidado-forum-api-test
env:
TEST: unit

Expand All @@ -31,14 +30,16 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Sincroniza cobertura de testes com o Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
flags: jest
name: 2023-2-GEROcuidado-APIForum
verbose: true
# TODO: Check if this is really necessary
#
# - name: Sincroniza cobertura de testes com o Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: true
# flags: jest
# name: 2023-2-GEROcuidado-APIForum
# verbose: true

test-e2e:
name: Test E2E
Expand All @@ -52,6 +53,6 @@ jobs:
- name: Test E2E
id: test-e2e
run: |
docker-compose -f docker-compose.test.yml up -V --force-recreate --build --abort-on-container-exit --exit-code-from gerocuidado-forum-api-test
docker compose -f docker-compose.test.yml up -V --force-recreate --build --abort-on-container-exit --exit-code-from gerocuidado-forum-api-test
env:
TEST: e2e
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Sending Image to Docker Hub
uses: mr-smithers-excellent/docker-build-push@v5
with:
image: gerocuidadodev/gerocuidado-forum-api
image: victorjorge/gerocuidado-forum-api
registry: docker.io
directory: ./
dockerfile: ./Dockerfile.prod
Expand All @@ -44,4 +44,4 @@ jobs:
script: |
cd ${{env.TARGET_DIR}}
sudo git pull
sudo docker compose -f docker-compose.prod.yml up --force-recreate --build --pull --remove-orphans -d
sudo docker compose -f docker-compose.prod.yml up --force-recreate --build --pull always --remove-orphans -d
4 changes: 2 additions & 2 deletions .github/workflows/metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
run: mkdir analytics-raw-data

- name: Coletar métricas no SonarCloud
run: python parser.py ${{ github.event.repository.name }} ${{ github.ref_name }}
run: python parser.py fga-eps-mds-1_2024-1-gerocuidado-apiforum ${{ github.ref_name }} ${{ github.event.repository.name }}

- 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_DOC}}@github.com/fga-eps-mds/2023-2-GEROcuidado-Doc" docs
git clone --single-branch --branch main "https://x-access-token:${{secrets.API_TOKEN_DOC}}@github.com/fga-eps-mds/2024-1-GEROcuidado-Doc" docs
mkdir -p docs/analytics-raw-data
cp -R analytics-raw-data/*.json docs/analytics-raw-data
cd docs/
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/sonar_teste.yml

This file was deleted.

2 changes: 1 addition & 1 deletion docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.7'
services:
gerocuidado-forum-api-prod:
image: gerocuidadodev/gerocuidado-forum-api:latest
image: victorjorge/gerocuidado-forum-api:latest
container_name: gerocuidado-forum-api-prod
environment:
- DB_HOST=gerocuidado-forum-db
Expand Down
14 changes: 9 additions & 5 deletions parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@
"security_rating",
]

BASE_URL = "https://sonarcloud.io/api/measures/component_tree?component=fga-eps-mds_"
BASE_URL = "https://sonarcloud.io/api/measures/component_tree?component="

if __name__ == "__main__":

REPO = sys.argv[1]
RELEASE_VERSION = sys.argv[2]
REPO_COMPONENT_KEY = sys.argv[1]
RELEASE_VERSION = sys.argv[2].replace('/', '')
REPO = sys.argv[3]

response = requests.get(
f'{BASE_URL}{REPO}&metricKeys={",".join(METRICS_SONAR)}&ps=500'
f'{BASE_URL}{REPO_COMPONENT_KEY}&metricKeys={",".join(METRICS_SONAR)}&ps=500'
)

print(response.text)

j = json.loads(response.text)

file_path = f'./analytics-raw-data/fga-eps-mds-{REPO}-{TODAY.strftime("%m-%d-%Y-%H-%M-%S")}-{RELEASE_VERSION}.json'

with open(file_path, "w") as fp:
Expand Down
4 changes: 2 additions & 2 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sonar.projectKey=fga-eps-mds_2023-2-GEROcuidado-APIForum
sonar.projectKey=fga-eps-mds-1_2024-1-gerocuidado-apiforum
sonar.organization=fga-eps-mds-1
sonar.projectName=2023-2-GEROcuidado-APIForum
sonar.projectName=2024-1-GEROcuidado-APIForum

sonar.host.url=https://sonarcloud.io

Expand Down

0 comments on commit 45b82ad

Please sign in to comment.