Skip to content

Conversation

@zachariahcox
Copy link
Contributor

I do not have permissions to run this, but it looks approximately correct.

Add .NET Unit Tests GitHub Workflow

Summary

This PR adds a GitHub Actions workflow that automatically runs unit tests for the KustoSchemaTools project on every push to main and on every pull request. This will help catch issues earlier in the development process and ensure code quality.

Changes

  • Added .github/workflows/dotnet_unit_tests.yml workflow file
  • The workflow runs on Ubuntu latest and uses .NET 8.0
  • Performs standard dotnet operations: restore, build, test

How to Set Up as a Required Check

After merging this PR, follow these steps to make this workflow a required check for PRs:

  1. Go to the GitHub repository
  2. Click on "Settings" > "Branches"
  3. Under "Branch protection rules", click "Add rule" (or edit an existing rule for the main branch)
  4. In "Branch name pattern" enter "main"
  5. Check "Require status checks to pass before merging"
  6. Check "Require branches to be up to date before merging"
  7. In the search box below, search for "dotnet_unit_tests"
  8. Select the workflow to make it a required check
  9. Click "Create" or "Save changes"

This will ensure that all PRs must pass the unit tests before they can be merged, which will help maintain code quality and prevent regressions.

Testing Done

  • Verified the workflow runs successfully locally with dotnet test
  • Tested the workflow configuration syntax with GitHub Actions linter

Copilot AI review requested due to automatic review settings June 16, 2025 01:15
Copy link
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

This PR adds a GitHub Actions workflow to automatically restore, build, and run .NET unit tests on Ubuntu for .NET 8.0 upon pushes and pull requests targeting the main branch.

  • Introduces .github/workflows/dotnet-tests.yml defining the CI job
  • Configures triggers on push and pull_request for main
  • Uses standard dotnet restore, build, and test commands
Comments suppressed due to low confidence (1)

.github/workflows/dotnet-tests.yml:1

  • [nitpick] The workflow filename (dotnet-tests.yml) and the workflow name (dotnet_unit_tests) differ from the PR title (dotnet_unit_tests.yml). Consider aligning the file name, workflow name, and documentation for consistency.
name: dotnet_unit_tests

steps:
- uses: actions/checkout@v3

- name: Setup .NET
Copy link

Copilot AI Jun 16, 2025

Choose a reason for hiding this comment

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

To speed up CI runs, consider adding a caching step for NuGet packages (e.g., using actions/cache@v3) before dotnet restore.

Copilot uses AI. Check for mistakes.
{
const string BasePath = "DemoData";
const string Deployment = "DemoDeployment";
const string Database = "DemoDatabase";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this Database string collides with the Model.Database type.

public async Task GetDatabase()
{
var factory = new YamlDatabaseHandlerFactory()
var factory = new YamlDatabaseHandlerFactory<Model.Database>()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

required by the move from net6 to net8

Comment on lines +34 to +35
// Assert.Equal("120d", db.Tables["tableWithUp"].RetentionAndCachePolicy.Retention);
// Assert.Equal("120d", db.Tables["sourceTable"].RetentionAndCachePolicy.HotCache);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these tests appear to be obsolete and now throw nullptr exceptions.

The fix for this is addressed in #99

just commenting out for now.

@zachariahcox zachariahcox changed the title add a workflow file to run dotnet unit tests. development: run dotnet unit tests Jun 16, 2025
@alex-slynko alex-slynko merged commit 675e5be into github:main Jun 16, 2025
1 check passed
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.

2 participants