Fix the last of the nullability annotation issues #105
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 Core | |
on: | |
push: | |
pull_request: | |
release: # for now, github won't let us listen to created/draft, only published | |
env: | |
CORE_SLN: ./src/Imageflow.dncore.sln | |
FULL_SLN: ./src/Imageflow.dnfull.sln | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: macos-11.0 | |
- os: ubuntu-latest | |
test-aot: true | |
- os: windows-latest | |
pack: true | |
docs: true | |
coverage: true | |
runs-on: ${{matrix.os}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6 | |
7 | |
8 | |
- uses: nowsprinting/[email protected] | |
id: version | |
with: | |
prefix: 'v' | |
- name: For releases only - set TAGGED_VERSION and ARTIFACT_VERSION | |
run: | | |
echo "TAGGED_VERSION=${{ steps.version.outputs.full_without_prefix }}" >> $GITHUB_ENV | |
echo "ARTIFACT_VERSION=${{ steps.version.outputs.full_without_prefix }}" >> $GITHUB_ENV | |
echo Set version to ${{ steps.version.outputs.full_without_prefix }} | |
shell: bash | |
if: steps.version.outputs.is_valid == 'true' && github.event_name == 'release' | |
- name: Set ARTIFACT_VERSION to commit-${{ github.sha }} for non-release builds | |
run: | | |
echo "ARTIFACT_VERSION=commit-${{ github.sha }}" >> $GITHUB_ENV | |
echo Set ARTIFACT_VERSION to commit-${{ github.sha }} | |
shell: bash | |
if: steps.version.outputs.is_valid == 'false' || github.event_name != 'release' | |
- run: | | |
dotnet clean ${{ env.CORE_SLN }} --configuration Release | |
dotnet nuget locals all --clear | |
if: github.event_name == 'release' | |
- name: Install dependencies | |
run: dotnet restore ${{ env.CORE_SLN }} --force-evaluate | |
- name: Build all modern dotnet projects | |
run: dotnet build ${{ env.CORE_SLN }} --maxcpucount:1 -c Release | |
- name: Test, relying on projects to only conditionally enable net48 TFMs on windows | |
run: | | |
dotnet test ${{ env.CORE_SLN }} -c Release | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: TestResults-${{matrix.os}}-${{ env.ARTIFACT_VERSION }} | |
path: TestResults/ | |
# - name: Test .NET 8, 6, and 4.8.1 with Coverage | |
# if: matrix.os == 'windows-latest' | |
# run: | | |
# dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/coverage.net48.opencover.xml --framework net48 | |
# dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/coverage.net6.opencover.xml --framework net6.0 | |
# dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/coverage.net8.opencover.xml --framework net8.0 | |
# - name: Upload coverage to Codecov | |
# uses: codecov/codecov-action@v3 | |
# if: matrix.os == 'windows-latest' | |
# with: | |
# files: ./TestResults/coverage.**.opencover.xml | |
# token: ${{ secrets.CODECOV_TOKEN }} # replace with your Codecov token | |
# fail_ci_if_error: false | |
# - uses: actions/upload-artifact@v3 | |
# if: failure() | |
# with: | |
# name: TestResults-${{matrix.os}}-${{ env.ARTIFACT_VERSION }} | |
# path: TestResults/ | |
- name: Pack | |
run: | | |
dotnet pack ./src/Imageflow/Imageflow.Net.csproj -c Release --include-source -o NuGetPackages/Release/ | |
dotnet pack ./src/Imageflow.AllPlatforms/Imageflow.AllPlatforms.csproj -c Release --include-source -o NuGetPackages/Release/ | |
if: matrix.pack | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
id: nuget-artifact-upload-step | |
if: matrix.pack | |
with: | |
name: NuGetPackages | |
path: NuGetPackages/Release/*.nupkg | |
- name: Add msbuild to PATH | |
uses: microsoft/[email protected] | |
- name: Build legacy projects on Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
nuget restore tests/Imageflow.TestDotNetFull/Imageflow.TestDotNetFull.csproj -SolutionDirectory src | |
nuget restore tests/Imageflow.TestDotNetFullPackageReference/Imageflow.TestDotNetFullPackageReference.csproj -SolutionDirectory src | |
msbuild src/Imageflow.dnfull.sln /p:Configuration=Release /p:Platform="Any CPU" | |
- name: Test legacy projects on Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
vstest.console tests\Imageflow.TestDotNetFull\bin\Release\Imageflow.TestDotNetFull.dll | |
vstest.console /Platform:x86 tests\Imageflow.TestDotNetFull\bin\Release\Imageflow.TestDotNetFull.dll | |
vstest.console /Platform:x64 tests\Imageflow.TestDotNetFull\bin\Release\Imageflow.TestDotNetFull.dll | |
vstest.console tests\Imageflow.TestDotNetFullPackageReference\bin\Release\Imageflow.TestDotNetFullPackageReference.dll | |
vstest.console /Platform:x86 tests\Imageflow.TestDotNetFullPackageReference\bin\Release\Imageflow.TestDotNetFullPackageReference.dll | |
vstest.console /Platform:x64 tests\Imageflow.TestDotNetFullPackageReference\bin\Release\Imageflow.TestDotNetFullPackageReference.dll | |
- name: Test use in an AOT web app | |
if: matrix.test-aot | |
run: ./tests/Imageflow.TestAOT/test.ps1 | |
publish: | |
needs: build | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: nowsprinting/check-version-format-action@v3 | |
id: version | |
with: | |
prefix: 'v' | |
# Download nuget artifacts from the test job into a folder called NuGetPackages | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
if: steps.version.outputs.is_valid == 'true' && github.event_name == 'release' | |
with: | |
name: NuGetPackages | |
path: NuGetPackages | |
- name: Publish NuGet packages to Nuget.org | |
if: steps.version.outputs.is_valid == 'true' && github.event_name == 'release' | |
run: | | |
dotnet nuget push NuGetPackages/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source nuget.org |