-
Notifications
You must be signed in to change notification settings - Fork 65
chore: Build and publish RAI packages via CI #731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Juliaj
wants to merge
11
commits into
main
Choose a base branch
from
jj/ci/wheel_distro
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
db3948a
chore: Build and publish RAI packages via CI
Juliaj 1407228
Add publish to PyPi steps and update doc
Juliaj 9860b47
Add rai-tiny pkg and refactor workflow
Juliaj a9c8f68
Update pypi_release doc and remove unnecessary files
Juliaj 79b2fc2
Exclude rai_tiny from tests
Juliaj 76f9076
Fix the build issue for wheel format
Juliaj 8e4bd39
Merge branch 'main' into jj/ci/wheel_distro
Juliaj 7ec39f1
Update release doc for better readability
Juliaj f89bc55
Update per coderabbit review feedback
Juliaj f076d25
Address nitpicking comments from coderabbitai
Juliaj b83fc8c
Merge branch 'main' into jj/ci/wheel_distro
Juliaj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| name: List package versions (PyPI / Test PyPI) | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| schedule: | ||
| # Run every Monday at 9:00 AM UTC | ||
| - cron: '0 9 * * 1' | ||
|
|
||
| jobs: | ||
| list-packages: | ||
| name: List local and PyPI versions | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.10' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install packaging | ||
|
|
||
| - name: Discover local packages and check PyPI versions | ||
| run: | | ||
| python scripts/discover_packages.py --output-format json > packages.json | ||
|
|
||
| python -c ' | ||
| import json | ||
| import subprocess | ||
| import sys | ||
|
|
||
| # Load local packages | ||
| with open("packages.json") as f: | ||
| local_packages = json.load(f) | ||
|
|
||
| print("## Package Version Status") | ||
| print("") | ||
| print("| Package | Local Version | PyPI Latest | Test PyPI Latest | Status |") | ||
| print("|---------|---------------|-------------|------------------|--------|") | ||
|
|
||
| for pkg_name in sorted(local_packages.keys()): | ||
| pkg_info = local_packages[pkg_name] | ||
| local_version = pkg_info["version"] | ||
|
|
||
| # Get Test PyPI versions | ||
| try: | ||
| result = subprocess.run(["python", "scripts/pypi_query.py", "--test-pypi", "list", pkg_name, "--json"], | ||
| capture_output=True, text=True, timeout=10) | ||
| testpypi_versions = json.loads(result.stdout) if result.returncode == 0 and result.stdout.strip() else [] | ||
| except (json.JSONDecodeError, subprocess.TimeoutExpired): | ||
| testpypi_versions = [] | ||
|
|
||
| # Get PyPI versions | ||
| try: | ||
| result = subprocess.run(["python", "scripts/pypi_query.py", "list", pkg_name, "--json"], | ||
| capture_output=True, text=True, timeout=10) | ||
| pypi_versions = json.loads(result.stdout) if result.returncode == 0 and result.stdout.strip() else [] | ||
| except (json.JSONDecodeError, subprocess.TimeoutExpired): | ||
| pypi_versions = [] | ||
|
|
||
| # Get latest versions (first in sorted list, which is newest) | ||
| pypi_latest = pypi_versions[0] if pypi_versions else "-" | ||
| testpypi_latest = testpypi_versions[0] if testpypi_versions else "-" | ||
|
|
||
| # Display local version (no annotations) | ||
| local_display = f"**{local_version}**" | ||
|
|
||
| # Generate recommendation | ||
| recommendation = "" | ||
| if pypi_latest and pypi_latest != "-": | ||
| # Compare versions - if PyPI is older, recommend publishing | ||
| from packaging import version as pkg_version | ||
| try: | ||
| if pkg_version.parse(local_version) > pkg_version.parse(pypi_latest): | ||
| recommendation = "📦 Awaiting release" | ||
| elif local_version == pypi_latest: | ||
| recommendation = "✅ Up to date" | ||
| else: | ||
| recommendation = "Local < PyPI" | ||
| except: | ||
| recommendation = "-" | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| elif testpypi_latest and testpypi_latest != "-": | ||
| recommendation = "📦 Awaiting release" | ||
| else: | ||
| recommendation = "📦 Awaiting release" | ||
|
|
||
| print(f"| {pkg_name} | {local_display} | {pypi_latest} | {testpypi_latest} | {recommendation} |") | ||
|
|
||
| print("") | ||
| print("Legend:") | ||
| print("- **bold** = current local version") | ||
| ' >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| # Also print to console | ||
| python -c ' | ||
| import json | ||
| import subprocess | ||
|
|
||
| with open("packages.json") as f: | ||
| local_packages = json.load(f) | ||
|
|
||
| print("\\nPackage Version Status:\\n") | ||
|
|
||
| for pkg_name in sorted(local_packages.keys()): | ||
| pkg_info = local_packages[pkg_name] | ||
| local_version = pkg_info["version"] | ||
|
|
||
| # Get Test PyPI versions | ||
| try: | ||
| result = subprocess.run(["python", "scripts/pypi_query.py", "--test-pypi", "list", pkg_name, "--json"], | ||
| capture_output=True, text=True, timeout=10) | ||
| testpypi_versions = json.loads(result.stdout) if result.returncode == 0 and result.stdout.strip() else [] | ||
| except (json.JSONDecodeError, subprocess.TimeoutExpired): | ||
| testpypi_versions = [] | ||
|
|
||
| # Get PyPI versions | ||
| try: | ||
| result = subprocess.run(["python", "scripts/pypi_query.py", "list", pkg_name, "--json"], | ||
| capture_output=True, text=True, timeout=10) | ||
| pypi_versions = json.loads(result.stdout) if result.returncode == 0 and result.stdout.strip() else [] | ||
| except (json.JSONDecodeError, subprocess.TimeoutExpired): | ||
| pypi_versions = [] | ||
|
|
||
| local_exists_pypi = local_version in pypi_versions | ||
| local_exists_testpypi = local_version in testpypi_versions | ||
|
|
||
| status = "" | ||
| if local_exists_pypi: | ||
| status = " [PUBLISHED on PyPI]" | ||
| elif local_exists_testpypi: | ||
| status = " [PUBLISHED on Test PyPI]" | ||
| else: | ||
| status = " [NOT PUBLISHED]" | ||
|
|
||
| pypi_latest = pypi_versions[0] if pypi_versions else "-" | ||
| testpypi_latest = testpypi_versions[0] if testpypi_versions else "-" | ||
|
|
||
| print(f"{pkg_name}:") | ||
| print(f" Local: {local_version}{status}") | ||
| print(f" PyPI: {pypi_latest}") | ||
| print(f" Test PyPI: {testpypi_latest}") | ||
| print() | ||
| ' | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maciejmajek, let me know whether this is necessary. I don't mind taking this out.