main.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. name: Build, Test And Create Nuget Package
  2. on:
  3. push:
  4. branches: [ main ]
  5. workflow_dispatch:
  6. jobs:
  7. main:
  8. name: ${{ matrix.runtime.name }}
  9. runs-on: ${{ matrix.runtime.runs-on }}
  10. container: ${{ matrix.runtime.container }}
  11. strategy:
  12. fail-fast: false
  13. matrix:
  14. runtime:
  15. - name: win-x64
  16. runs-on: windows-latest-xlarge
  17. - name: win-x86
  18. runs-on: windows-latest-xlarge
  19. - name: linux-x64
  20. runs-on: ubuntu-latest-xlarge
  21. container: ubuntu:24.04
  22. - name: linux-arm64
  23. runs-on: ubuntu-latest-xlarge-arm64
  24. container: ubuntu:24.04
  25. - name: linux-musl-x64
  26. runs-on: ubuntu-latest-xlarge
  27. container: alpine:3.18
  28. - name: osx-x64
  29. runs-on: macos-latest-large
  30. - name: osx-arm64
  31. runs-on: macos-latest-xlarge
  32. steps:
  33. - name: Checkout sources
  34. uses: actions/checkout@v4
  35. - name: Install Build Tools (Linux)
  36. if: matrix.runtime.name == 'linux-x64' || matrix.runtime.name == 'linux-arm64'
  37. shell: sh
  38. run: |
  39. apt update --yes
  40. apt upgrade --yes
  41. # required by actions/setup-dotnet
  42. apt install bash wget --yes
  43. - name: Install Build Tools (Alpine)
  44. if: matrix.runtime.name == 'linux-musl-x64'
  45. shell: sh
  46. run: |
  47. apk update
  48. apk upgrade
  49. # required by actions/setup-dotnet
  50. apk add bash wget
  51. # required by dotnet build command
  52. apk add libstdc++ libgcc
  53. - name: Install Dependencies required for QPDF (Linux)
  54. if: matrix.runtime.name == 'linux-x64' || matrix.runtime.name == 'linux-arm64'
  55. shell: bash
  56. run: apt install libssl-dev gnutls-dev libjpeg-dev --yes
  57. - name: Install Dependencies required for QPDF (Linux MUSL)
  58. if: matrix.runtime.name == 'linux-musl-x64'
  59. run: apk add openssl gnutls libjpeg-turbo
  60. - name: Setup dotnet
  61. uses: actions/setup-dotnet@v3
  62. with:
  63. dotnet-version: '8.0.x'
  64. - name: Build and test solution
  65. shell: bash
  66. working-directory: ./Source
  67. env:
  68. TEST_SHOW_RESULTS: false
  69. DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1
  70. run: |
  71. dotnet build --configuration Release --property WarningLevel=0
  72. dotnet test QuestPDF.UnitTests --configuration Release --runtime ${{ matrix.runtime.name }}
  73. dotnet test QuestPDF.LayoutTests --configuration Release --runtime ${{ matrix.runtime.name }}
  74. dotnet test QuestPDF.Examples --configuration Release --runtime ${{ matrix.runtime.name }}
  75. dotnet test QuestPDF.ReportSample --configuration Release --runtime ${{ matrix.runtime.name }} --framework net8.0
  76. dotnet test QuestPDF.ZUGFeRD --configuration Release --runtime ${{ matrix.runtime.name }} --framework net8.0
  77. dotnet build QuestPDF/QuestPDF.csproj --configuration Release --property WarningLevel=0 --property BUILD_PACKAGE=true
  78. TEST_EXECUTION_PATH='QuestPDF.ReportSample/bin/Release/net8.0/${{ matrix.runtime.name }}'
  79. mkdir -p testOutput/${{ matrix.runtime.name }}
  80. cp -r $TEST_EXECUTION_PATH/report.pdf testOutput/${{ matrix.runtime.name }}
  81. - name: Upload test results
  82. uses: actions/upload-artifact@v3
  83. with:
  84. name: questpdf-test-results
  85. path: |
  86. **/*.pdf
  87. - name: Upload nuget artifacts
  88. uses: actions/upload-artifact@v4
  89. if: ${{ matrix.runtime.name == 'win-x64' }}
  90. with:
  91. name: questpdf-nuget-package
  92. path: |
  93. **/*.nupkg
  94. **/*.snupkg
  95. !.nuget