Bump version #219
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: Tests | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| pull_request: | |
| branches-ignore: | |
| - master | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| DEFAULT_PYTHON: '3.13' | |
| MIN_COVERAGE: 94 | |
| permissions: | |
| contents: write | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| tests: | |
| name: Run tests (Python ${{ matrix.python-version }}, Pydantic ${{ matrix.pydantic-version }}, ${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - python-version: '3.7' | |
| pydantic-version: '1' | |
| os: ubuntu-22.04 | |
| - python-version: '3.13' | |
| pydantic-version: '2' | |
| os: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Start Backend Container | |
| run: | | |
| docker compose down -v --remove-orphans | |
| docker compose up --wait-timeout 60 -d | |
| env: | |
| COMPOSE_PROJECT_NAME: ${{ github.run_id }}-backend | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-python-${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version}}-tests-${{ hashFiles('requirements*.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-python-${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version}}-tests-${{ hashFiles('requirements*.txt') }} | |
| ${{ runner.os }}-python-${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version}}-tests- | |
| ${{ runner.os }}-python- | |
| - name: Upgrade pip | |
| run: python -m pip install --upgrade pip setuptools wheel | |
| - name: Install dependencies | |
| run: pip install -I -r requirements.txt -r requirements-test.txt "pydantic==${{ matrix.pydantic-version }}.*" | |
| - name: Build package | |
| run: | | |
| python setup.py --version | |
| python setup.py bdist_wheel sdist | |
| - name: Run tests | |
| run: | | |
| mkdir reports/ || echo "Directory exists" | |
| # required to register package in etl-entities | |
| pip install -e . --no-build-isolation | |
| source .env.local | |
| ./run_tests.sh | |
| - name: Upload coverage results | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: coverage-python-${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version }}-os-${{ matrix.os }} | |
| path: reports/* | |
| # https://github.com/actions/upload-artifact/issues/602 | |
| include-hidden-files: true | |
| - name: Shutdown Backend Container | |
| if: always() | |
| run: | | |
| docker compose down -v --remove-orphans | |
| env: | |
| COMPOSE_PROJECT_NAME: ${{ github.run_id }}-backend | |
| all_done: | |
| name: Tests done | |
| runs-on: ubuntu-latest | |
| needs: [tests] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Python ${{ env.DEFAULT_PYTHON }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.DEFAULT_PYTHON }} | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-coverage-${{ hashFiles('requirements*.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-coverage-${{ hashFiles('requirements*.txt') }} | |
| ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-coverage- | |
| ${{ runner.os }}-python | |
| ${{ runner.os }}- | |
| - name: Upgrade pip | |
| run: python -m pip install --upgrade pip setuptools wheel | |
| - name: Install dependencies | |
| run: pip install -I -r requirements-test.txt | |
| - name: Download all coverage reports | |
| uses: actions/download-artifact@v6 | |
| with: | |
| path: reports/ | |
| pattern: coverage-* | |
| merge-multiple: true | |
| - name: Generate coverate reports | |
| run: ./combine_coverage.sh | |
| - name: Coverage comment | |
| id: coverage | |
| uses: MishaKav/pytest-coverage-comment@v1 | |
| with: | |
| pytest-xml-coverage-path: ./reports/coverage.xml | |
| default-branch: develop | |
| xml-skip-covered: true | |
| report-only-changed-files: true | |
| hide-comment: ${{ github.event_name != 'pull_request' }} | |
| - name: Dynamic Badges | |
| uses: schneegans/dynamic-badges-action@v1.7.0 | |
| if: github.repository == 'MobileTeleSystems/horizon-hwm-store' && github.event_name == 'push' | |
| with: | |
| auth: ${{ secrets.AUTOMERGE_TOKEN }} | |
| gistID: 03e73a82ecc4709934540ce8201cc3b4 | |
| filename: horizon-hwm-store_badge.json | |
| label: Coverage | |
| message: ${{ steps.coverage.outputs.coverage }} | |
| color: ${{ steps.coverage.outputs.color }} | |
| - name: Fail if coverage too low | |
| if: ${{ steps.coverage.outputs.coverage < env.MIN_COVERAGE }} | |
| run: | | |
| echo "Coverage is below ${{ env.MIN_COVERAGE }}%!" | |
| exit 1 | |
| - name: All done | |
| run: echo 1 |