Repository navigation
Fix on-disk storage robustness and other pre-release review findings … #280
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, main] | |
| pull_request: | |
| branches: [develop, main] | |
| workflow_dispatch: | |
| defaults: | |
| run: | |
| working-directory: . | |
| jobs: | |
| python: | |
| name: Python ${{ matrix.python-version }} (pytest) | |
| runs-on: ubuntu-latest | |
| env: | |
| # Fail rather than skip if DataLab-Capsule or the contracts are missing. | |
| DLW_REQUIRE_PROVENANCE: "1" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| cache-dependency-path: | | |
| requirements-dev.txt | |
| sigima-dependency.json | |
| guidata-dependency.json | |
| datalab-capsule-dependency.json | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python scripts/sigima_dependency.py install | |
| python scripts/capsule_dependency.py install | |
| - name: Run pytest with coverage | |
| run: | | |
| python -m pytest tests/python \ | |
| --cov=src/runtime \ | |
| --cov-report=xml:coverage-python.xml \ | |
| --cov-report=term | |
| - name: Upload Python coverage artifact | |
| if: matrix.python-version == '3.12' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: coverage-python | |
| path: coverage-python.xml | |
| typescript: | |
| name: TypeScript (Vitest) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: "24" | |
| cache: npm | |
| - name: Install npm dependencies | |
| run: npm ci | |
| - name: Prettier check | |
| run: npm run format:check | |
| - name: Lint | |
| run: npm run lint | |
| - name: i18n catalog check | |
| run: npm run i18n:check | |
| - name: Run Vitest with coverage | |
| run: npm run test:cov | |
| - name: Upload TypeScript coverage artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: coverage-typescript | |
| path: coverage-ts/ | |
| e2e: | |
| # The suite is split into balanced shards running in parallel: nearly | |
| # all its time is spent booting Pyodide in fresh browser contexts, so a | |
| # single serial job takes 15 to 40+ minutes depending on the runner. | |
| # Each shard keeps the exact serial conditions (``workers: 1``); see | |
| # ``scripts/e2e-shards.mjs`` and ``doc/testing-strategy.md``. | |
| name: End-to-end (Playwright ${{ matrix.shard }}/${{ strategy.job-total }}) | |
| runs-on: ubuntu-latest | |
| env: | |
| DLW_REQUIRE_PROVENANCE: "1" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3, 4] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Report runner hardware | |
| run: | | |
| echo "vCPUs: $(nproc)" | |
| lscpu | grep -E '^(Model name|Thread\(s\) per core|Core\(s\) per socket|Socket\(s\))' || true | |
| free -h | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: "24" | |
| cache: npm | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.12" | |
| - name: Install npm dependencies | |
| run: npm ci | |
| - name: Select the spec files of this shard | |
| run: >- | |
| node scripts/e2e-shards.mjs plan | |
| --shard ${{ matrix.shard }}/${{ strategy.job-total }} | |
| --output "$RUNNER_TEMP/e2e-specs.txt" | |
| - name: Prepare configured Sigima and guidata dependencies | |
| run: >- | |
| python scripts/sigima_dependency.py prepare-pyodide | |
| --wheel-dir .wheels | |
| --github-env "$GITHUB_ENV" | |
| - name: Prepare configured DataLab-Capsule dependency | |
| run: >- | |
| python scripts/capsule_dependency.py prepare-pyodide | |
| --wheel-dir .wheels | |
| --github-env "$GITHUB_ENV" | |
| - name: Install the DataLab-Capsule registry (optional feature, tested) | |
| run: | | |
| python -m pip install "$(ls .wheels/datalab_capsule-*.whl)[registry]" | |
| echo "DLW_REGISTRY_PYTHON=$(command -v python)" >> "$GITHUB_ENV" | |
| echo "DLW_REQUIRE_REGISTRY=1" >> "$GITHUB_ENV" | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps chromium | |
| - name: Run Playwright tests | |
| env: | |
| PLAYWRIGHT_BLOB_OUTPUT_NAME: report-${{ matrix.shard }}.zip | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: e2e-results/results-${{ matrix.shard }}.json | |
| run: | | |
| mapfile -t specs < "$RUNNER_TEMP/e2e-specs.txt" | |
| npm run test:e2e -- --reporter=github,blob,json "${specs[@]}" | |
| - name: Upload shard reports | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: e2e-shard-${{ matrix.shard }} | |
| path: | | |
| blob-report/ | |
| e2e-results/ | |
| retention-days: 1 | |
| e2e-report: | |
| name: End-to-end (Playwright report) | |
| needs: e2e | |
| if: ${{ !cancelled() }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: "24" | |
| cache: npm | |
| - name: Install npm dependencies | |
| run: npm ci | |
| - name: Download shard reports | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: e2e-shard-* | |
| path: e2e-shards | |
| merge-multiple: true | |
| - name: Merge Playwright reports | |
| run: npx playwright merge-reports --reporter=html ./e2e-shards/blob-report | |
| - name: Upload Playwright report | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 7 | |
| - name: Measure spec durations for shard balancing | |
| run: >- | |
| node scripts/e2e-shards.mjs timings e2e-shards/e2e-results/*.json | |
| --output e2e-shard-timings.json | |
| - name: Upload measured spec durations | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: e2e-shard-timings | |
| path: e2e-shard-timings.json | |
| retention-days: 30 |