diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6cf0fb4ac90c..d773fcf2931b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -381,7 +381,7 @@ jobs: with: path: ~/.cache/uv key: uv-cache-${{ runner.os }}-py-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('pyproject.toml') }} - + - name: Download requirements.txt uses: actions/cache@v4 with: @@ -423,13 +423,6 @@ jobs: runs-on: ubuntu-latest strategy: fail-fast: false - matrix: - shard: [ - 1, 2, 3, 4, - 5, 6, 7, 8, - 9, 10, 11, 12, - 13, 14, 15, 16, - ] steps: - uses: actions/checkout@v4 @@ -464,7 +457,7 @@ jobs: with: path: ~/.cache/uv key: uv-cache-${{ runner.os }}-py-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('pyproject.toml') }} - + - name: Download requirements.txt uses: actions/cache@v4 with: @@ -591,305 +584,8 @@ jobs: - name: Test env: - SHARD: ${{ matrix.shard }} EDGEDB_TEST_REPEATS: 1 + EDGEDB_DEBUG_SERVER: 1 run: | mkdir -p results/ - cp shared-artifacts/time_stats.csv results/running_times_${SHARD}.csv - edb test --jobs 2 --verbose --shard ${SHARD}/16 \ - --running-times-log=results/running_times_${SHARD}.csv \ - --result-log=results/result_${SHARD}.json - - - name: Upload test results - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - if: ${{ always() }} - with: - name: python-test-results-${{ matrix.shard }} - path: results - retention-days: 1 - - python-test-list: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: false - - - uses: actions/checkout@v4 - with: - fetch-depth: 50 - submodules: true - - - name: Set up Python - uses: actions/setup-python@v5 - id: setup-python - with: - python-version: '3.12.2' - cache: 'pip' - cache-dependency-path: | - pyproject.toml - - # The below is technically a lie as we are technically not - # inside a virtual env, but there is really no reason to bother - # actually creating and activating one as below works just fine. - - name: Export $VIRTUAL_ENV - run: | - venv="$(python -c 'import sys; sys.stdout.write(sys.prefix)')" - echo "VIRTUAL_ENV=${venv}" >> $GITHUB_ENV - - - name: Set up uv cache - uses: actions/cache@v4 - with: - path: ~/.cache/uv - key: uv-cache-${{ runner.os }}-py-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('pyproject.toml') }} - - - name: Download requirements.txt - uses: actions/cache@v4 - with: - path: requirements.txt - key: edb-requirements-${{ hashFiles('pyproject.toml') }} - - - name: Install Python dependencies - run: python -m pip install uv~=0.1.0 && uv pip install -U -r requirements.txt - - # Restore the artifacts and environment variables - - - name: Download shared artifacts - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: shared-artifacts - path: shared-artifacts - - - name: Set environment variables - run: | - echo EDGEDBCLI_GIT_REV=$(cat shared-artifacts/edgedbcli_git_rev.txt) >> $GITHUB_ENV - echo POSTGRES_GIT_REV=$(cat shared-artifacts/postgres_git_rev.txt) >> $GITHUB_ENV - echo STOLON_GIT_REV=$(cat shared-artifacts/stolon_git_rev.txt) >> $GITHUB_ENV - echo BUILD_LIB=$(python setup.py -q ci_helper --type build_lib) >> $GITHUB_ENV - echo BUILD_TEMP=$(python setup.py -q ci_helper --type build_temp) >> $GITHUB_ENV - - # Restore build cache - - - name: Restore cached EdgeDB CLI binaries - uses: actions/cache@v4 - id: cli-cache - with: - path: build/cli - key: edb-cli-v3-${{ env.EDGEDBCLI_GIT_REV }} - - - name: Restore cached Rust extensions - uses: actions/cache@v4 - id: rust-cache - with: - path: build/rust_extensions - key: edb-rust-v4-${{ hashFiles('shared-artifacts/rust_cache_key.txt') }} - - - name: Restore cached Cython extensions - uses: actions/cache@v4 - id: ext-cache - with: - path: build/extensions - key: edb-ext-v6-${{ hashFiles('shared-artifacts/ext_cache_key.txt') }} - - - name: Restore compiled parsers cache - uses: actions/cache@v4 - id: parsers-cache - with: - path: build/lib - key: edb-parsers-v3-${{ hashFiles('shared-artifacts/parsers_cache_key.txt') }} - - - name: Restore cached PostgreSQL build - uses: actions/cache@v4 - id: postgres-cache - with: - path: build/postgres/install - key: edb-postgres-v3-${{ env.POSTGRES_GIT_REV }}-${{ hashFiles('shared-artifacts/lib_cache_key.txt') }} - - - name: Restore cached Stolon build - uses: actions/cache@v4 - id: stolon-cache - with: - path: build/stolon/bin - key: edb-stolon-v2-${{ env.STOLON_GIT_REV }} - - - name: Restore bootstrap cache - uses: actions/cache@v4 - id: bootstrap-cache - with: - path: build/cache - key: edb-bootstrap-v2-${{ hashFiles('shared-artifacts/bootstrap_cache_key.txt') }} - - - name: Stop if we cannot retrieve the cache - if: | - steps.cli-cache.outputs.cache-hit != 'true' || - steps.rust-cache.outputs.cache-hit != 'true' || - steps.ext-cache.outputs.cache-hit != 'true' || - steps.parsers-cache.outputs.cache-hit != 'true' || - steps.postgres-cache.outputs.cache-hit != 'true' || - steps.stolon-cache.outputs.cache-hit != 'true' || - steps.bootstrap-cache.outputs.cache-hit != 'true' - run: | - echo ::error::Cannot retrieve build cache. - exit 1 - - - name: Validate cached binaries - run: | - # Validate EdgeDB CLI - ./build/cli/bin/edgedb --version || exit 1 - - # Validate Stolon - ./build/stolon/bin/stolon-sentinel --version || exit 1 - ./build/stolon/bin/stolon-keeper --version || exit 1 - ./build/stolon/bin/stolon-proxy --version || exit 1 - - # Validate PostgreSQL - ./build/postgres/install/bin/postgres --version || exit 1 - ./build/postgres/install/bin/pg_config --version || exit 1 - - - name: Restore cache into the source tree - run: | - cp -v build/cli/bin/edgedb edb/cli/edgedb - rsync -av ./build/rust_extensions/edb/ ./edb/ - rsync -av ./build/extensions/edb/ ./edb/ - rsync -av ./build/lib/edb/ ./edb/ - cp build/postgres/install/stamp build/postgres/ - - - name: Install edgedb-server - env: - BUILD_EXT_MODE: skip - run: | - # --no-build-isolation because we have explicitly installed all deps - # and don't want them to be reinstalled in an "isolated env". - pip install --no-build-isolation --no-deps -e .[test,docs] - - # List tests and upload - - - name: Generate complete list of tests for verification - env: - SHARD: ${{ matrix.shard }} - EDGEDB_TEST_REPEATS: 1 - run: | - edb test --list > shared-artifacts/all_tests.txt - - - name: Upload list of tests - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: test-list - path: shared-artifacts - retention-days: 1 - - test-conclusion: - needs: [cargo-test, python-test, python-test-list] - runs-on: ubuntu-latest - if: ${{ always() }} - steps: - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.12.2' - - - name: Install Python deps - run: | - python -m pip install requests click - - - uses: actions/checkout@v4 - with: - submodules: false - - - name: Download python-test results - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - pattern: python-test-results-* - merge-multiple: true - path: results - - # Render results and exit if they were unsuccessful - - name: Render results - run: | - python edb/tools/test/results.py 'results/result_*.json' - - - name: Download shared artifacts - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: shared-artifacts - path: shared-artifacts - - - name: Download test list - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: test-list - path: shared-artifacts - - - name: Merge stats and verify tests completion - shell: python - env: - GIST_TOKEN: ${{ secrets.CI_BOT_GIST_TOKEN }} - GIT_REF: ${{ github.ref }} - run: | - import csv - import glob - import io - import os - import requests - - orig = {} - new = {} - all_tests = set() - with open("shared-artifacts/time_stats.csv") as f: - for name, t, c in csv.reader(f): - assert name not in orig, "duplicate test name in original stats!" - orig[name] = (t, int(c)) - - with open("shared-artifacts/all_tests.txt") as f: - for line in f: - assert line not in all_tests, "duplicate test name in this run!" - all_tests.add(line.strip()) - - for new_file in glob.glob("results/running_times_*.csv"): - with open(new_file) as f: - for name, t, c in csv.reader(f): - if int(c) > orig.get(name, (0, 0))[1]: - if name.startswith("setup::"): - new[name] = (t, c) - else: - assert name not in new, f"duplicate test! {name}" - new[name] = (t, c) - all_tests.remove(name) - - assert not all_tests, "Tests not run! \n" + "\n".join(all_tests) - - if os.environ["GIT_REF"] == "refs/heads/master": - buf = io.StringIO() - writer = csv.writer(buf) - orig.update(new) - for k, v in sorted(orig.items()): - writer.writerow((k,) + v) - - resp = requests.patch( - "https://api.github.com/gists/8b722a65397f7c4c0df72f5394efa04c", - headers={"Accept": "application/vnd.github.v3+json"}, - auth=("edgedb-ci", os.environ["GIST_TOKEN"]), - json={"files": {"time_stats.csv": {"content": buf.getvalue()}}}, - ) - resp.raise_for_status() - - - workflow-notifications: - if: failure() && github.event_name != 'pull_request' - name: Notify in Slack on failures - needs: - - test-conclusion - runs-on: ubuntu-latest - permissions: - actions: 'read' - steps: - - name: Slack Workflow Notification - uses: Gamesight/slack-workflow-status@26a36836c887f260477432e4314ec3490a84f309 - with: - repo_token: ${{secrets.GITHUB_TOKEN}} - slack_webhook_url: ${{secrets.ACTIONS_SLACK_WEBHOOK_URL}} - name: 'Workflow notifications' - icon_emoji: ':hammer:' - include_jobs: 'on-failure' + edb test --jobs 2 --verbose -k server_auth_mtls -k server_auth_jwt