unit-test.yml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. ---
  2. name: unit-test
  3. on:
  4. push:
  5. paths:
  6. - 'plugins/**'
  7. - 'resources/**'
  8. - 'cura/**'
  9. - 'icons/**'
  10. - 'tests/**'
  11. - 'packaging/**'
  12. - '.github/workflows/conan-*.yml'
  13. - '.github/workflows/unit-test.yml'
  14. - '.github/workflows/notify.yml'
  15. - '.github/workflows/requirements-conan-package.txt'
  16. - 'requirements*.txt'
  17. - 'conanfile.py'
  18. - 'conandata.yml'
  19. - 'GitVersion.yml'
  20. - '*.jinja'
  21. branches:
  22. - main
  23. - 'CURA-*'
  24. - '[1-9]+.[0-9]+'
  25. tags:
  26. - '[0-9]+.[0-9]+.[0-9]+'
  27. - '[0-9]+.[0-9]+-beta'
  28. pull_request:
  29. paths:
  30. - 'plugins/**'
  31. - 'resources/**'
  32. - 'cura/**'
  33. - 'icons/**'
  34. - 'tests/**'
  35. - 'packaging/**'
  36. - '.github/workflows/conan-*.yml'
  37. - '.github/workflows/unit-test.yml'
  38. - '.github/workflows/notify.yml'
  39. - '.github/workflows/requirements-conan-package.txt'
  40. - 'requirements*.txt'
  41. - 'conanfile.py'
  42. - 'conandata.yml'
  43. - 'GitVersion.yml'
  44. - '*.jinja'
  45. branches:
  46. - main
  47. - '[1-9]+.[0-9]+'
  48. tags:
  49. - '[0-9]+.[0-9]+.[0-9]+'
  50. - '[0-9]+.[0-9]+-beta'
  51. env:
  52. CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
  53. CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
  54. CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
  55. CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
  56. CONAN_LOG_RUN_TO_OUTPUT: 1
  57. CONAN_LOGGING_LEVEL: info
  58. CONAN_NON_INTERACTIVE: 1
  59. permissions:
  60. contents: read
  61. jobs:
  62. conan-recipe-version:
  63. uses: ultimaker/cura/.github/workflows/conan-recipe-version.yml@main
  64. with:
  65. project_name: cura
  66. testing:
  67. runs-on: ubuntu-20.04
  68. needs: [ conan-recipe-version ]
  69. steps:
  70. - name: Checkout
  71. uses: actions/checkout@v3
  72. with:
  73. fetch-depth: 2
  74. - name: Setup Python and pip
  75. uses: actions/setup-python@v4
  76. with:
  77. python-version: '3.10.x'
  78. architecture: 'x64'
  79. cache: 'pip'
  80. cache-dependency-path: .github/workflows/requirements-conan-package.txt
  81. - name: Install Python requirements and Create default Conan profile
  82. run: |
  83. pip install -r requirements-conan-package.txt
  84. conan profile new default --detect
  85. working-directory: .github/workflows/
  86. - name: Use Conan download cache (Bash)
  87. if: ${{ runner.os != 'Windows' }}
  88. run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"
  89. - name: Cache Conan local repository packages (Bash)
  90. uses: actions/cache@v3
  91. if: ${{ runner.os != 'Windows' }}
  92. with:
  93. path: |
  94. $HOME/.conan/data
  95. $HOME/.conan/conan_download_cache
  96. key: conan-${{ runner.os }}-${{ runner.arch }}-unit-cache
  97. - name: Install Linux system requirements
  98. if: ${{ runner.os == 'Linux' }}
  99. run: |
  100. sudo apt update
  101. sudo apt upgrade
  102. 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 pkg-config -y
  103. - name: Use GCC-10 on ubuntu-20.04
  104. run: |
  105. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
  106. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
  107. - name: Get Conan configuration
  108. run: conan config install https://github.com/Ultimaker/conan-config.git
  109. - name: Install dependencies
  110. run: conan install . ${{ needs.conan-recipe-version.outputs.recipe_id_full }} --build=missing --update -o cura:devtools=True -g VirtualPythonEnv -if venv
  111. - name: Upload the Dependency package(s)
  112. run: conan upload "*" -r cura --all -c
  113. - name: Set Environment variables for Cura (bash)
  114. if: ${{ runner.os != 'Windows' }}
  115. run: |
  116. . ./venv/bin/activate_github_actions_env.sh
  117. - name: Run Unit Test
  118. id: run-test
  119. run: |
  120. pytest --junitxml=junit_cura.xml
  121. working-directory: tests
  122. - name: Save PR metadata
  123. if: always()
  124. run: |
  125. echo ${{ github.event.number }} > pr-id.txt
  126. echo ${{ github.event.pull_request.head.repo.full_name }} > pr-head-repo.txt
  127. echo ${{ github.event.pull_request.head.ref }} > pr-head-ref.txt
  128. working-directory: tests
  129. - name: Upload Test Results
  130. if: always()
  131. uses: actions/upload-artifact@v3
  132. with:
  133. name: test-result
  134. path: |
  135. tests/**/*.xml
  136. tests/pr-id.txt
  137. tests/pr-head-repo.txt
  138. tests/pr-head-ref.txt