diff options
author | j.spijker@ultimaker.com <jelle spijker> | 2022-07-07 17:55:02 +0300 |
---|---|---|
committer | jspijker <j.spijker@ultimaker.com> | 2022-07-07 17:55:41 +0300 |
commit | df5446b4c60113277a44054f333ead03ea98d580 (patch) | |
tree | 43adf45e868ef40c80e827392776b65eaa36c430 /.github | |
parent | 55375a22d4065a26d9b24599585fc2f67c7c8a31 (diff) |
Add unit-tests
Contributes to CURA-9365
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/unit-test.yml | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml new file mode 100644 index 0000000000..07d68c3462 --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,136 @@ +--- +name: unit-test +# FIXME: This should be a reusable workflow + +on: + push: + paths: + - 'plugins/**' + - 'resources/**' + - 'cura/**' + - 'icons/**' + - 'tests/**' + - 'packaging/**' + - '.github/workflows/conan-*.yml' + - '.github/workflows/notify.yml' + - '.github/workflows/requirements-conan-package.txt' + - 'requirements*.txt' + - 'conanfile.py' + - 'conandata.yml' + - 'GitVersion.yml' + - '*.jinja' + branches: + - main + - 'CURA-*' + - '[1-9]+.[0-9]+' + tags: + - '[0-9]+.[0-9]+.[0-9]+' + - '[0-9]+.[0-9]+-beta' + pull_request: + paths: + - 'plugins/**' + - 'resources/**' + - 'cura/**' + - 'icons/**' + - 'tests/**' + - 'packaging/**' + - '.github/workflows/conan-*.yml' + - '.github/workflows/notify.yml' + - '.github/workflows/requirements-conan-package.txt' + - 'requirements*.txt' + - 'conanfile.py' + - 'conandata.yml' + - 'GitVersion.yml' + - '*.jinja' + branches: + - main + - '[1-9]+.[0-9]+' + tags: + - '[0-9]+.[0-9]+.[0-9]+' + - '[0-9]+.[0-9]+-beta' + +env: + CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }} + CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }} + CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }} + CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }} + CONAN_LOG_RUN_TO_OUTPUT: 1 + CONAN_LOGGING_LEVEL: info + CONAN_NON_INTERACTIVE: 1 + +jobs: + conan-recipe-version: + uses: ultimaker/cura/.github/workflows/conan-recipe-version.yml@5.1 + with: + project_name: cura + + testing: + runs-on: ubuntu-20.04 + needs: [ conan-recipe-version ] + + steps: + - name: Checkout CuraEngine + uses: actions/checkout@v3 + + - name: Setup Python and pip + uses: actions/setup-python@v4 + with: + python-version: '3.10.x' + architecture: 'x64' + cache: 'pip' + cache-dependency-path: .github/workflows/requirements-conan-package.txt + + - name: Install Python requirements and Create default Conan profile + run: | + pip install -r requirements-conan-package.txt + conan profile new default --detect + working-directory: .github/workflows/ + + - name: Use Conan download cache (Bash) + if: ${{ runner.os != 'Windows' }} + run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache" + + - name: Cache Conan local repository packages (Bash) + uses: actions/cache@v3 + if: ${{ runner.os != 'Windows' }} + with: + path: | + $HOME/.conan/data + $HOME/.conan/conan_download_cache + key: conan-${{ runner.os }}-${{ runner.arch }} + + - name: Install Linux system requirements + if: ${{ runner.os == 'Linux' }} + run: sudo apt install build-essential checkinstall 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 + + - name: Get Conan configuration + run: conan config install https://github.com/Ultimaker/conan-config.git + + - name: Install dependencies + run: conan install . ${{ needs.conan-recipe-version.outputs.recipe_id_full }} -o enable_testing=True -s build_type=Release --build=missing --update -g GitHubActionsRunEnv -g GitHubActionsBuildEnv -g VirtualRunEnv + + - name: Upload the Dependency package(s) + run: conan upload "*" -r cura --all -c + + - name: Set Environment variables for Cura (bash) + if: ${{ runner.os != 'Windows' }} + run: | + . ./cura_inst/bin/activate_github_actions_env.sh + . ./cura_inst/bin/activate_github_actions_version_env.sh + + - name: Run Unit Test + id: run-test + run: | + pytest --junitxml=junit_cura.xml + working-directory: tests + + - name: Publish Unit Test Results + id: test-results + uses: EnricoMi/publish-unit-test-result-action@v1 + if: ${{ always() }} + with: + files: | + tests/*.xml + + - name: Conclusion + run: echo "Conclusion is ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}" |