ci: more granular test filtering and better testing structure #3
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 | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "sdks/python/**" | |
| - ".github/workflows/unit-python-sdk.yml" | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - "sdks/python/**" | |
| - ".github/workflows/unit-python-sdk.yml" | |
| jobs: | |
| python: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.9" | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: latest | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Load cached venv | |
| id: cached-poetry-dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: python-sdk/.venv | |
| key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
| - name: Install dependencies | |
| if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
| working-directory: sdks/python | |
| run: poetry install --no-interaction --no-root | |
| - name: Install project | |
| working-directory: sdks/python | |
| run: poetry install --no-interaction | |
| - name: Run tests | |
| working-directory: sdks/python | |
| run: poetry run python -m unittest discover tests -v |