main.yml 3.8 KB

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