Skip to content

Commit 77237c6

Browse files
committed
actions
1 parent de04ed7 commit 77237c6

3 files changed

Lines changed: 115 additions & 4 deletions

File tree

.github/workflows/ci-build-pr.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: CI PR Build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- 'main'
8+
paths-ignore:
9+
- 'docs/**'
10+
- '.github/**'
11+
pull_request:
12+
branches:
13+
- 'main'
14+
paths-ignore:
15+
- 'docs/**'
16+
- '.github/**'
17+
18+
19+
permissions:
20+
contents: read
21+
issues: read
22+
pull-requests: write
23+
checks: write
24+
25+
env:
26+
DOTNET_NOLOGO: true
27+
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
28+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
29+
30+
jobs:
31+
build:
32+
name: Build and Test
33+
runs-on: ubuntu-24.04
34+
steps:
35+
- name: 'Harden Runner'
36+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
37+
with:
38+
egress-policy: audit
39+
40+
- name: 'Checkout'
41+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
42+
with:
43+
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
44+
45+
- name: 'Setup .NET SDK'
46+
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
47+
with:
48+
dotnet-version: 10.x
49+
50+
- name: 'Restore external dependencies'
51+
run: dotnet restore
52+
53+
- name: 'Build'
54+
id: build
55+
run: dotnet build --configuration Debug --no-restore
56+
57+
- name: 'Test'
58+
id: test
59+
run: dotnet run --configuration Release --coverage --coverage-output-format cobertura --report-github --project tests/UnitTests/BCrypt.Net.UnitTests.csproj
60+
61+
- name: 'Create test summary'
62+
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4
63+
with:
64+
paths: tests/UnitTests/**/TestResults.xml
65+
show: "fail, skip"
66+
if: always()
67+
68+
- name: 'Generate Coverage Reports'
69+
uses: danielpalme/ReportGenerator-GitHub-Action@c4c5175a441c6603ec614f5084386dabe0e2295b # v5.4.12
70+
with:
71+
reports: "tests/**/*.cobertura.xml"
72+
targetdir: "${{ github.workspace }}"
73+
reporttypes: "Cobertura"
74+
verbosity: "Info"
75+
title: "Code Coverage"
76+
tag: "${{ github.run_number }}_${{ github.run_id }}"
77+
toolpath: "reportgeneratortool"
78+
license: ${{ secrets.REPORT_GENERATOR_LICENSE }}
79+
80+
- name: Publish Code Coverage Report
81+
uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0
82+
with:
83+
filename: "Cobertura.xml"
84+
badge: true
85+
fail_below_min: false # just informative for now
86+
format: markdown
87+
hide_branch_rate: false
88+
hide_complexity: false
89+
indicators: true
90+
output: both
91+
thresholds: "10 30"
92+
93+
- name: Upload Code Coverage Results
94+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
95+
with:
96+
name: coverage-results
97+
path: |
98+
${{ github.workspace }}/Cobertura.xml
99+
${{ github.workspace }}/code-coverage-results.md
100+
retention-days: 5
101+
102+
- name: Publish Test Results
103+
uses: EnricoMi/publish-unit-test-result-action@afb2984f4d89672b2f9d9c13ae23d53779671984 # v2.19.0
104+
if: always()
105+
with:
106+
files: "tests/**/TestResults.xml"
107+
108+
- name: Upload Test Artifacts
109+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
110+
with:
111+
name: test-results
112+
path: "tests/**/TestResults.xml"
113+
retention-days: 5

.github/workflows/ci-build.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ on:
88
paths-ignore:
99
- 'docs/**'
1010
- '.github/**'
11-
pull_request:
12-
branches:
13-
- 'main'
11+
1412

1513
permissions:
1614
contents: read

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- name: 'Setup .NET SDK'
6464
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
6565
with:
66-
dotnet-version: 10.0.x
66+
dotnet-version: 10.x
6767

6868
# Initializes the CodeQL tools for scanning.
6969
- name: Initialize CodeQL

0 commit comments

Comments
 (0)