Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add run unit tests in pipeline #102

Merged
merged 50 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
0003768
Add run unit tests in pipeline
Feb 27, 2025
abe926f
Add unit test execution in publish
Feb 27, 2025
a9c3395
test
Feb 27, 2025
a3affd8
test
Feb 27, 2025
1eda390
remove unecessary build line
Feb 27, 2025
126789b
test
Feb 27, 2025
c7dee87
test
Feb 27, 2025
2dc4457
test2
Feb 27, 2025
cc70f11
Fix
Feb 27, 2025
603ba48
test
Feb 27, 2025
bccb9c8
Fix
Feb 27, 2025
c906204
Fix
Feb 27, 2025
b26181a
test
Feb 27, 2025
860b171
Line converage
Feb 27, 2025
c90ffff
Test
Feb 27, 2025
12f057a
fix
Feb 27, 2025
e842b3b
Finalize pull request
Feb 27, 2025
50dc5c5
Fix branch name
Feb 27, 2025
1dc0189
Fix
Feb 27, 2025
d2dac50
Fix readme
Feb 27, 2025
4722a24
Fix
Feb 27, 2025
86a0eee
Fix
Feb 27, 2025
bd85394
More enhancements
Feb 27, 2025
1146041
re-add publish to build
Feb 27, 2025
c6bdf35
Refactor build
Feb 27, 2025
3cb9982
Clear test results.
Feb 27, 2025
c5f2f4b
Re-add run unit tests in publish
Feb 27, 2025
3b7b0f2
don't run some steps in pr
Feb 27, 2025
f6bdb2d
Test
Feb 27, 2025
e424884
Not necessary to collect result here
Feb 27, 2025
1b4d474
Test
Feb 27, 2025
b7a5c34
test
Feb 27, 2025
a34d8b3
test
Feb 27, 2025
d562511
test
Feb 27, 2025
a85e2bd
test
Feb 27, 2025
da75a3c
test
Feb 27, 2025
4b84334
Last fix
Feb 27, 2025
351b31a
gonna test later
Feb 27, 2025
9399d89
Fix
Feb 27, 2025
60c6bf8
test
Feb 27, 2025
05a42c1
test
Feb 27, 2025
fb7978e
test
Feb 27, 2025
e327e12
Fix
Feb 27, 2025
f4019d7
test
Feb 27, 2025
5ef3939
fix
Feb 27, 2025
8957761
test
Feb 27, 2025
8a7d3af
test
Feb 27, 2025
f504eb1
Fix
Feb 27, 2025
f91e6be
fix
Feb 27, 2025
3063ba0
Fix
Feb 27, 2025
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
45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,79 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
# Run dotnet restore
- name: Run dotnet restore
run: dotnet restore Cmf.CustomerPortal.Sdk.sln
# Run dotnet build
- name: Run dotnet build
run: dotnet build Cmf.CustomerPortal.Sdk.sln --no-restore --configuration Release
# Run tests with coverage
- name: Run Unit Tests with Coverage
run: |
dotnet test Cmf.CustomerPortal.Sdk.sln --no-build --no-restore --configuration Release \
--collect:"XPlat Code Coverage" \
--logger trx \
--results-directory TestResults
- name: Merge Coverage Reports
run: |
dotnet tool install --global dotnet-reportgenerator-globaltool
reportgenerator -reports:TestResults/**/coverage.cobertura.xml \
-targetdir:TestResults/MergedCoverage \
-reporttypes:Cobertura
- name: Code Coverage Report
uses: irongut/[email protected]
with:
filename: TestResults/MergedCoverage/Cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '7 7'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
- name: Write to Job Summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
# Run build
- name: Build Windows
if: github.ref == 'main'
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
run: dotnet publish --configuration Release --self-contained --runtime win-x64 Cmf.CustomerPortal.Sdk.sln
- name: Build Linux
if: github.ref == 'main'
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
run: dotnet publish --configuration Release --self-contained --runtime linux-x64 Cmf.CustomerPortal.Sdk.sln
# Read version
- name: Read tool version
if: github.ref == 'main'
uses: QwerMike/xpath-action@v1
id: getver
with:
filename: src/Version.props
expression: '/Project/PropertyGroup/Version/text()'
# Archive
- name: Archive Console Win64
if: github.ref == 'main'
uses: actions/upload-artifact@v4
with:
name: Cmf.CustomerPortal.Sdk.Console-${{ steps.getver.outputs.result }}.win-x64
path: src/Console/bin/Release/net8.0/win-x64/publish/
- name: Archive Console Linux64
if: github.ref == 'main'
uses: actions/upload-artifact@v4
with:
name: Cmf.CustomerPortal.Sdk.Console-${{ steps.getver.outputs.result }}.linux-x64
path: src/Console/bin/Release/net8.0/linux-x64/publish/
- name: Archive PowerShell
if: github.ref == 'main'
uses: actions/upload-artifact@v4
with:
name: Cmf.CustomerPortal.Sdk.PowerShell-${{ steps.getver.outputs.result }}
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
# Run dotnet restore
- name: Run dotnet restore
run: dotnet restore Cmf.CustomerPortal.Sdk.sln
# Run dotnet build
- name: Run dotnet build
run: dotnet build Cmf.CustomerPortal.Sdk.sln --no-restore --configuration Release
# Run Unit Tests
- name: Run Unit Tests
run: dotnet test Cmf.CustomerPortal.Sdk.sln --no-build --no-restore --configuration Release
# Run build
# Run build
- name: Build Windows
env:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Summary
[![Build](https://github.com/criticalmanufacturing/portal-sdk/actions/workflows/build.yml/badge.svg)](https://github.com/criticalmanufacturing/portal-sdk/actions/workflows/build.yml?query=branch%3Amain)

# portal-sdk
Customer Portal SDK that allows the creation of automation script for integration with CM DevOps Center.

Expand Down