Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
232 changes: 116 additions & 116 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,116 +1,116 @@
name: CI

on:
push:
branches:
- main
pull_request:

permissions:
contents: read
checks: write

jobs:
build-test-analyze:
name: Build, Test & Analyze
runs-on: ubuntu-latest
env:
# Secrets are not exposed to Dependabot or fork-triggered runs, so the
# token is empty there. The SonarQube steps below are skipped in that
# case so the build and tests still run.
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- name: Set up JDK 17
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
java-version: 17
distribution: 'zulu'

- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Install .NET 10 SDK
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: '10.0.x'

- name: Cache SonarQube Cloud packages
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache SonarQube Cloud scanner
id: cache-sonar-scanner
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner

- name: Install SonarQube Cloud scanner
if: ${{ env.SONAR_TOKEN != '' && steps.cache-sonar-scanner.outputs.cache-hit != 'true' }}
run: |
mkdir -p ${{ runner.temp }}/scanner
dotnet tool update dotnet-sonarscanner --tool-path ${{ runner.temp }}/scanner

- name: Restore
run: dotnet restore DockerUpdateGuard.slnx

- name: Install Reihitsu.Cli
run: dotnet tool install -g Reihitsu.Cli

- name: Check formatting
run: reihitsu-format --check .

- name: Begin SonarQube analysis
if: ${{ env.SONAR_TOKEN != '' }}
run: |
${{ runner.temp }}/scanner/dotnet-sonarscanner begin \
/k:"LarsLaskowski_DockerUpdateGuard" \
/o:"networlddev" \
/d:sonar.token="$SONAR_TOKEN" \
/d:sonar.cs.opencover.reportsPaths="${{ runner.temp }}/TestResults/**/coverage.opencover.xml" \
/d:sonar.coverage.exclusions=".squad/**,.claude/**,src/DockerUpdateGuard.Data/Migrations/**"

- name: Build
run: dotnet build DockerUpdateGuard.slnx -c Release --no-restore

- name: Test
run: >
dotnet test DockerUpdateGuard.slnx
-c Release --no-build
--logger trx
--collect:"XPlat Code Coverage"
--results-directory ${{ runner.temp }}/TestResults
--
DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover

- name: End SonarQube analysis
if: ${{ !cancelled() && env.SONAR_TOKEN != '' }}
run: |
${{ runner.temp }}/scanner/dotnet-sonarscanner end /d:sonar.token="$SONAR_TOKEN"

- name: Publish test report
uses: dorny/test-reporter@d1b5dff021aa968b288b02285a8bf47471c5928a # v3.2.0
# Creating check runs needs a writable token, which Dependabot and
# fork-triggered runs do not get. Skip there; the test step itself
# still fails the job on a failing test.
if: ${{ !cancelled() && github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.fork != true }}
with:
name: dotnet tests
path: ${{ runner.temp }}/TestResults/**/*.trx
reporter: dotnet-trx

- name: Upload test & coverage artifacts
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: ${{ !cancelled() }}
with:
name: test-results
path: |
${{ runner.temp }}/TestResults/**/*.trx
${{ runner.temp }}/TestResults/**/coverage.opencover.xml
if-no-files-found: warn
name: CI
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
checks: write
jobs:
build-test-analyze:
name: Build, Test & Analyze
runs-on: ubuntu-latest
env:
# Secrets are not exposed to Dependabot or fork-triggered runs, so the
# token is empty there. The SonarQube steps below are skipped in that
# case so the build and tests still run.
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- name: Set up JDK 17
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
with:
java-version: 17
distribution: 'zulu'
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install .NET 10 SDK
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: '10.0.x'
- name: Cache SonarQube Cloud packages
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarQube Cloud scanner
id: cache-sonar-scanner
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarQube Cloud scanner
if: ${{ env.SONAR_TOKEN != '' && steps.cache-sonar-scanner.outputs.cache-hit != 'true' }}
run: |
mkdir -p ${{ runner.temp }}/scanner
dotnet tool update dotnet-sonarscanner --tool-path ${{ runner.temp }}/scanner
- name: Restore
run: dotnet restore DockerUpdateGuard.slnx
- name: Install Reihitsu.Cli
run: dotnet tool install -g Reihitsu.Cli
- name: Check formatting
run: reihitsu-format --check .
- name: Begin SonarQube analysis
if: ${{ env.SONAR_TOKEN != '' }}
run: |
${{ runner.temp }}/scanner/dotnet-sonarscanner begin \
/k:"LarsLaskowski_DockerUpdateGuard" \
/o:"networlddev" \
/d:sonar.token="$SONAR_TOKEN" \
/d:sonar.cs.opencover.reportsPaths="${{ runner.temp }}/TestResults/**/coverage.opencover.xml" \
/d:sonar.coverage.exclusions=".squad/**,.claude/**,src/DockerUpdateGuard.Data/Migrations/**"
- name: Build
run: dotnet build DockerUpdateGuard.slnx -c Release --no-restore
- name: Test
run: >
dotnet test DockerUpdateGuard.slnx
-c Release --no-build
--logger trx
--collect:"XPlat Code Coverage"
--results-directory ${{ runner.temp }}/TestResults
--
DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
- name: End SonarQube analysis
if: ${{ !cancelled() && env.SONAR_TOKEN != '' }}
run: |
${{ runner.temp }}/scanner/dotnet-sonarscanner end /d:sonar.token="$SONAR_TOKEN"
- name: Publish test report
uses: dorny/test-reporter@d1b5dff021aa968b288b02285a8bf47471c5928a # v3.2.0
# Creating check runs needs a writable token, which Dependabot and
# fork-triggered runs do not get. Skip there; the test step itself
# still fails the job on a failing test.
if: ${{ !cancelled() && github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.fork != true }}
with:
name: dotnet tests
path: ${{ runner.temp }}/TestResults/**/*.trx
reporter: dotnet-trx
- name: Upload test & coverage artifacts
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: ${{ !cancelled() }}
with:
name: test-results
path: |
${{ runner.temp }}/TestResults/**/*.trx
${{ runner.temp }}/TestResults/**/coverage.opencover.xml
if-no-files-found: warn
Loading