unit-test #191
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: unit-test | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [next, qa, main] | |
| tags: ['v*'] | |
| pull_request: | |
| # Run on pull requests targeting any base branch | |
| schedule: | |
| # daily cron job at UTC+6 == EST+1 | |
| - cron: '0 6 * * *' | |
| jobs: | |
| linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - uses: prefix-dev/setup-pixi@v0.9.3 | |
| with: | |
| pixi-version: v0.41.4 | |
| manifest-path: pyproject.toml | |
| - name: Apt install deps | |
| run: | | |
| sudo apt update | |
| sudo apt-get install xvfb freeglut3-dev libglu1-mesa | |
| - name: Start xvfb daemon | |
| run: | | |
| /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16 | |
| - name: Mantid pre-requisites - create a properties file that turns off network access | |
| run: | | |
| mkdir ~/.mantid | |
| echo "CheckMantidVersion.OnStartup=0" > ~/.mantid/Mantid.user.properties | |
| echo "UpdateInstrumentDefinitions.OnStartup=0" >> ~/.mantid/Mantid.user.properties | |
| echo "usagereports.enabled=0" >> ~/.mantid/Mantid.user.properties | |
| - name: Test framework imports | |
| run: pixi run test-import-framework | |
| - name: run unit tests | |
| run: | | |
| echo "running unit tests" | |
| xvfb-run --server-args="-screen 0 1280x1024x16" -a pixi run test | |
| - name: List coverage files (debug) | |
| run: | | |
| echo "Coverage files generated:" | |
| ls -la coverage.xml || echo "No coverage.xml found" | |
| ls -la .coverage || echo "No .coverage found" | |
| - name: upload coverage to codecov | |
| uses: codecov/codecov-action@v5 | |
| if: github.actor != 'dependabot[bot]' | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| verbose: true | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - uses: prefix-dev/setup-pixi@v0.9.3 | |
| with: | |
| pixi-version: v0.41.4 | |
| manifest-path: pyproject.toml | |
| - name: flake8 | |
| run: pixi run lint-flake8 | |
| - name: mypy | |
| run: pixi run mypy pyrs scripts tests |