|
| 1 | +name: Pre-Merge Checks |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + - releases/** |
| 8 | + pull_request: |
| 9 | + types: |
| 10 | + - opened |
| 11 | + - reopened |
| 12 | + - synchronize |
| 13 | + workflow_dispatch: # run on request (no need for PR) |
| 14 | + |
| 15 | +# Declare default permissions as read only. |
| 16 | +permissions: read-all |
| 17 | + |
| 18 | +jobs: |
| 19 | + Code-Quality-Checks: |
| 20 | + # This is what will cancel the job concurrency |
| 21 | + concurrency: |
| 22 | + group: ${{ github.workflow }}-Linting-${{ github.event.pull_request.number || github.ref }} |
| 23 | + cancel-in-progress: true |
| 24 | + runs-on: ubuntu-22.04 |
| 25 | + steps: |
| 26 | + - name: Checkout repository |
| 27 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 28 | + - name: Set up Python |
| 29 | + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 |
| 30 | + with: |
| 31 | + python-version: "3.10" |
| 32 | + - name: Install tox |
| 33 | + run: python -m pip install tox==4.4.6 |
| 34 | + - name: Code quality checks |
| 35 | + run: tox -vv -e pre-commit |
| 36 | + |
| 37 | + Unit-Test: |
| 38 | + runs-on: ubuntu-22.04 |
| 39 | + needs: Code-Quality-Checks |
| 40 | + timeout-minutes: 120 |
| 41 | + strategy: |
| 42 | + fail-fast: false |
| 43 | + matrix: |
| 44 | + include: |
| 45 | + - python-version: "3.10" |
| 46 | + tox-env: "py310" |
| 47 | + - python-version: "3.11.8" |
| 48 | + tox-env: "py311" |
| 49 | + name: Unit-Test-${{ matrix.tox-env }} |
| 50 | + # This is what will cancel the job concurrency |
| 51 | + concurrency: |
| 52 | + group: ${{ github.workflow }}-Unit-${{ github.event.pull_request.number || github.ref }}-${{ matrix.tox-env }} |
| 53 | + cancel-in-progress: true |
| 54 | + steps: |
| 55 | + - name: Checkout repository |
| 56 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 57 | + - name: Install Python |
| 58 | + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 |
| 59 | + with: |
| 60 | + python-version: ${{ matrix.python-version }} |
| 61 | + - name: Install tox |
| 62 | + run: python -m pip install tox==4.4.6 |
| 63 | + - name: Run unit test |
| 64 | + run: tox -vv -e pytest-${{ matrix.tox-env }} -- tests/unit --csv=.tox/pytest-${{ matrix.tox-env }}/unit-test.csv |
| 65 | + --cov=openvino_xai --cov-report term --cov-report xml:.tox/pytest-${{ matrix.tox-env }}/unit-test-coverage.xml |
| 66 | + - name: Upload artifacts |
| 67 | + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 |
| 68 | + with: |
| 69 | + name: unit-test-results-${{ matrix.tox-env }} |
| 70 | + path: | |
| 71 | + .tox/pytest-${{ matrix.tox-env }}/*.csv |
| 72 | + .tox/pytest-${{ matrix.tox-env }}/*.xml |
| 73 | + # Use always() to always run this step to publish test results when there are test failures |
| 74 | + if: ${{ always() }} |
| 75 | + - name: Upload coverage reports to Codecov |
| 76 | + uses: codecov/codecov-action@v3 |
| 77 | + with: |
| 78 | + files: .tox/pytest-${{ matrix.tox-env }}/unit-test-coverage.xml |
| 79 | + flags: pytest-${{ matrix.tox-env }} |
| 80 | + |
| 81 | + Integration-Test: |
| 82 | + runs-on: ubuntu-22.04 |
| 83 | + needs: Unit-Test |
| 84 | + name: Integration-Test |
| 85 | + # This is what will cancel the job concurrency |
| 86 | + concurrency: |
| 87 | + group: ${{ github.workflow }}-Integration-${{ github.event.pull_request.number || github.ref }} |
| 88 | + cancel-in-progress: true |
| 89 | + steps: |
| 90 | + - name: Checkout repository |
| 91 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 92 | + - name: Install Python |
| 93 | + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 |
| 94 | + with: |
| 95 | + python-version: "3.10" |
| 96 | + - name: Install tox |
| 97 | + run: python -m pip install tox==4.4.6 |
| 98 | + - name: Run Integration Test |
| 99 | + run: tox -vv -e pytest-py310 -- tests/integration --csv=.tox/pytest-py310/intg-test.csv |
| 100 | + - name: Upload artifacts |
| 101 | + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 |
| 102 | + with: |
| 103 | + name: intg-test-results |
| 104 | + path: .tox/pytest-py310/*.csv |
| 105 | + # Use always() to always run this step to publish test results when there are test failures |
| 106 | + if: ${{ always() }} |
0 commit comments