unit-test.yml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. ---
  2. name: unit-test
  3. # FIXME: This should be a reusable workflow
  4. on:
  5. push:
  6. paths:
  7. - 'plugins/**'
  8. - 'resources/**'
  9. - 'cura/**'
  10. - 'icons/**'
  11. - 'tests/**'
  12. - 'packaging/**'
  13. - '.github/workflows/conan-*.yml'
  14. - '.github/workflows/unit-test.yml'
  15. - '.github/workflows/notify.yml'
  16. - '.github/workflows/requirements-conan-package.txt'
  17. - 'requirements*.txt'
  18. - 'conanfile.py'
  19. - 'conandata.yml'
  20. - 'GitVersion.yml'
  21. - '*.jinja'
  22. branches:
  23. - main
  24. - 'CURA-*'
  25. - '[1-9]+.[0-9]+'
  26. tags:
  27. - '[0-9]+.[0-9]+.[0-9]+'
  28. - '[0-9]+.[0-9]+-beta'
  29. pull_request:
  30. paths:
  31. - 'plugins/**'
  32. - 'resources/**'
  33. - 'cura/**'
  34. - 'icons/**'
  35. - 'tests/**'
  36. - 'packaging/**'
  37. - '.github/workflows/conan-*.yml'
  38. - '.github/workflows/unit-test.yml'
  39. - '.github/workflows/notify.yml'
  40. - '.github/workflows/requirements-conan-package.txt'
  41. - 'requirements*.txt'
  42. - 'conanfile.py'
  43. - 'conandata.yml'
  44. - 'GitVersion.yml'
  45. - '*.jinja'
  46. branches:
  47. - main
  48. - '[1-9]+.[0-9]+'
  49. tags:
  50. - '[0-9]+.[0-9]+.[0-9]+'
  51. - '[0-9]+.[0-9]+-beta'
  52. env:
  53. CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
  54. CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
  55. CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
  56. CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
  57. CONAN_LOG_RUN_TO_OUTPUT: 1
  58. CONAN_LOGGING_LEVEL: info
  59. CONAN_NON_INTERACTIVE: 1
  60. jobs:
  61. conan-recipe-version:
  62. uses: ultimaker/cura/.github/workflows/conan-recipe-version.yml@main
  63. with:
  64. project_name: cura
  65. testing:
  66. runs-on: ubuntu-20.04
  67. needs: [ conan-recipe-version ]
  68. steps:
  69. - name: Checkout
  70. uses: actions/checkout@v3
  71. - name: Setup Python and pip
  72. uses: actions/setup-python@v4
  73. with:
  74. python-version: '3.10.x'
  75. architecture: 'x64'
  76. cache: 'pip'
  77. cache-dependency-path: .github/workflows/requirements-conan-package.txt
  78. - name: Install Python requirements and Create default Conan profile
  79. run: |
  80. pip install -r requirements-conan-package.txt
  81. conan profile new default --detect
  82. working-directory: .github/workflows/
  83. - name: Use Conan download cache (Bash)
  84. if: ${{ runner.os != 'Windows' }}
  85. run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"
  86. - name: Cache Conan local repository packages (Bash)
  87. uses: actions/cache@v3
  88. if: ${{ runner.os != 'Windows' }}
  89. with:
  90. path: |
  91. $HOME/.conan/data
  92. $HOME/.conan/conan_download_cache
  93. key: conan-${{ runner.os }}-${{ runner.arch }}-unit-cache
  94. - name: Install Linux system requirements
  95. if: ${{ runner.os == 'Linux' }}
  96. run: sudo apt install build-essential checkinstall libegl-dev zlib1g-dev libssl-dev ninja-build autoconf libx11-dev libx11-xcb-dev libfontenc-dev libice-dev libsm-dev libxau-dev libxaw7-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxrender-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev libxxf86vm-dev xtrans-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-xkb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev xkb-data libxcb-dri3-dev uuid-dev libxcb-util-dev libxkbcommon-x11-dev -y
  97. - name: Get Conan configuration
  98. run: conan config install https://github.com/Ultimaker/conan-config.git
  99. - name: Install dependencies
  100. run: conan install . ${{ needs.conan-recipe-version.outputs.recipe_id_full }} --build=missing --update -o cura:devtools=True -g VirtualPythonEnv -if venv
  101. - name: Upload the Dependency package(s)
  102. run: conan upload "*" -r cura --all -c
  103. - name: Set Environment variables for Cura (bash)
  104. if: ${{ runner.os != 'Windows' }}
  105. run: |
  106. . ./venv/bin/activate_github_actions_env.sh
  107. - name: Run Unit Test
  108. id: run-test
  109. run: |
  110. pytest --junitxml=junit_cura.xml
  111. working-directory: tests
  112. - name: Upload Test Results
  113. if: always()
  114. uses: actions/upload-artifact@v3
  115. with:
  116. name: Test Results
  117. path: "tests/**/*.xml"
  118. publish-test-results:
  119. runs-on: ubuntu-20.04
  120. needs: [ testing ]
  121. if: success() || failure()
  122. steps:
  123. - name: Checkout
  124. uses: actions/checkout@v3
  125. - name: Setup Python and pip
  126. uses: actions/setup-python@v4
  127. with:
  128. python-version: '3.10.x'
  129. architecture: 'x64'
  130. cache: 'pip'
  131. cache-dependency-path: .github/workflows/requirements-conan-package.txt
  132. - name: Download Artifacts
  133. uses: actions/download-artifact@v3
  134. with:
  135. path: artifacts
  136. - name: Publish Unit Test Results
  137. id: test-results
  138. uses: EnricoMi/publish-unit-test-result-action@v1
  139. with:
  140. files: "artifacts/**/*.xml"
  141. - name: Conclusion
  142. run: echo "Conclusion is ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}"