Setup Multi-Target for .NET Framework #32
Workflow file for this run
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,Format,Test,Publish | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [ main ] | |
permissions: | |
id-token: write | |
contents: read | |
checks: write | |
packages: write | |
jobs: | |
build-dotnet: | |
runs-on: ubuntu-latest | |
# strategy: | |
# matrix: | |
# dotnet-version: [ '3.1.x', '6.0.x' ] | |
steps: | |
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a #v3.0.3 | |
# with: | |
# dotnet-version: ${{ matrix.dotnet-version }} | |
# You can test your matrix by printing the current dotnet version | |
- name: Display dotnet version | |
run: dotnet --version | |
- name: Install dependencies | |
run: dotnet restore --locked-mode | |
- name: Build | |
run: dotnet build -f net6.0 --verbosity minimal --no-restore | |
- name: Check Format | |
run: dotnet format --verify-no-changes --no-restore | |
- name: Test with the dotnet CLI | |
run: dotnet test --no-build --no-restore --framework net6.0 --logger "trx;LogFileName=pw-test-results.trx" | |
- name: Report test results | |
uses: dorny/test-reporter@c9b3d0e2bd2a4e96aaf424dbaa31c46b42318226 # v1.6.0 | |
if: always() | |
with: | |
name: Test Results | |
path: "**/*-test-results.trx" | |
reporter: dotnet-trx | |
fail-on-error: true | |
build-framework: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
# - name: Setup dotnet | |
# uses: setup msbuild? | |
- name: Display dotnet version | |
run: | | |
dotnet --version | |
dotnet --info | |
- name: Install dependencies | |
run: dotnet restore --locked-mode | |
- name: Build | |
# Don't specify a framework here so we build both .NET and .NET Framework so we can pack both | |
run: dotnet build --verbosity minimal --no-restore | |
# Don't bother running formatting for this build | |
- name: Test with the dotnet CLI | |
# We will have already ran the tests on ubuntu, so only do .NET Framework ones here | |
run: dotnet test --no-build --no-restore --framework net462 --logger "trx;LogFileName=pw-framework-test-results.trx" | |
- name: Report test results | |
uses: dorny/test-reporter@c9b3d0e2bd2a4e96aaf424dbaa31c46b42318226 # v1.6.0 | |
if: always() | |
with: | |
name: Test Results | |
path: "**/*-test-results.trx" | |
reporter: dotnet-trx | |
fail-on-error: true | |
- name: Clean Branch Name | |
run: echo "CLEAN_BRANCH_NAME=${BRANCH_NAME/\//-}" >> $GITHUB_ENV | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
- name: Pack NuGet Packages | |
run: dotnet pack --no-build --version-suffix "ci-${{ env.CLEAN_BRANCH_NAME }}-${{ github.run_id }}" | |
env: | |
CLEAN_BRANCH_NAME: ${{ env.CLEAN_BRANCH_NAME }} | |
- name: Publish NuGet Packages | |
run: dotnet nuget push **/*.nupkg --source https://nuget.pkg.github.com/passwordless/index.json --api-key ${{env.GITHUB_TOKEN}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |