From 2764b30804868850530bc6edfde764655e874130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20Vo=C3=9F?= Date: Fri, 5 Jan 2024 18:12:12 +0100 Subject: [PATCH] Add pytest for GUI only --- .github/workflows/regression-tests.yml | 43 +++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/.github/workflows/regression-tests.yml b/.github/workflows/regression-tests.yml index 436a280..1e72af5 100644 --- a/.github/workflows/regression-tests.yml +++ b/.github/workflows/regression-tests.yml @@ -71,9 +71,50 @@ jobs: path: ./doc/html if-no-files-found: ignore + Pytest: + runs-on: ubuntu-latest + strategy: + matrix: + # Add multiple Python versions here to run tests on new(er) versions. + python-version: ["3.8"] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Build and install + run: | + python -m pip install --upgrade pip + # Install with -e (in editable mode) to allow the tracking of the test coverage + pip install -e . + - name: Analyse the code with pytest + run: | + # Run the actual testing + pytest -v -k test_gui --cov=modelviewer --cov=loadscompare --junitxml=testresult.xml + # Create some reports + coverage report + coverage xml -o coverage.xml + # Put the html into a 2nd-level sub-folder and use 1st-level subfolder for uploading to maintain folder + coverage html --directory ./coverage/coverage + - name: Upload HTML coverage report as an artifact + uses: actions/upload-artifact@v3 + with: + name: coverage + path: ./coverage + if-no-files-found: ignore + - name: Upload HTML coverage report for pages + # This is not a normal artifact but one that can be deployed to the GitHub pages in the next step + uses: actions/upload-pages-artifact@v3 + with: + name: github-pages # This name may not be changed according to the documentation + path: ./coverage + if-no-files-found: ignore + + deploy-pages: # Add a dependency to the build job - needs: Jupyter + needs: [Jupyter, Pytest] # Grant GITHUB_TOKEN the permissions required to make a Pages deployment permissions: