WIP:instrument task runs #18313
This file contains 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: Integration tests | |
on: | |
pull_request: | |
paths: | |
- .github/workflows/integration-tests.yaml | |
- "src/prefect/**/*.py" | |
- requirements.txt | |
- requirements-client.txt | |
- requirements-dev.txt | |
- ui/** | |
- .nvmrc | |
- Dockerfile | |
- flows/* | |
push: | |
branches: | |
- main | |
paths: | |
- .github/workflows/integration-tests.yaml | |
- "**/*.py" | |
- requirements.txt | |
- requirements-client.txt | |
- requirements-dev.txt | |
- ui/** | |
- .nvmrc | |
- Dockerfile | |
jobs: | |
compatibility-tests: | |
name: Integration tests @${{ matrix.server-version.version }} | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
server-version: [ | |
# These versions correspond to Prefect image tags, the patch version is | |
# excluded to always pull the latest patch of each minor version. The ref | |
# should generally be set to the latest patch release for that version. | |
{ version: "main", ref: "main" }, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
id: setup_python | |
with: | |
python-version: "3.10" | |
- name: UV Cache | |
# Manually cache the uv cache directory | |
# until setup-python supports it: | |
# https://github.com/actions/setup-python/issues/822 | |
uses: actions/cache@v4 | |
id: cache-uv | |
with: | |
path: ~/.cache/uv | |
key: uvcache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements-client.txt', 'requirements.txt', 'requirements-dev.txt') }} | |
- name: Install python packages | |
run: | | |
python -m pip install -U uv | |
uv pip install --upgrade --system . | |
- name: Start server@${{ matrix.server-version.version }} | |
if: ${{ matrix.server-version.version != 'main' }} | |
env: | |
PREFECT_API_URL: http://127.0.0.1:4200/api | |
PREFECT_SERVER_LOGGING_LEVEL: DEBUG | |
PREFECT_EXPERIMENTAL_EVENTS: "true" | |
run: > | |
docker run \ | |
--name "prefect-server" \ | |
-d \ | |
-p 4200:4200 \ | |
-e PREFECT_API_URL=${{ env.PREFECT_API_URL }} \ | |
-e PREFECT_SERVER_LOGGING_LEVEL=${{ env.PREFECT_SERVER_LOGGING_LEVEL }} \ | |
${{ matrix.server-version.image }} \ | |
prefect server start --analytics-off --host 0.0.0.0 | |
./scripts/wait-for-server.py | |
# TODO: Replace `wait-for-server` with dedicated command | |
# https://github.com/PrefectHQ/prefect/issues/6990 | |
- name: Start server | |
if: ${{ matrix.server-version.version == 'main' }} | |
env: | |
PREFECT_API_URL: http://127.0.0.1:4200/api | |
PREFECT_SERVER_LOGGING_LEVEL: DEBUG | |
run: > | |
prefect server start --analytics-off --host 0.0.0.0 2>&1 > server.log & | |
./scripts/wait-for-server.py | |
# TODO: Replace `wait-for-server` with dedicated command | |
# https://github.com/PrefectHQ/prefect/issues/6990 | |
- name: Run integration flows | |
env: | |
PREFECT_API_URL: http://127.0.0.1:4200/api | |
SERVER_VERSION: ${{ matrix.server-version.version }} | |
run: > | |
./scripts/run-integration-flows.py flows/ | |
- name: Show server logs | |
if: always() | |
run: | | |
cat server.log || echo "No logs available" | |
docker logs prefect-server || echo "No logs available" |