|
| 1 | +# Extended testing using Python 3.9, 3.10, 3.11 & 3.12 INCLUDING integration tests |
| 2 | +# Triggered by a pull request to main branch created |
| 3 | +# Triggered by a pull request to main branch updated by a new commit |
| 4 | +# Triggered by a pull request to main branch converted from drat to regular (non-draft) |
| 5 | +# EXCEPTION for draft pull request: EXCLUDING integration tests, upload test results & code cov. |
| 6 | + |
| 7 | +name: extended-tests-integration |
| 8 | + |
| 9 | +on: |
| 10 | + pull_request: |
| 11 | + branches: [main] |
| 12 | + types: [opened, synchronize, ready_for_review] |
| 13 | + |
| 14 | +jobs: |
| 15 | + |
| 16 | + extended-tests-integration: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + python-version: ['3.9', '3.10', '3.11', '3.12'] |
| 21 | + steps: |
| 22 | + - name: Checkout repository |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Set up Python ${{ matrix.python-version }} |
| 26 | + uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: ${{ matrix.python-version }} |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + python -m pip install --upgrade pip setuptools |
| 33 | + pip install -e .[test] # coverage reports need -e to capture properly |
| 34 | +
|
| 35 | + - name: Lint with flake8 |
| 36 | + run: | |
| 37 | + pip install flake8 |
| 38 | + # stop the build if there are Python syntax errors or undefined names |
| 39 | + flake8 pori_python --count --select=E9,F63,F7,F82 --show-source --statistics |
| 40 | +
|
| 41 | + - name: Check with black |
| 42 | + run: | |
| 43 | + pip install black |
| 44 | + black --check -S -l 100 pori_python tests |
| 45 | +
|
| 46 | + - name: Tests with pytest, including integration tests |
| 47 | + if: ${{ github.event.pull_request.draft == true }} |
| 48 | + run: | |
| 49 | + pip list |
| 50 | + pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov pori_python --cov-report term --cov-report xml |
| 51 | + env: |
| 52 | + IPR_USER: ${{ secrets.IPR_TEST_USER }} |
| 53 | + IPR_PASS: ${{ secrets.IPR_TEST_PASSWORD }} |
| 54 | + GRAPHKB_USER: ${{ secrets.GKB_TEST_USER }} |
| 55 | + GRAPHKB_PASS: ${{ secrets.GKB_TEST_PASS }} |
| 56 | + EXCLUDE_INTEGRATION_TESTS: 1 |
| 57 | + |
| 58 | + - name: Tests with pytest, including integration tests |
| 59 | + if: ${{ github.event.pull_request.draft == false }} |
| 60 | + run: | |
| 61 | + pip list |
| 62 | + pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov pori_python --cov-report term --cov-report xml |
| 63 | + env: |
| 64 | + IPR_USER: ${{ secrets.IPR_TEST_USER }} |
| 65 | + IPR_PASS: ${{ secrets.IPR_TEST_PASSWORD }} |
| 66 | + GRAPHKB_USER: ${{ secrets.GKB_TEST_USER }} |
| 67 | + GRAPHKB_PASS: ${{ secrets.GKB_TEST_PASS }} |
| 68 | + EXCLUDE_INTEGRATION_TESTS: 0 |
| 69 | + |
| 70 | + - name: Upload pytest test results |
| 71 | + if: ${{ ( |
| 72 | + github.event.pull_request.draft == false && |
| 73 | + matrix.python-version == '3.9' |
| 74 | + ) }} |
| 75 | + uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: pytest-results-${{ matrix.python-version }} |
| 78 | + path: junit/test-results-${{ matrix.python-version }}.xml |
| 79 | + # Use always() to always run this step to publish test results when there are test failures |
| 80 | + |
| 81 | + - name: Update code coverage report to CodeCov |
| 82 | + if: ${{ ( |
| 83 | + github.event.pull_request.draft == false && |
| 84 | + matrix.python-version == '3.9' |
| 85 | + ) }} |
| 86 | + uses: codecov/codecov-action@v5 |
| 87 | + with: |
| 88 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 89 | + file: ./coverage.xml |
| 90 | + flags: unittests |
| 91 | + env_vars: OS,PYTHON |
| 92 | + name: codecov-umbrella |
| 93 | + fail_ci_if_error: true |
0 commit comments