Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 32 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,34 @@ jobs:
tag_revision="$(git rev-list -n 1 "${release_tag}")"
git fetch --no-tags origin main
main_revision="$(git rev-parse origin/main)"
if [[ "${tag_revision}" != "${main_revision}" ]]; then
echo "::error title=Tag is not origin/main::Tag '${release_tag}' points at ${tag_revision}, but origin/main is ${main_revision}."
echo "::error::Tag the remote head of main, then rerun the release."
if ! git merge-base --is-ancestor "${tag_revision}" "${main_revision}"; then
echo "::error title=Tag is not on main::Tag '${release_tag}' points at ${tag_revision}, which is not reachable from origin/main."
echo "::error::Tag a commit from main, then rerun the release."
exit 1
fi

echo "tag=${release_tag}" >> "${GITHUB_OUTPUT}"
echo "version=${release_tag#v}" >> "${GITHUB_OUTPUT}"

- name: Validate runtime dependencies
run: |
runtime_requirements_file="build/release/runtime-requirements.txt"
mkdir -p "$(dirname "${runtime_requirements_file}")"
uv export \
--no-dev \
--no-emit-project \
--no-hashes \
--no-header \
--no-annotate \
--frozen \
--output-file "${runtime_requirements_file}"

if grep -Eq '(^-e[[:space:]]|^(\.\.?/)|(^|[[:space:]])file:| @ (\.\.?/|file:))' "${runtime_requirements_file}"; then
echo "::error title=Unexpected local dependency::Runtime requirements must resolve from PyPI."
cat "${runtime_requirements_file}"
exit 1
fi

- name: Build distributions
id: build
run: |
Expand Down Expand Up @@ -174,18 +193,24 @@ jobs:
} >> "${GITHUB_OUTPUT}"

- name: Smoke test installed wheel
env:
WHEEL_PATH: ${{ steps.build.outputs.wheel_path }}
run: |
python -m venv build/release/install-venv
. build/release/install-venv/bin/activate
python -m pip install "${{ steps.build.outputs.wheel_path }}"
python - <<'PY'
validation_dir="$(mktemp -d)"
python -m venv "${validation_dir}/venv"
. "${validation_dir}/venv/bin/activate"
python -m pip install "${GITHUB_WORKSPACE}/${WHEEL_PATH}"
(
cd "${validation_dir}"
python - <<'PY'
import os

import src_py_lib

if src_py_lib.__name__ != os.environ["IMPORT_NAME"]:
raise SystemExit(f"unexpected import name: {src_py_lib.__name__}")
PY
)

- name: Write release notes
id: notes
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ jobs:
- name: Install uv
run: python -m pip install "uv==${UV_VERSION}"

- name: Build wheel
run: uv build --wheel --out-dir dist --no-create-gitignore
- name: Build distributions
run: uv build --wheel --sdist --out-dir dist --no-create-gitignore

- name: Smoke test installed wheel
run: |
Expand Down