[llvm] [Github][MLGO] Add workflow to release mlgo utils (PR #78885)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 20 23:20:54 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-github-workflow

@llvm/pr-subscribers-mlgo

Author: Aiden Grossman (boomanaiden154)

<details>
<summary>Changes</summary>

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
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/checkout at v4.1.1
+        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 at 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 at 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"

``````````

</details>


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


More information about the llvm-commits mailing list