From 33695d414a275f33c4b0ab5a349214a91c39a885 Mon Sep 17 00:00:00 2001 From: Sean Sylver Date: Tue, 24 Sep 2024 22:10:00 -0700 Subject: [PATCH 1/2] Test sonar --- .github/workflows/sonarscan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarscan.yml b/.github/workflows/sonarscan.yml index d8327cc1c..dc57a8b3e 100644 --- a/.github/workflows/sonarscan.yml +++ b/.github/workflows/sonarscan.yml @@ -14,7 +14,7 @@ jobs: name: Test - SonarCloud Scan runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - name: Set up JDK 17 uses: actions/setup-java@v4 with: From 224dd44382091e0a5b70a769e7aeeb3f0d723430 Mon Sep 17 00:00:00 2001 From: Sean Sylver Date: Tue, 24 Sep 2024 22:31:43 -0700 Subject: [PATCH 2/2] Set up docker step for sonar test db --- .github/workflows/sonarscan.yml | 40 ++++++++++++++++++++++++++++----- wfprev-api/.project | 34 ++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 wfprev-api/.project diff --git a/.github/workflows/sonarscan.yml b/.github/workflows/sonarscan.yml index dc57a8b3e..2ef9d6178 100644 --- a/.github/workflows/sonarscan.yml +++ b/.github/workflows/sonarscan.yml @@ -13,18 +13,46 @@ jobs: sonar: name: Test - SonarCloud Scan runs-on: ubuntu-latest + services: + postgres: + image: postgis/postgis:16-13.4 + ports: + - 5432:5432 + env: + POSTGRES_USER: wfprev + POSTGRES_PASSWORD: password + POSTGRES_DB: wfprevdb + options: > + --health-cmd="pg_isready -U wfprev -d wfprevdb" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + + - name: Wait for Postgres to be ready + run: | + for i in {1..30}; do + if pg_isready -h postgres -p 5432 -U wfprev -d wfprevdb; then + echo "Postgres is ready!" + break + fi + echo "Waiting for Postgres..." + sleep 2 + done + - name: Set up JDK 17 - uses: actions/setup-java@v4 + uses: actions/setup-java@v4 with: java-version: 17 - distribution: 'adopt' - - name: SonarCloud Scan + distribution: 'adopt' + + - name: SonarCloud Scan run: | export MAVEN_OPTS="-Xmx10000m" export NODE_OPTIONS="--max-old-space-size=4096" - mvn clean --settings server/wfprev-api/mvn_settings/settings.xml -B org.jacoco:jacoco-maven-plugin:prepare-agent verify org.jacoco:jacoco-maven-plugin:report org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=bcgov_nr-bcws-wfprev -Drepo.login=${{ secrets.IDIR_AS_EMAIL }} -Drepo.password=${{ secrets.IDIR_PASSWORD }} -DWFPREV_CLIENT_ID=${{ secrets.WFPREV_CLIENT_ID }} -DWFPREV_CLIENT_SECRET=${{ secrets.WFPREV_CLIENT_SECRET }} -DWEBADE_OAUTH2_CHECK_TOKEN_URL=${{ secrets.WEBADE_OAUTH2_CHECK_TOKEN_URL }} -DWEBADE_OAUTH2_CHECK_AUTHORIZE_URL=${{ secrets.WEBADE_OAUTH2_CHECK_AUTHORIZE_URL }} -DWFPREV_DATASOURCE_URL=${{ secrets.WFPREV_DATASOURCE_URL }} -DWFPREV_DATASOURCE_USERNAME=${{ secrets.WFPREV_DATASOURCE_USERNAME }} -DWFPREV_DATASOURCE_PASSWORD=${{ secrets.WFPREV_DATASOURCE_PASSWORD }} + mvn clean --settings server/wfprev-api/mvn_settings/settings.xml -B org.jacoco:jacoco-maven-plugin:prepare-agent verify org.jacoco:jacoco-maven-plugin:report org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=bcgov_nr-bcws-wfprev -Drepo.login=${{ secrets.IDIR_AS_EMAIL }} -Drepo.password=${{ secrets.IDIR_PASSWORD }} -DWFPREV_CLIENT_ID=${{ vars.WFPREV_CLIENT_ID }} -DWFPREV_CLIENT_SECRET=${{ secrets.WFPREV_CLIENT_SECRET }} -DWEBADE_OAUTH2_CHECK_TOKEN_URL=${{ vars.WEBADE_OAUTH2_CHECK_TOKEN_URL }} -DWEBADE_OAUTH2_CHECK_AUTHORIZE_URL=${{ vars.WEBADE_OAUTH2_CHECK_AUTHORIZE_URL }} -DWFPREV_DATASOURCE_URL=${{ vars.WFPREV_DATASOURCE_URL }} -DWFPREV_DATASOURCE_USERNAME=${{ vars.WFPREV_DATASOURCE_USERNAME }} -DWFPREV_DATASOURCE_PASSWORD=${{ secrets.WFPREV_DATASOURCE_PASSWORD }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/wfprev-api/.project b/wfprev-api/.project new file mode 100644 index 000000000..2824a88a5 --- /dev/null +++ b/wfprev-api/.project @@ -0,0 +1,34 @@ + + + wfprev-api + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1727210619863 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + +