From a4cfaf6949300f4ba7616f1acf8f8bcc1c14a8d8 Mon Sep 17 00:00:00 2001 From: Eduardo Gurgel <51385738+EduardoGurgel@users.noreply.github.com> Date: Tue, 31 Oct 2023 23:21:17 -0300 Subject: [PATCH 1/3] Update sonar-project.properties --- sonar-project.properties | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index e1e3eb6..2fc9e48 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,13 +1,18 @@ sonar.projectKey=fga-eps-mds_2023-2-GEROcuidado-APISaude sonar.organization=fga-eps-mds-1 +sonar.projectName=2023-2-GEROcuidado-APISaude -sonar.sources=./src -sonar.sources.exclusions=./e2e, /.vscode +sonar.host.url=https://sonarcloud.io +sonar.language=ts + +sonar.sourceEncoding=UTF-8 +sonar.python.version=3 -sonar.tests=./e2e +sonar.sources=./src +sonar.inclusions=** +sonar.exclusions=**/main.ts,**/ormconfig.ts,**/*.module.ts,src/migration/*.ts,src/migrations.ts,**/*.spec.ts +sonar.javascript.lcov.reportPaths=./coverage/unit/lcov.info sonar.dynamicAnalysis=reuseReports sonar.core.codeCoveragePlugin=cobertura -sonar.python.coverage.reportPaths=coverage.xml -sonar.python.xunit.reportPath=junit.xml From 682391e0c0677a74b38ece053f543c123932dfdd Mon Sep 17 00:00:00 2001 From: Eduardo Gurgel <51385738+EduardoGurgel@users.noreply.github.com> Date: Tue, 31 Oct 2023 23:22:27 -0300 Subject: [PATCH 2/3] Create build.yml --- .github/workflows/build.yml | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5040528 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,57 @@ +name: Build +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] +jobs: + test-unit: + name: Test Unit & Scan + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Test Unit + id: test-unit + run: | + unit docker-compose -f docker-compose.test.yml up -V --force-recreate --build --abort-on-container-exit --exit-code-from gerocuidado-saude-api-test + env: + TEST: unit + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + test-e2e: + name: Test E2E + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - 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-saude-api-test + env: + TEST: e2e + sonarcloud: + name: SonarCloud + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - 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 }} From 743f8f25a24d44a4d2ae2bb666e04b05dc838a17 Mon Sep 17 00:00:00 2001 From: Eduardo Gurgel <51385738+EduardoGurgel@users.noreply.github.com> Date: Tue, 31 Oct 2023 23:24:54 -0300 Subject: [PATCH 3/3] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5040528..1ab7b42 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: - name: Test Unit id: test-unit run: | - unit docker-compose -f docker-compose.test.yml up -V --force-recreate --build --abort-on-container-exit --exit-code-from gerocuidado-saude-api-test + docker-compose -f docker-compose.test.yml up -V --force-recreate --build --abort-on-container-exit --exit-code-from gerocuidado-saude-api-test env: TEST: unit