Skip to content

Commit

Permalink
New manual job to publish a release based on pre-built wheels (#2025)
Browse files Browse the repository at this point in the history
Provide an implementation for a new job which uploads python wheels and creates a new draft release.
  • Loading branch information
jleibs authored May 2, 2023
1 parent 6feca46 commit e22ab78
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 3 deletions.
81 changes: 78 additions & 3 deletions .github/workflows/manual_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,88 @@ on:
description: 'Release Version Number (Must match Cargo.toml)'
type: string
required: true
OVERRIDE_COMMIT:
description: 'Commit to release'
type: string
required: false

jobs:

publish-wheels:
name: 'Publish Wheels'

permissions:
contents: write
id-token: "write"

runs-on: ubuntu-latest

steps:
- name: publish
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Don't do a shallow clone since we need it for finding the full commit hash

- name: Add SHORT_SHA env property with commit short sha
run: |
if [ -z "${{ inputs.OVERRIDE_COMMIT }}" ]; then
USED_SHA=${{ github.sha }}
else
USED_SHA=${{ inputs.OVERRIDE_COMMIT }}
fi
echo "SHORT_SHA=$(echo $USED_SHA | cut -c1-7)" >> $GITHUB_ENV
- name: Expand short hash to FULL_SHA hash
run: |
echo "TODO: jleibs"
FULL_SHA=$(git rev-parse ${{ env.SHORT_SHA }})
echo "FULL_SHA=$FULL_SHA" >> $GITHUB_ENV
- id: "auth"
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
with:
version: '>= 363.0.0'

- name: Install packaging
run: |
python3 -m pip install packaging google-cloud-storage
- name: Download wheels from Google Cloud Storage
env:
BUCKET_PATH:
run: |
mkdir wheels
gsutil cp "gs://rerun-builds/commit/${{ env.SHORT_SHA }}/wheels/*.whl" wheels/
- name: Verify wheels match the expected release
run: |
python3 scripts/verify_wheels.py --folder wheels --version ${{ inputs.RELEASE_VERSION }}
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
# These are both set in the GitHub project configuration
MATURIN_REPOSITORY: ${{ vars.PYPI_REPOSITORY }}
MATURIN_PYPI_TOKEN: ${{ secrets.MATURIN_PYPI_TOKEN }}
with:
command: upload
args: --skip-existing wheels/*

# Create the actual prerelease
# https://github.com/ncipollo/release-action
- name: GitHub Release
uses: ncipollo/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: "Release - ${{ inputs.RELEASE_VERSION }}"
commit: ${{ env.FULL_SHA }}
tag: ${{ inputs.RELEASE_VERSION }}
artifacts: "wheels/*.whl"
generateReleaseNotes: true
allowUpdates: true
draft: true

31 changes: 31 additions & 0 deletions scripts/verify_wheels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Script to confirm wheels have the expected version number."""
import argparse
import sys
from pathlib import Path

from packaging.utils import canonicalize_version


def check_version(folder: str, expected_version: str) -> None:
wheels = list(Path("wheels").glob("*.whl"))

for wheel in wheels:
wheel_version = wheel.stem.split("-")[1]
if canonicalize_version(wheel_version) != expected_version:
print(f"Unexpected version: {wheel_version} (expected: {expected_version}) in {wheel.name}")
sys.exit(1)

print(f"All wheel versions match the expected version: {expected_version}")


def main() -> None:
parser = argparse.ArgumentParser(description="Validate wheels have the specified version")
parser.add_argument("--version", required=True, help="Version to expect")
parser.add_argument("--folder", required=True, help="Version to expect")
args = parser.parse_args()

check_version(args.folder, canonicalize_version(args.version))


if __name__ == "__main__":
main()

1 comment on commit e22ab78

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.25.

Benchmark suite Current: e22ab78 Previous: 6feca46 Ratio
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at/default 371 ns/iter (± 1) 284 ns/iter (± 2) 1.31
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/primary/default 261 ns/iter (± 0) 206 ns/iter (± 2) 1.27
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/secondaries/default 421 ns/iter (± 1) 320 ns/iter (± 0) 1.32
datastore/num_rows=1000/num_instances=1000/gc/default 2477840 ns/iter (± 13265) 1648994 ns/iter (± 2897) 1.50
mono_points_arrow/generate_message_bundles 26678190 ns/iter (± 1683594) 19453534 ns/iter (± 370240) 1.37
mono_points_arrow_batched/generate_message_bundles 22036701 ns/iter (± 1284507) 15247186 ns/iter (± 58957) 1.45
mono_points_arrow_batched/generate_messages 4499150 ns/iter (± 226736) 3004474 ns/iter (± 8962) 1.50
mono_points_arrow_batched/encode_total 26489115 ns/iter (± 1153547) 19875710 ns/iter (± 83648) 1.33
mono_points_arrow_batched/decode_log_msg 782448 ns/iter (± 3874) 498982 ns/iter (± 1053) 1.57
mono_points_arrow_batched/decode_message_bundles 7679034 ns/iter (± 84280) 6044995 ns/iter (± 6486) 1.27
mono_points_arrow_batched/decode_total 8392967 ns/iter (± 87999) 6620607 ns/iter (± 8973) 1.27
arrow_mono_points/insert 2260551156 ns/iter (± 4080777) 1527772875 ns/iter (± 1543474) 1.48
arrow_mono_points/query 1183589 ns/iter (± 12082) 866968 ns/iter (± 2300) 1.37
arrow_batch_points/query 16839 ns/iter (± 53) 12039 ns/iter (± 4) 1.40
arrow_batch_vecs/query 388895 ns/iter (± 1121) 300470 ns/iter (± 617) 1.29

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.