Skip to content

Adds a GitHub Actions workflow to run CodeQL security analysis on C# projects.#2

Merged
ambvdijk merged 3 commits intomainfrom
hotfix/codeql
Jul 8, 2025
Merged

Adds a GitHub Actions workflow to run CodeQL security analysis on C# projects.#2
ambvdijk merged 3 commits intomainfrom
hotfix/codeql

Conversation

@ambvdijk
Copy link
Copy Markdown
Collaborator

@ambvdijk ambvdijk commented Jul 8, 2025

Pull Request Overview

Adds a GitHub Actions workflow to run CodeQL security analysis on C# projects.

  • Introduces a new .github/workflows/codeql.yml file.
  • Triggers analysis on push and pull_request events for main and develop branches.
  • Implements steps to checkout code, set up .NET 8.0, initialize CodeQL, build the project, and perform analysis.

@ambvdijk ambvdijk requested a review from Copilot July 8, 2025 08:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a GitHub Actions workflow to run CodeQL security analysis on C# projects.

  • Introduces a new .github/workflows/codeql.yml file.
  • Triggers analysis on push and pull_request events for main and develop branches.
  • Implements steps to checkout code, set up .NET 8.0, initialize CodeQL, build the project, and perform analysis.
Comments suppressed due to low confidence (2)

.github/workflows/codeql.yml:25

  • Add with: fetch-depth: 0 to the checkout step so that CodeQL has access to the full Git history and tags, as recommended in the CodeQL documentation.
        uses: actions/checkout@v4

.github/workflows/codeql.yml:3

  • [nitpick] Consider adding a schedule trigger (e.g., - cron: "0 0 * * 0") under on to run CodeQL analysis regularly even when there are no code changes.
on:

Changed the dotnet-version in the CodeQL GitHub Actions workflow from 8.0.x to 9.0.x to align with the project's SDK requirements.
@ambvdijk ambvdijk changed the title Create codeql.yml Adds a GitHub Actions workflow to run CodeQL security analysis on C# projects. Jul 8, 2025
Updated the checkout step in the CodeQL workflow to use 'fetch-depth: 0', ensuring the full git history is available for analysis.
@github-advanced-security
Copy link
Copy Markdown

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jul 8, 2025

@ambvdijk ambvdijk merged commit 610cb96 into main Jul 8, 2025
5 checks passed
@ambvdijk ambvdijk deleted the hotfix/codeql branch July 8, 2025 09:02
ambvdijk added a commit that referenced this pull request Jul 9, 2025
* Adds a GitHub Actions workflow to run CodeQL security analysis on C# projects. (#2)

* Create codeql.yml

* Update CodeQL workflow to use .NET 9.0.x

Changed the dotnet-version in the CodeQL GitHub Actions workflow from 8.0.x to 9.0.x to align with the project's SDK requirements.

* Set fetch-depth to 0 in CodeQL workflow

Updated the checkout step in the CodeQL workflow to use 'fetch-depth: 0', ensuring the full git history is available for analysis.

* Add develop branch to CI workflow triggers (#1)

Updated dotnet and sonarqube GitHub Actions workflows to trigger on both main and develop branches for push and pull request events. This ensures CI processes run for changes targeting the develop branch.

* Remove --no-restore from dotnet build step (#3)

The build step in the GitHub Actions workflow now runs 'dotnet build' without the '--no-restore' flag, ensuring dependencies are restored during the build process.

* Fix incorrect syntax in dotnet.yml (#4)

* Remove --no-restore from dotnet build step

The build step in the GitHub Actions workflow now runs 'dotnet build' without the '--no-restore' flag, ensuring dependencies are restored during the build process.

* Update dotnet.yml

* Add Dependabot configuration for NuGet updates (#5)

Introduces a dependabot.yml file to enable automated weekly updates for NuGet dependencies in the repository.

* Add refactored CommandHandlerBase unit tests

Introduces a modular and SOLID-compliant test suite for CommandHandlerBase, including constructor validation, edge case, and shared test infrastructure. Adds new test classes, helpers, and a detailed README describing the new structure. Also adds Moq as a test dependency.

* Add unit tests for CommandHandlerBase.HandleAsync

Introduces tests covering core functionality of the HandleAsync method in CommandHandlerBase, including event envelope creation, ULID generation, timestamp handling, serialization, storage, and abstract method calls.

* Update CI workflows for improved compatibility

Switch SonarQube workflow from Windows to Ubuntu, update path separators for Unix compatibility, and remove PowerShell-specific commands. Minor formatting improvements were made to the dotnet workflow for consistency.

* Update SonarQube workflow for .NET 9 and code coverage

Adds setup for .NET 9.0, configures SonarQube scanner to use OpenCover reports, and updates test command to collect code coverage in OpenCover format. These changes improve code analysis and ensure compatibility with the latest .NET version.

* Update MathMax.EventSourcing.UnitTests/MathMax.EventSourcing.UnitTests.csproj

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Make CreateTestCommand static and update test assertion

Changed CreateTestCommand to a static method in CommandHandlerBaseTestFixture for easier access without instantiation. Updated a test in CommandHandlerBaseConstructorTests to use Assert.IsType with exactMatch: false instead of Assert.IsAssignableFrom.

* Refactor test command creation in unit tests

Replaced usage of _fixture.CreateTestCommand() with CommandHandlerBaseTestFixture.CreateTestCommand() in CommandHandlerBaseEdgeCaseTests and CommandHandlerBaseHandleAsyncTests for consistency and clarity.

* Refactor test helpers into separate files

Split TestHelpers.cs into individual files for each test class: TestCommand, TestEvent, TestCommandHandler, SpyTestCommandHandler, TestCommandHandlerWithNullAggregateId, and TestCommandHandlerWithNullVersion. This improves code organization and maintainability.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ambvdijk added a commit that referenced this pull request Jul 9, 2025
* Adds a GitHub Actions workflow to run CodeQL security analysis on C# projects. (#2)

* Create codeql.yml

* Update CodeQL workflow to use .NET 9.0.x

Changed the dotnet-version in the CodeQL GitHub Actions workflow from 8.0.x to 9.0.x to align with the project's SDK requirements.

* Set fetch-depth to 0 in CodeQL workflow

Updated the checkout step in the CodeQL workflow to use 'fetch-depth: 0', ensuring the full git history is available for analysis.

* Add develop branch to CI workflow triggers (#1)

Updated dotnet and sonarqube GitHub Actions workflows to trigger on both main and develop branches for push and pull request events. This ensures CI processes run for changes targeting the develop branch.

* Remove --no-restore from dotnet build step (#3)

The build step in the GitHub Actions workflow now runs 'dotnet build' without the '--no-restore' flag, ensuring dependencies are restored during the build process.

* Fix incorrect syntax in dotnet.yml (#4)

* Remove --no-restore from dotnet build step

The build step in the GitHub Actions workflow now runs 'dotnet build' without the '--no-restore' flag, ensuring dependencies are restored during the build process.

* Update dotnet.yml

* Add Dependabot configuration for NuGet updates (#5)

Introduces a dependabot.yml file to enable automated weekly updates for NuGet dependencies in the repository.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants