Repository navigation
fix: raise BackendVarFormatError for the remaining backend var UI uses #18349
Workflow file for this run
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-tests | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.id || github.sha }} | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| branches: ["main"] | |
| paths-ignore: | |
| - "**/*.md" | |
| pull_request: | |
| branches: ["main"] | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| # This filter cannot live on the pull_request trigger: a workflow that a path | |
| # filter skips never reports its checks at all, so a branch rule requiring | |
| # them blocks the merge forever. Filtered out here, the jobs below skip | |
| # instead, and a skipped job reports as a pass. | |
| changes: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| outputs: | |
| run: ${{ steps.filter.outputs.changed }} | |
| bench: ${{ steps.bench.outputs.changed }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/changed_paths | |
| id: filter | |
| with: | |
| paths-ignore: | | |
| **/*.md | |
| # reflex-bench's tests (a minute and a half of subprocesses, browsers and | |
| # real timeouts) only run in full when it, the example apps it uses as | |
| # fixtures, the example hashing it checks, or its dependencies change. | |
| # Otherwise only its reflex contract test runs (see its conftest.py). | |
| - uses: ./.github/actions/changed_paths | |
| id: bench | |
| with: | |
| paths: | | |
| packages/reflex-bench/** | |
| tests/units/reflex_bench/** | |
| examples/** | |
| scripts/hash_examples.py | |
| uv.lock | |
| .github/workflows/unit_tests.yml | |
| unit-tests: | |
| needs: changes | |
| if: needs.changes.outputs.run == 'true' | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"] | |
| # Coverage is only measured, and its threshold only enforced, on this | |
| # leg: it runs the most code (redis, postgres), and from 3.14 coverage | |
| # measures branches with sys.monitoring. Older interpreters fall back to | |
| # a trace function that made the 3.12 suite about 50% slower, pushing | |
| # those legs into the timeout. | |
| include: | |
| - os: ubuntu-latest | |
| python-version: "3.14" | |
| coverage: true | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| PYTHONUNBUFFERED: 1 | |
| COV: ${{ matrix.coverage && '--cov --no-cov-on-fail --cov-report=' || '' }} | |
| REFLEX_BENCH_UNCHANGED: ${{ needs.changes.outputs.bench != 'true' && '1' || '' }} | |
| # Service containers to run with `runner-job` | |
| services: | |
| # Label used to access the service container | |
| redis: | |
| image: ${{ matrix.os == 'ubuntu-latest' && 'redis' || '' }} | |
| # Set health checks to wait until redis has started | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| # Maps port 6379 on service container to the host | |
| - 6379:6379 | |
| # reflex-workflow is built on Postgres and most of its suite needs a real | |
| # one; without this those tests skip, and the examples are not even | |
| # collected. Sixteen because that is the oldest the engine is reviewed | |
| # against, so a newer server's leniency cannot hide anything. | |
| postgres: | |
| image: ${{ matrix.os == 'ubuntu-latest' && 'postgres:16' || '' }} | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: reflex_workflow | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-tags: true | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - uses: ./.github/actions/setup_build_env | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| run-uv-sync: true | |
| - name: Run unit tests without db dependencies | |
| run: | | |
| uv pip uninstall pydantic alembic sqlalchemy sqlmodel | |
| uv run --no-sync pytest tests/units $COV ${COV:+--cov-fail-under=0} | |
| uv sync | |
| - name: Run unit tests | |
| run: uv run pytest tests/units $COV | |
| - name: Run unit tests w/ redis | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| run: | | |
| export REFLEX_REDIS_URL=redis://localhost:6379 | |
| uv run pytest tests/units $COV | |
| - name: Run unit tests w/ redis and OPLOCK_ENABLED | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| run: | | |
| export REFLEX_REDIS_URL=redis://localhost:6379 | |
| export REFLEX_OPLOCK_ENABLED=true | |
| uv run pytest tests/units $COV | |
| - name: Run workflow unit tests w/ postgres | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| run: | | |
| export REFLEX_TEST_POSTGRES=postgresql://postgres:postgres@localhost:5432/reflex_workflow | |
| # Appended: this runs one package, and every step above replaces the | |
| # coverage data rather than adding to it, so the report that follows | |
| # would otherwise be of this package alone. | |
| uv run pytest tests/units/reflex_workflow $COV ${COV:+--cov-append} | |
| - name: Generate coverage report | |
| if: ${{ matrix.coverage }} | |
| run: uv run coverage html | |
| - name: Upload coverage report | |
| if: ${{ matrix.coverage }} | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: coverage-html | |
| path: coverage_html_report/ | |
| js-unit-tests: | |
| # Tests and packs the frontend package: the javascript reflex-base embeds as | |
| # its web template, which the python suites can only reach through compiled | |
| # output. | |
| needs: changes | |
| if: needs.changes.outputs.run == 'true' | |
| timeout-minutes: 10 | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: packages/reflex-frontend | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: packages/reflex-frontend/package-lock.json | |
| - run: npm ci | |
| - run: npm run lint | |
| - run: npm run typecheck | |
| - run: npm test | |
| # Nothing publishes the tarball yet. Packing it on every change keeps the | |
| # manifest publishable, and the artifact shows what a release would carry. | |
| - run: npm run build | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: reflex-frontend | |
| path: packages/reflex-frontend/*.tgz | |
| if-no-files-found: error | |
| retention-days: 7 | |
| unit-tests-macos: | |
| timeout-minutes: 30 | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"] | |
| runs-on: macos-latest | |
| env: | |
| PYTHONUNBUFFERED: 1 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-tags: true | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - uses: ./.github/actions/setup_build_env | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| run-uv-sync: true | |
| - name: Run unit tests without db dependencies | |
| run: | | |
| uv pip uninstall pydantic alembic sqlalchemy sqlmodel | |
| uv run --no-sync pytest tests/units | |
| uv sync | |
| - name: Run unit tests | |
| run: uv run pytest tests/units | |
| # The one status check the branch rules require from this workflow. Naming the | |
| # jobs above directly does not survive: check names follow the matrix and the | |
| # display names, and a job that a filter skips must not block the merge. | |
| unit-tests-gate: | |
| needs: [changes, unit-tests, js-unit-tests, unit-tests-macos] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/ci_gate | |
| with: | |
| needs: ${{ toJSON(needs) }} |