Add tests for '[ConstantExpected]' attribute #361
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: .NET | |
# This workflow should trigger in the following cases: | |
# - The commit is any push in any branch in the repo | |
# - The commit is a published PR from anyone else | |
# | |
# This setup is done to avoid duplicate runs for the same exact commits, for cases when | |
# the PR is done from a branch in this repo, which would already trigger the "push" | |
# condition. This way, only PRs from forks will actually trigger the workflow. | |
# | |
# Because we can't really check these conditions from the global triggers here, they are | |
# added to the two root jobs below instead. If canceled, the whole workflow will stop. | |
on: [push, pull_request] | |
env: | |
EXCLUDE_RUN_ID_FROM_PACKAGE: false | |
EXCLUDE_SUFFIX_FROM_VERSION: false | |
jobs: | |
# Build the whole PolySharp solution | |
build-solution: | |
if: >- | |
github.event_name == 'push' || | |
github.event.pull_request.user.login != github.repository_owner | |
strategy: | |
matrix: | |
configuration: [Debug, Release] | |
runs-on: windows-2022 | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Build | |
run: dotnet build -c ${{matrix.configuration}} /bl | |
- name: Upload MSBuild binary log | |
uses: actions/upload-artifact@v4 | |
with: | |
name: msbuild_log_${{matrix.configuration}} | |
path: msbuild.binlog | |
if-no-files-found: error | |
# Run unit tests | |
run-tests: | |
if: success() | |
needs: [build-solution] | |
runs-on: windows-2022 | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Run unit tests | |
run: dotnet test -c Release | |
# Build the .msbuildproj projects to generate all the NuGet packages | |
build-packages: | |
if: >- | |
github.event_name == 'push' || | |
github.event.pull_request.user.login != github.repository_owner | |
runs-on: windows-2022 | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Build PolySharp package | |
run: dotnet build src\PolySharp.Package\PolySharp.Package.msbuildproj -c Release | |
- name: Upload package artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nuget_packages | |
path: artifacts\*.nupkg | |
if-no-files-found: error | |
# Download the NuGet packages generated in the previous job and use them | |
# to build and run the sample project referencing them. This is used as | |
# a test to ensure the NuGet packages work in a consuming project. | |
verify-packages: | |
if: success() | |
needs: [build-packages] | |
runs-on: windows-2022 | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Create local NuGet feed | |
run: mkdir artifacts | |
- name: Download package artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: nuget_packages | |
path: artifacts | |
- name: Build PolySharp.NuGet | |
run: dotnet build tests\PolySharp.NuGet\PolySharp.NuGet.csproj -c Release |