Skip to content
146 changes: 37 additions & 109 deletions .github/workflows/pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ on:
- Debug
- Release

permissions:
contents: read

jobs:
prepare_linux:
name: 🐧 Prepare Linux
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
timeout-minutes: 15
outputs:
restoreCacheKey: ${{ steps.dotnet-restore.outputs.restoreCacheKey }}
Expand Down Expand Up @@ -63,7 +66,7 @@ jobs:

build:
name: 🛠️ Build
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
timeout-minutes: 15
strategy:
matrix:
Expand Down Expand Up @@ -156,7 +159,7 @@ jobs:

pack:
name: 📦 Pack
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
timeout-minutes: 15
strategy:
matrix:
Expand Down Expand Up @@ -185,7 +188,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022]
os: [ubuntu-24.04, windows-2022]
configuration: [Debug, Release]
project: ${{ fromJson(needs.build.outputs.testProjects) }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -230,115 +233,40 @@ jobs:
command: down

sonarcloud:
name: 🔬 Code Quality Analysis
needs: [prepare_linux, build, test]
runs-on: ubuntu-22.04
timeout-minutes: 25
steps:
- name: Checkout
uses: codebeltnet/git-checkout@v1

- name: Install .NET
uses: codebeltnet/install-dotnet@v1
with:
includePreview: true

- name: Install .NET Tool - Sonar Scanner
uses: codebeltnet/dotnet-tool-install-sonarscanner@v1

- name: Restore Dependencies
uses: codebeltnet/dotnet-restore@v2
with:
useRestoreCache: true
restoreCacheKey: ${{ needs.prepare_linux.outputs.restoreCacheKey }}

- name: Download cuemon.snk file
uses: codebeltnet/gcp-download-file@v1
with:
serviceAccountKey: ${{ secrets.GCP_TOKEN }}
bucketName: ${{ secrets.GCP_BUCKETNAME }}
objectName: cuemon.snk

- name: Run SonarCloud Analysis
uses: codebeltnet/sonarcloud-scan@v1
with:
token: ${{ secrets.SONAR_TOKEN }}
organization: geekle
projectKey: Cuemon
version: ${{ needs.build.outputs.version }}

- name: Build
uses: codebeltnet/dotnet-build@v2
with:
uploadBuildArtifact: false

- name: Finalize SonarCloud Analysis
uses: codebeltnet/sonarcloud-scan-finalize@v1
with:
token: ${{ secrets.SONAR_TOKEN }}
name: call-sonarcloud
needs: [build,test]
uses: codebeltnet/jobs-sonarcloud/.github/workflows/default.yml@v1
with:
organization: geekle
projectKey: Cuemon
version: ${{ needs.build.outputs.version }}
secrets: inherit

codecov:
name: 📊 Code Coverage Analysis
needs: [build, test]
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- name: Checkout
uses: codebeltnet/git-checkout@v1

- name: Run CodeCov Analysis
uses: codebeltnet/codecov-scan@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
repository: gimlichael/Cuemon
name: call-codecov
needs: [build,test]
uses: codebeltnet/jobs-codecov/.github/workflows/default.yml@v1
with:
repository: gimlichael/Cuemon
secrets: inherit

codeql:
name: 🛡️ Security Analysis
needs: [prepare_linux, build, test]
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- name: Checkout
uses: codebeltnet/git-checkout@v1

- name: Install .NET
uses: codebeltnet/install-dotnet@v1
with:
includePreview: true

- name: Restore Dependencies
uses: codebeltnet/dotnet-restore@v2
with:
useRestoreCache: true
restoreCacheKey: ${{ needs.prepare_linux.outputs.restoreCacheKey }}

- name: Prepare CodeQL SAST Analysis
uses: codebeltnet/codeql-scan@v1

- name: Download cuemon.snk file
uses: codebeltnet/gcp-download-file@v1
with:
serviceAccountKey: ${{ secrets.GCP_TOKEN }}
bucketName: ${{ secrets.GCP_BUCKETNAME }}
objectName: cuemon.snk

- name: Build
uses: codebeltnet/dotnet-build@v2
with:
uploadBuildArtifact: false

- name: Finalize CodeQL SAST Analysis
uses: codebeltnet/codeql-scan-finalize@v1
name: call-codeql
needs: [build,test]
uses: codebeltnet/jobs-codeql/.github/workflows/default.yml@v1
permissions:
security-events: write

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Ensure CodeQL job retains read access
Currently, the codeql job’s permissions block lists only security-events: write. Because job-level permissions override the global ones, this removes the default contents: read, which CodeQL requires to scan the repository. Update it as follows:

 codeql:
   name: call-codeql
   needs: [build,test]
   uses: codebeltnet/jobs-codeql/.github/workflows/default.yml@v1
-  permissions:
-    security-events: write
+  permissions:
+    contents: read
+    security-events: write
+  secrets: inherit
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
codeql:
name: 🛡️ Security Analysis
needs: [prepare_linux, build, test]
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- name: Checkout
uses: codebeltnet/git-checkout@v1
- name: Install .NET
uses: codebeltnet/install-dotnet@v1
with:
includePreview: true
- name: Restore Dependencies
uses: codebeltnet/dotnet-restore@v2
with:
useRestoreCache: true
restoreCacheKey: ${{ needs.prepare_linux.outputs.restoreCacheKey }}
- name: Prepare CodeQL SAST Analysis
uses: codebeltnet/codeql-scan@v1
- name: Download cuemon.snk file
uses: codebeltnet/gcp-download-file@v1
with:
serviceAccountKey: ${{ secrets.GCP_TOKEN }}
bucketName: ${{ secrets.GCP_BUCKETNAME }}
objectName: cuemon.snk
- name: Build
uses: codebeltnet/dotnet-build@v2
with:
uploadBuildArtifact: false
- name: Finalize CodeQL SAST Analysis
uses: codebeltnet/codeql-scan-finalize@v1
name: call-codeql
needs: [build,test]
uses: codebeltnet/jobs-codeql/.github/workflows/default.yml@v1
permissions:
security-events: write
codeql:
name: call-codeql
needs: [build,test]
uses: codebeltnet/jobs-codeql/.github/workflows/default.yml@v1
permissions:
contents: read
security-events: write
secrets: inherit
🧰 Tools
🪛 YAMLlint (1.37.1)

[warning] 255-255: too few spaces after comma

(commas)

🤖 Prompt for AI Agents
In .github/workflows/pipelines.yml around lines 253 to 259, the codeql job's
permissions only specify 'security-events: write', which overrides and removes
the default 'contents: read' permission needed by CodeQL to scan the repository.
To fix this, add 'contents: read' alongside 'security-events: write' in the
permissions block to ensure CodeQL retains the necessary read access.

deploy:
if: github.event_name != 'pull_request'
name: 🚀 Deploy v${{ needs.build.outputs.version }}
runs-on: ubuntu-22.04
timeout-minutes: 15
needs: [build, pack, test, sonarcloud, codecov, codeql]
environment: Production
steps:
- uses: codebeltnet/nuget-push@v1
with:
token: ${{ secrets.NUGET_TOKEN }}
configuration: ${{ inputs.configuration == '' && 'Release' || inputs.configuration }}
name: call-nuget
needs: [build,pack,test,sonarcloud,codecov,codeql]
uses: codebeltnet/jobs-nuget/.github/workflows/default.yml@v1
with:
version: ${{ needs.build.outputs.version }}
environment: Production
configuration: ${{ inputs.configuration == '' && 'Release' || inputs.configuration }}
permissions:
contents: write
packages: write
secrets: inherit
Loading