Skip to content

CI Build

CI Build #40

Workflow file for this run

name: CI Build
on:
workflow_dispatch:
push:
branches:
- 'main'
paths-ignore:
- 'docs/**'
- '.github/**'
pull_request:
branches:
- 'main'
permissions:
contents: read
issues: read
pull-requests: write
checks: write
env:
DOTNET_NOLOGO: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
jobs:
build:
name: Build and Test
runs-on: ubuntu-24.04
steps:
- name: 'Harden Runner'
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- name: 'Checkout'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: 'Setup .NET SDK'
uses: actions/setup-dotnet@87b7050bc53ea08284295505d98d2aa94301e852 # v4.2.0
with:
dotnet-version: 9.0.x
- name: 'Restore external dependencies'
run: dotnet restore
- name: 'Build'
id: build
run: dotnet build --configuration Debug --no-restore
- name: Upload Build Artifacts
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: build-artifacts
path: |
src/**/BCrypt.*.nupkg
src/**/BCrypt.*.dll
src/**/BCrypt.*.deps.json
src/**/BCrypt.*.xml
retention-days: 5
- name: 'Test'
id: test
#run: dotnet test --no-build --restore --collect:"XPlat Code Coverage" --logger junit
run: dotnet test --configuration release --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
- name: 'Create test summary'
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4
with:
paths: test/**/TestResults.xml
show: "fail, skip"
if: always()
- name: 'Generate Coverage Reports'
uses: danielpalme/ReportGenerator-GitHub-Action@c38c522d4b391c1b0da979cbb2e902c0a252a7dc # 5.4.3
with:
reports: "test/**/coverage.cobertura.xml"
targetdir: "${{ github.workspace }}"
reporttypes: "Cobertura"
verbosity: "Info"
title: "Code Coverage"
tag: "${{ github.run_number }}_${{ github.run_id }}"
toolpath: "reportgeneratortool"
license: ${{ secrets.REPORT_GENERATOR_LICENSE }}
- name: Publish Code Coverage Report
uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0
with:
filename: "Cobertura.xml"
badge: true
fail_below_min: false # just informative for now
format: markdown
hide_branch_rate: false
hide_complexity: false
indicators: true
output: both
thresholds: "10 30"
- name: Upload Code Coverage Results
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: coverage-results
path: |
${{ github.workspace }}/Cobertura.xml
${{ github.workspace }}/code-coverage-results.md
retention-days: 5
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@170bf24d20d201b842d7a52403b73ed297e6645b # v2.18.0
if: always()
with:
files: "test/**/TestResults.xml"
- name: Upload Test Artifacts
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: test-results
path: "test/**/TestResults.xml"
retention-days: 5