diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml new file mode 100644 index 00000000..5d74a5d0 --- /dev/null +++ b/.github/workflows/validate.yaml @@ -0,0 +1,66 @@ +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] + +jobs: + validate: + name: 'Validate' + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: 'Setup .NET SDK 9.x' + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '9.x' + - name: 'Setup Node.js 22.x' + uses: actions/setup-node@v3 + with: + node-version: '22.x' + - name: 'Setup Chrome' + uses: browser-actions/setup-chrome@v1 + id: 'setup-chrome' + - name: 'Set CHROME_BIN environment variable' + run: 'echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV' + - name: Install SonarQube Cloud scanner + run: 'dotnet tool install --global dotnet-sonarscanner' + - name: Start SonarQube Cloud analysis + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: 'dotnet-sonarscanner begin /k:"turnierplan-NET_turnierplan.NET" /o:"turnierplan-net" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml" /d:sonar.exclusions="Turnierplan.Dal/Migrations/*"' + working-directory: './src' + - name: 'Restore .NET solution' + run: 'dotnet restore' + working-directory: './src' + - name: 'Build .NET solution' + run: 'dotnet build --no-restore -c Release' + working-directory: './src' + - name: 'Install dotnet-coverage' + run: 'dotnet tool install --global dotnet-coverage' + - name: 'Test .NET solution' + run: 'dotnet-coverage collect "dotnet test --no-build -c Release" -f xml -o "coverage.xml"' + working-directory: './src' + - name: 'Install npm packages' + run: 'npm ci' + working-directory: './src/Turnierplan.App/Client/' + - name: 'Build client application' + run: 'npm run build:prod' + working-directory: './src/Turnierplan.App/Client/' + - name: 'Lint client application' + run: 'npm run lint:ci' + working-directory: './src/Turnierplan.App/Client/' + - name: 'Test client application' + run: 'npm run test:ci' + working-directory: './src/Turnierplan.App/Client/' + - name: End SonarQube Cloud analysis + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: 'dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"' + working-directory: './src' + - name: 'Publish .NET solution' + run: 'dotnet publish --no-build -c Release /p:UseAppHost=false' + working-directory: './src'