Build, Test And Create Nuget Package #168
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, Test And Create Nuget Package | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
main: | |
name: ${{ matrix.runtime.name }} | |
runs-on: ${{ matrix.runtime.runs-on }} | |
container: ${{ matrix.runtime.container }} | |
strategy: | |
fail-fast: false | |
matrix: | |
runtime: | |
- name: win-x64 | |
runs-on: windows-latest-xlarge | |
- name: win-x86 | |
runs-on: windows-latest-xlarge | |
- name: linux-x64 | |
runs-on: ubuntu-latest-xlarge | |
container: ubuntu:24.04 | |
- name: linux-arm64 | |
runs-on: ubuntu-latest-xlarge-arm64 | |
container: ubuntu:24.04 | |
- name: linux-musl-x64 | |
runs-on: ubuntu-latest-xlarge | |
container: alpine:3.18 | |
- name: osx-x64 | |
runs-on: macos-latest-large | |
- name: osx-arm64 | |
runs-on: macos-latest-xlarge | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install Build Tools (Linux) | |
if: matrix.runtime.name == 'linux-x64' || matrix.runtime.name == 'linux-arm64' | |
shell: sh | |
run: | | |
apt update --yes | |
apt upgrade --yes | |
# required by actions/setup-dotnet | |
apt install bash wget --yes | |
- name: Install Build Tools (Alpine) | |
if: matrix.runtime.name == 'linux-musl-x64' | |
shell: sh | |
run: | | |
apk update | |
apk upgrade | |
# required by actions/setup-dotnet | |
apk add bash wget | |
# required by dotnet build command | |
apk add libstdc++ libgcc | |
- name: Install Dependencies required for QPDF (Linux) | |
if: matrix.runtime.name == 'linux-x64' || matrix.runtime.name == 'linux-arm64' | |
shell: bash | |
run: apt install libssl-dev gnutls-dev libjpeg-dev --yes | |
- name: Install Dependencies required for QPDF (Linux MUSL) | |
if: matrix.runtime.name == 'linux-musl-x64' | |
run: apk add openssl gnutls libjpeg-turbo | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Build and test solution | |
shell: bash | |
working-directory: ./Source | |
env: | |
TEST_SHOW_RESULTS: false | |
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1 | |
run: | | |
dotnet build --configuration Release --property WarningLevel=0 | |
dotnet test QuestPDF.UnitTests --configuration Release --runtime ${{ matrix.runtime.name }} | |
dotnet test QuestPDF.LayoutTests --configuration Release --runtime ${{ matrix.runtime.name }} | |
dotnet test QuestPDF.Examples --configuration Release --runtime ${{ matrix.runtime.name }} | |
dotnet test QuestPDF.ReportSample --configuration Release --runtime ${{ matrix.runtime.name }} --framework net8.0 | |
dotnet test QuestPDF.ZUGFeRD --configuration Release --runtime ${{ matrix.runtime.name }} --framework net8.0 | |
dotnet build QuestPDF/QuestPDF.csproj --configuration Release --property WarningLevel=0 --property BUILD_PACKAGE=true | |
TEST_EXECUTION_PATH='QuestPDF.ReportSample/bin/Release/net8.0/${{ matrix.runtime.name }}' | |
mkdir -p testOutput/${{ matrix.runtime.name }} | |
cp -r $TEST_EXECUTION_PATH/report.pdf testOutput/${{ matrix.runtime.name }} | |
- name: Upload test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: questpdf-test-results | |
path: | | |
- name: Upload nuget artifacts | |
uses: actions/upload-artifact@v4 | |
if: ${{ matrix.runtime.name == 'win-x64' }} | |
with: | |
name: questpdf-nuget-package | |
path: | | |
**/*.nupkg | |
**/*.snupkg | |
!.nuget | |