Skip to content

Commit

Permalink
Merge pull request #641 from DFE-Digital/patch-dotnet-ci-workflow
Browse files Browse the repository at this point in the history
Updated .NET, Java and EF versions
  • Loading branch information
DrizzlyOwl authored Feb 4, 2025
2 parents 0b8866a + 499abca commit 4c2f984
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ on:
- 'Dfe.Academies.*/**'

env:
JAVA_VERSION: '17'
JAVA_VERSION: 21
DOTNET_VERSION: 8.0.x

jobs:
lint:
runs-on: ubuntu-latest
steps:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: lint cypress tests

- name: lint cypress tests
run: |
cd CypressTests
npm ci
Expand All @@ -32,37 +34,46 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones disabled for a better relevancy of SC analysis
- name: Setup .NET

- name: Setup .NET ${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Setup JDK 11
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Setup JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'microsoft'

- 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 EF for tests
run: dotnet tool install --global dotnet-ef --version 6.0.5
run: dotnet tool install --global dotnet-ef

- name: Install dotnet reportgenerator
run: dotnet tool install --global dotnet-reportgenerator-globaltool

- name: Add nuget package source
run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/DFE-Digital/index.json"
run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/DFE-Digital/index.json"

- name: Restore dependencies
run: dotnet restore

- name: Build, Test and Analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet-sonarscanner begin /k:"DFE-Digital_academies-academisation-api" /o:"dfe-digital" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths=CoverageReport/SonarQube.xml
dotnet-sonarscanner begin /k:"DFE-Digital_academies-academisation-api" /o:"dfe-digital" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.scanner.skipJreProvisioning=true /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths=CoverageReport/SonarQube.xml
dotnet build --no-restore
dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage"
reportgenerator -reports:./**/coverage.cobertura.xml -targetdir:./CoverageReport -reporttypes:SonarQube
Expand Down

0 comments on commit 4c2f984

Please sign in to comment.