| # Python unit tests |
| name: Python-Unit |
| |
| on: |
| push: |
| branches: |
| - "master" |
| - "[0-9].[0-9]*" |
| pull_request: |
| types: [synchronize, opened, reopened, ready_for_review] |
| |
| # cancel previous workflow jobs for PRs |
| concurrency: |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} |
| cancel-in-progress: true |
| |
| jobs: |
| unit-tests: |
| runs-on: ubuntu-24.04 |
| strategy: |
| matrix: |
| python-version: ["previous", "current", "next"] |
| env: |
| PYTHONPATH: ${{ github.workspace }} |
| steps: |
| - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" |
| uses: actions/checkout@v5 |
| with: |
| persist-credentials: false |
| submodules: recursive |
| - name: Check for file changes |
| id: check |
| uses: ./.github/actions/change-detector/ |
| with: |
| token: ${{ secrets.GITHUB_TOKEN }} |
| - name: Setup Python |
| uses: ./.github/actions/setup-backend/ |
| if: steps.check.outputs.python |
| with: |
| python-version: ${{ matrix.python-version }} |
| - name: Python unit tests |
| if: steps.check.outputs.python |
| env: |
| SUPERSET_TESTENV: true |
| SUPERSET_SECRET_KEY: not-a-secret |
| run: | |
| pytest --durations-min=0.5 --cov-report= --cov=superset ./tests/common ./tests/unit_tests --cache-clear --maxfail=50 |
| - name: Python 100% coverage unit tests |
| if: steps.check.outputs.python |
| env: |
| SUPERSET_TESTENV: true |
| SUPERSET_SECRET_KEY: not-a-secret |
| run: | |
| pytest --durations-min=0.5 --cov=superset/sql/ ./tests/unit_tests/sql/ --cache-clear --cov-fail-under=100 |
| - name: Upload code coverage |
| uses: codecov/codecov-action@v5 |
| with: |
| flags: python,unit |
| token: ${{ secrets.CODECOV_TOKEN }} |
| verbose: true |