copy @DrasilZA changes from PR #7 #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: # TODO: this seems like way too much access just to report test results 😠 | |
statuses: write | |
checks: write | |
contents: write | |
pull-requests: write | |
actions: write | |
steps: | |
- name: Set version number | |
shell: pwsh | |
run: | | |
$version = "0.0.$(Get-Date -Format "yyMM.dd")$(($Env:GITHUB_RUN_NUMBER % 100).ToString("00"))" | |
echo $version | |
echo "VERSION_NUMBER=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 7.0.x | |
- name: Restore dependencies | |
run: dotnet restore -property:Version=${{ env.VERSION_NUMBER }} | |
- name: Build | |
run: dotnet build --no-restore -property:Version=${{ env.VERSION_NUMBER }} | |
- name: Test | |
run: dotnet test --no-build --verbosity normal --logger trx | |
- name: Report Tests | |
uses: dorny/[email protected] | |
with: | |
reporter: dotnet-trx | |
path: "${{ github.workspace }}/**/*.trx" | |
name: Unit Tests | |
continue-on-error: true |