Skip to content

Commit 26e803c

Browse files
google-labs-jules[bot]Kibnet
authored andcommitted
ci: Add step to run unit tests in workflow
Modifies the GitHub Actions workflow (`.github/workflows/dotnetcore.yml`) to include a step for running unit tests using `dotnet test`. This ensures that tests are executed automatically as part of the CI process after dependencies are restored and before the solution is packed and published. The tests are run with the Release configuration. refactor: Separate CI tests and manual NuGet publication workflows I've revised the GitHub Actions CI/CD setup for you: 1. Automated Testing (`ci-tests.yml`): - I renamed this from `dotnetcore.yml`. - It now triggers on pushes and pull requests to all branches (`**`). - It performs checkout, .NET setup, dependency restore, and runs unit tests. - I've removed the packaging and publishing steps from this workflow. 2. Manual NuGet Publication (`manual-publish.yml`): - This is a new workflow file. - You can trigger it manually via `workflow_dispatch` from the GitHub Actions UI. - It contains steps for checkout, .NET setup, restore, packing the solution, and publishing to both nuget.org and GitHub Packages. This change allows for continuous testing on all development branches and provides you with explicit control over the release and publication of NuGet packages.
1 parent b8b87e0 commit 26e803c

File tree

3 files changed

+35
-10
lines changed

3 files changed

+35
-10
lines changed

.github/workflows/ci-tests.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: CI Tests
2+
3+
on:
4+
push:
5+
branches: ['**'] # Test on push to all branches
6+
pull_request:
7+
branches: ['**'] # Test on PR to all branches (can remove type filter or adjust as needed)
8+
9+
jobs:
10+
test: # Renamed job for clarity
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Setup .NET Core
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 9.0.5 # Consider updating if your project supports newer .NET versions
20+
- name: Install dependencies
21+
run: dotnet restore
22+
- name: Run tests
23+
run: dotnet test --configuration Release --no-restore
24+
# Removed Pack and Push steps
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
name: NuGet Generation
1+
name: Manual NuGet Publication
22

33
on:
4-
push:
5-
branches: [ master ]
6-
pull_request:
7-
types: [closed]
8-
branches: [ master ]
4+
workflow_dispatch: # Allows manual triggering from the GitHub Actions UI
95

106
jobs:
11-
build:
12-
7+
publish:
138
runs-on: ubuntu-latest
149

1510
steps:

IntSet.sln

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29613.14
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36109.1 d17.14
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntSet", "src\IntSet\IntSet.csproj", "{AE63B664-F383-48F8-8EEE-70FCB2169AF7}"
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntSet.Tests", "src\IntSet.Tests\IntSet.Tests.csproj", "{175DFCC8-9221-4D95-81D3-42C7252227D0}"
99
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Элементы решения", "Элементы решения", "{754FC069-D67B-A9D7-50A1-8D1CA196D8F1}"
11+
ProjectSection(SolutionItems) = preProject
12+
.github\workflows\ci-tests.yml = .github\workflows\ci-tests.yml
13+
.github\workflows\manual-publish.yml = .github\workflows\manual-publish.yml
14+
EndProjectSection
15+
EndProject
1016
Global
1117
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1218
Debug|Any CPU = Debug|Any CPU

0 commit comments

Comments
 (0)