Skip to content

[Github][MLGO] Add workflow to release mlgo utils #78885

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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

boomanaiden154
Copy link
Contributor

This patch adds a workflow to publish the MLGO utilities to Pypi.

@llvmbot
Copy link
Member

llvmbot commented Jan 21, 2024

@llvm/pr-subscribers-github-workflow

@llvm/pr-subscribers-mlgo

Author: Aiden Grossman (boomanaiden154)

Changes

This patch adds a workflow to publish the MLGO utilities to Pypi.


Full diff: https://github.com/llvm/llvm-project/pull/78885.diff

3 Files Affected:

  • (added) .github/workflows/publish-mlgo-utils.yml (+40)
  • (modified) llvm/utils/mlgo-utils/mlgo/init.py (+7-1)
  • (modified) llvm/utils/mlgo-utils/pyproject.toml (+1-1)
diff --git a/.github/workflows/publish-mlgo-utils.yml b/.github/workflows/publish-mlgo-utils.yml
new file mode 100644
index 000000000000000..43e0589c637a18f
--- /dev/null
+++ b/.github/workflows/publish-mlgo-utils.yml
@@ -0,0 +1,40 @@
+name: Release mlgo-utils
+
+permissions:
+  contents: read
+
+on:
+  workflow_dispatch:
+    inputs:
+      branch:
+        description: 'Branch'
+        required: true
+        type: string
+
+jobs:
+  release-mlgo-utils:
+    name: Release mlgo-utils
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout LLVM
+        uses: actions/[email protected]
+        with:
+          ref: "${{ inputs.branch }}"
+      - name: Install dependencies
+        run: |
+          pip3 install build==0.10.0 setuptools==68.0.00
+      - name: Package mlgo-utils
+        run: |
+          cd llvm/utils/mlgo-utils
+          python3 -m build
+      - name: Upload mlgo-utils to test.pypi.org
+        uses: pypa/gh-action-pypi-publish@release/v1
+        with:
+          password: ${{ secrets.MLGO_UTILS_TEST_PYPI_API_TOKEN }}
+          repository-url: https://test.pypi.org/legacy/
+          packages-dir: llvm/utils/mlgo-utils/dist/
+      - name: Upload mlgo-utils to pypi.org
+        uses: pypa/gh-action-pypi-publish@release/v1
+        with:
+          password: ${{ secrets.MLGO_UTILS_PYPI_API_TOKEN }}
+          packages-dir: llvm/utils/mlgo-utils/dist/
diff --git a/llvm/utils/mlgo-utils/mlgo/__init__.py b/llvm/utils/mlgo-utils/mlgo/__init__.py
index bcb5de2ff4d5752..917b6bc4c14b1cb 100644
--- a/llvm/utils/mlgo-utils/mlgo/__init__.py
+++ b/llvm/utils/mlgo-utils/mlgo/__init__.py
@@ -2,5 +2,11 @@
 # See https://llvm.org/LICENSE.txt for license information.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+from datetime import timezone, datetime
+
 __versioninfo__ = (18, 0, 0)
-__version__ = ".".join(str(v) for v in __versioninfo__) + "dev"
+__version__ = (
+    ".".join(str(v) for v in __versioninfo__)
+    + "dev"
+    + datetime.now(tz=timezone.utc).strftime("%Y%m%d%H%M")
+)
diff --git a/llvm/utils/mlgo-utils/pyproject.toml b/llvm/utils/mlgo-utils/pyproject.toml
index be2af86cd05df30..abd243fd4fb4ee2 100644
--- a/llvm/utils/mlgo-utils/pyproject.toml
+++ b/llvm/utils/mlgo-utils/pyproject.toml
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.0"]
 build-backend = "setuptools.build_meta"
 
 [project]
-name = "mlgo"
+name = "mlgo-utils"
 description = "Tooling for ML in LLVM"
 readme = "README.md"
 requires-python = ">=3.8,<3.11"

@boomanaiden154
Copy link
Contributor Author

@tstellar Once this gets approved, we'll need to add the secrets. I'm assuming we can't just reuse the lit secrets as they're probably repository specific. I also have the mlgo-utils project (tried to get mlgo, pypi complains it is too close another package name) registered on PyPI and test PyPI. We'd like to do this under the llvm PyPI account if possible, so I'm assuming I'll have to transfer them?

If that's not feasible, I can also just keep them on my account and send tokens over.

@tstellar
Copy link
Collaborator

@tstellar Once this gets approved, we'll need to add the secrets. I'm assuming we can't just reuse the lit secrets as they're probably repository specific.

We can create secrets at the organization level, but it still won't work until both lit and mlgo are under the llvm project account on pypi (lit is not under the llvm account yet).

I also have the mlgo-utils project (tried to get mlgo, pypi complains it is too close another package name) registered on PyPI and test PyPI. We'd like to do this under the llvm PyPI account if possible, so I'm assuming I'll have to transfer them?

Yes, you'll have to transfer the project. I need to look into how to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants