Skip to content

[pull] main from PrefectHQ:main #2763

[pull] main from PrefectHQ:main

[pull] main from PrefectHQ:main #2763

name: Verify prefect-client build
on:
pull_request:
branches:
- main
paths:
- client/*
- src/prefect/**/*.py
- requirements.txt
- requirements-client.txt
- setup.cfg
- .github/workflows/prefect-client.yaml
push:
branches:
- main
paths:
- client/*
- src/prefect/**/*.py
- requirements.txt
- requirements-client.txt
- setup.cfg
- .github/workflows/prefect-client.yaml
workflow_call:
inputs:
upload-artifacts:
description: "Whether or not to upload artifacts created in this workflow"
default: false
type: boolean
artifact-name:
description: "The name for the build prefect-client artifact"
default: "prefect-client-pypi-dists"
type: string
jobs:
prefect-client-smoke-test:
name: Build and run prefect-client
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Versioneer only generates correct versions with a full fetch
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
cache-dependency-path: "requirements-client.txt"
- name: Create a temp dir to stage our build
run: echo "TMPDIR=$(mktemp -d)" >> $GITHUB_ENV
- name: Prepare files for prefect-client build (omit the local build)
run: sh client/build_client.sh
env:
TMPDIR: ${{ env.TMPDIR }}
- name: Build a binary wheel and a source tarball
run: pip install wheel && python setup.py sdist bdist_wheel
working-directory: ${{ env.TMPDIR }}
- name: Install the built client from the locally built package
run: pip install dist/*.tar.gz
working-directory: ${{ env.TMPDIR }}
- name: Get the version of built `prefect-client`
run: |
prefect_client_version=$(python -c "import prefect; print(prefect.__version__)")
echo "prefect_client_version=$prefect_client_version" >> $GITHUB_OUTPUT
working-directory: ${{ env.TMPDIR }}
id: prefect_client_version
- name: Run the smoke test flow using the built client
run: python client/client_flow.py
working-directory: ${{ env.TMPDIR }}
env:
PREFECT_API_KEY: ${{ secrets.PREFECT_CLIENT_SA_API_KEY }}
PREFECT_API_URL: "https://api.prefect.cloud/api/accounts/9b649228-0419-40e1-9e0d-44954b5c0ab6/workspaces/96bd3cf8-85c9-4545-9713-b4e3c3e03466" # sandbox, prefect-client workspace
- name: Install prefect from source
run: pip install .
- name: Get the version of built `prefect`
run: |
prefect_version=$(prefect --version)
echo "prefect_version=$prefect_version" >> $GITHUB_OUTPUT
id: prefect_version
- name: Verify that the built `prefect` and `prefect-client` versions are the same
run: |
if [ "${{ steps.prefect_version.outputs.prefect_version }}" != "${{ steps.prefect_client_version.outputs.prefect_client_version }}" ]; then
echo "The built versions of prefect and prefect-client are not the same."
exit 1
fi
- name: Run the smoke test flow again with prefect and prefect-client installed
run: python client/client_flow.py
working-directory: ${{ env.TMPDIR }}
env:
PREFECT_API_KEY: ${{ secrets.PREFECT_CLIENT_SA_API_KEY }}
PREFECT_API_URL: "https://api.prefect.cloud/api/accounts/9b649228-0419-40e1-9e0d-44954b5c0ab6/workspaces/96bd3cf8-85c9-4545-9713-b4e3c3e03466" # sandbox, prefect-client workspace
- name: Publish build artifacts
if: ${{ inputs.upload-artifacts }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: "${{ env.TMPDIR }}/dist"