|
| 1 | +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
| 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 3 | + |
| 4 | +name: build |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + - develop |
| 11 | + pull_request: |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + |
| 16 | + runs-on: ubuntu-latest |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + python-version: ['3.9', '3.10', '3.11', '3.12'] |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v3 |
| 23 | + - name: Set up Python ${{ matrix.python-version }} |
| 24 | + uses: actions/setup-python@v3 |
| 25 | + with: |
| 26 | + python-version: ${{ matrix.python-version }} |
| 27 | + - name: Install dependencies |
| 28 | + run: | |
| 29 | + python -m pip install --upgrade pip setuptools |
| 30 | + pip install -e .[test] # coverage reports need -e to capture properly |
| 31 | + - name: Lint with flake8 |
| 32 | + run: | |
| 33 | + pip install flake8 |
| 34 | + # stop the build if there are Python syntax errors or undefined names |
| 35 | + flake8 pori_python --count --select=E9,F63,F7,F82 --show-source --statistics |
| 36 | + - name: Check with black |
| 37 | + run: | |
| 38 | + pip install black |
| 39 | + black --check -S -l 100 pori_python tests |
| 40 | + - name: Full Tests with pytest |
| 41 | + run: | |
| 42 | + pip list |
| 43 | + pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov pori_python --cov-report term --cov-report xml |
| 44 | + env: |
| 45 | + IPR_USER: ${{ secrets.IPR_TEST_USER }} |
| 46 | + IPR_PASS: ${{ secrets.IPR_TEST_PASSWORD }} |
| 47 | + GRAPHKB_USER: ${{ secrets.GKB_TEST_USER }} |
| 48 | + GRAPHKB_PASS: ${{ secrets.GKB_TEST_PASS }} |
| 49 | + # SDEV-3381 - Turn off integration tests temporarily, till efficiency is increased |
| 50 | + # turn on integration tests for one python version only |
| 51 | + EXCLUDE_INTEGRATION_TESTS: ${{ matrix.python-version != '3.11' }} |
| 52 | + - name: Upload pytest test results |
| 53 | + uses: actions/upload-artifact@master |
| 54 | + with: |
| 55 | + name: pytest-results-${{ matrix.python-version }} |
| 56 | + path: junit/test-results-${{ matrix.python-version }}.xml |
| 57 | + # Use always() to always run this step to publish test results when there are test failures |
| 58 | + if: matrix.python-version == 3.9 |
| 59 | + - name: Update code coverage report to CodeCov |
| 60 | + uses: codecov/codecov-action@v3 |
| 61 | + with: |
| 62 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 63 | + file: ./coverage.xml |
| 64 | + flags: unittests |
| 65 | + env_vars: OS,PYTHON |
| 66 | + name: codecov-umbrella |
| 67 | + fail_ci_if_error: true |
| 68 | + if: matrix.python-version == 3.9 |
0 commit comments