diff --git a/.github/workflows/code-pr-check.yml b/.github/workflows/code-pr-check.yml index 655db94..0c43a2b 100644 --- a/.github/workflows/code-pr-check.yml +++ b/.github/workflows/code-pr-check.yml @@ -1,11 +1,6 @@ name: Code PR Check on: - push: - branches: ["main", "Development"] - paths: - - "src/**" - - "tests/**" pull_request: branches: ["main", "Development"] paths: @@ -30,16 +25,61 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x - - - name: Restore dependencies - run: dotnet restore - - - name: Build - run: dotnet build --no-restore - - - name: Test - run: dotnet test --no-build --verbosity normal - + dotnet-version: ${{ env.DOTNET_VERSION }} + cache: false + - name: Install dotnet coverage run: dotnet tool install --global dotnet-coverage --version 17.9.3 + + - name: Cache SonarCloud packages + uses: actions/cache@v4 + with: + path: ~\sonar\cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + + - name: Install SonarCloud scanners + run: dotnet tool install --global dotnet-sonarscanner + + - name: Install latest JDK + uses: actions/setup-java@v4 + with: + distribution: "microsoft" + java-version: "17" + +# - name: Start SonarCloud scanner +# run: | +# dotnet-sonarscanner begin \ +# /k:"DFE-Digital_sts-content-support" \ +# /o:"dfe-digital" \ +# /d:sonar.login="${{ secrets.SONAR_TOKEN }}" \ +# /d:sonar.host.url="https://sonarcloud.io" \ +# /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml \ +# /d:sonar.coverage.exclusions=**/Program.cs,**/wwwroot/** \ +# /d:sonar.issue.ignore.multicriteria=e1 \ +# /d:sonar.issue.ignore.multicriteria.e1.ruleKey=csharpsquid:S6602 \ +# /d:sonar.issue.ignore.multicriteria.e1.resourceKey=src/**/*.cs + + - name: Build web app + uses: ./.github/actions/build-dotnet-app + with: + dotnet_version: ${{ env.DOTNET_VERSION }} + solution_filename: sts-contentsupport.sln + + - name: Run unit tests + uses: ./.github/actions/run-unit-tests + with: + solution_filename: sts-contentsupport.sln + +# - name: Merge test results +# run: dotnet-coverage merge -f xml -o "coverage.xml" -s "coverage.settings.xml" -r coverage.cobertura.xml +# +# - name: End SonarCloud Scanner +# run: dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" +# +# - name: Archive code coverage results +# uses: actions/upload-artifact@v4 +# with: +# name: code-coverage-report +# path: coverage.xml +# \ No newline at end of file diff --git a/.github/workflows/matrix-deploy.yml b/.github/workflows/matrix-deploy.yml index b567062..ed258f9 100644 --- a/.github/workflows/matrix-deploy.yml +++ b/.github/workflows/matrix-deploy.yml @@ -3,7 +3,7 @@ name: Multi stage build & deploy on: workflow_dispatch: push: - branches: ["main", "development"] + branches: [ "main", "Development" ] paths: - "src/**" - ".github/workflows/matrix-deploy.yml" @@ -37,20 +37,20 @@ jobs: checked-out-sha: ${{ needs.set-env.outputs.checked-out-sha }} create-and-tag-release: - needs: [set-env, create-and-publish-image] + needs: [ set-env, create-and-publish-image ] name: Create & Tag Release uses: ./.github/workflows/create-tag-release.yml secrets: inherit deploy-to-dev: - needs: [set-env, create-and-publish-image] + needs: [ set-env, create-and-publish-image ] name: Deployment to Dev & Test strategy: max-parallel: 1 fail-fast: true matrix: - target: [Dev] + target: [ Dev ] uses: ./.github/workflows/deploy-image.yml with: environment: ${{ matrix.target }}