You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2022/12/02 19:23:17 UTC

[arrow-adbc] branch main updated: ci: deduplicate release artifacts (#209)

This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new b2804af  ci: deduplicate release artifacts (#209)
b2804af is described below

commit b2804af3da8040fa5cfffb6a410085cf3a4adcf6
Author: David Li <li...@gmail.com>
AuthorDate: Fri Dec 2 14:23:12 2022 -0500

    ci: deduplicate release artifacts (#209)
    
    Postgres/SQLite wheels are duplicated across builds since the tag
    is always py3-none-PLAT. GitHub complains about this, so
    deduplicate before upload.
---
 .github/workflows/packaging-wheels.yml             | 24 +++++++++++++++++-----
 .../adbc_driver_manager/_version.py                | 13 ++++++++----
 .../adbc_driver_postgres/_version.py               | 13 ++++++++----
 .../adbc_driver_sqlite/_version.py                 | 13 ++++++++----
 4 files changed, 46 insertions(+), 17 deletions(-)

diff --git a/.github/workflows/packaging-wheels.yml b/.github/workflows/packaging-wheels.yml
index f769e37..78407cf 100644
--- a/.github/workflows/packaging-wheels.yml
+++ b/.github/workflows/packaging-wheels.yml
@@ -397,14 +397,28 @@ jobs:
         shell: bash
         run: |
           RELEASE_TAG=${GITHUB_REF#refs/*/}
+
+          # Deduplicate wheels built in different jobs with same tag
+          mkdir -p upload-staging
+          find ./release-artifacts/ \
+            '(' \
+              -name docs.tgz -or \
+              -name '*.jar' -or \
+              -name '*.pom' -or \
+              -name '*.whl' -or \
+              -name 'adbc_*.tar.gz' \
+            ')' \
+            -exec mv '{}' upload-staging \;
+
+          UPLOAD=$(find upload-staging -type f | sort | uniq)
+
+          echo "Uploading files:"
+          echo ${UPLOAD}
+
           gh release create "${RELEASE_TAG}" \
             --repo ${{ github.repository }} \
             --prerelease \
             --title "ADBC Libraries ${RELEASE_TAG}" \
-            release-artifacts/docs/docs.tgz \
-            release-artifacts/java/*.jar \
-            release-artifacts/java/*.pom \
-            release-artifacts/python*/adbc_*/*/*.whl \
-            release-artifacts/python-manylinux/adbc_*/dist/adbc_*.tar.gz
+            ${UPLOAD}
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/python/adbc_driver_manager/adbc_driver_manager/_version.py b/python/adbc_driver_manager/adbc_driver_manager/_version.py
index 09bfd6f..fb1829d 100644
--- a/python/adbc_driver_manager/adbc_driver_manager/_version.py
+++ b/python/adbc_driver_manager/adbc_driver_manager/_version.py
@@ -19,6 +19,7 @@
 # Generated by miniver (CC0).
 
 import os
+import re
 
 # This file is part of 'miniver': https://github.com/jbweston/miniver
 #
@@ -33,6 +34,7 @@ package_root = os.path.dirname(os.path.realpath(__file__))
 package_name = os.path.basename(package_root)
 
 STATIC_VERSION_FILE = "_static_version.py"
+TAG_RELEASE_FORMAT = re.compile(r"^adbc-([0-9]+\.[0-9]+\.[0-9]+)(?:-rc[0-9]+)?$")
 
 
 def get_version(version_file=STATIC_VERSION_FILE):
@@ -103,12 +105,14 @@ def get_version_from_git():
         .decode()
         .strip("v")  # Tags can have a leading 'v', but the version should not
         .rstrip("\n")
-        .rsplit("-", 3)  # Split the latest tag, commits since tag, and hash
+        .rsplit("-", 2)  # Split the latest tag, commits since tag, and hash
     )
 
     try:
-        _, release, dev, git = description
-    except ValueError:  # No tags, only the git hash
+        release, dev, git = description
+        release = TAG_RELEASE_FORMAT.match(release).group(1)
+    except (AttributeError, ValueError):
+        # Invalid tag; or no tags, only the git hash
         # prepend 'g' to match with format returned by 'git describe'
         git = "g{}".format(*description)
         # XXX: assume version if not given
@@ -150,11 +154,12 @@ def get_version_from_git_archive(version_info):
         # variables not expanded during 'git archive'
         return None
 
-    VTAG = "tag: adbc-"
+    VTAG = "tag: "
     refs = set(r.strip() for r in refnames.split(","))
     version_tags = set(r[len(VTAG) :] for r in refs if r.startswith(VTAG))
     if version_tags:
         release, *_ = sorted(version_tags)  # prefer e.g. "2.0" over "2.0rc1"
+        release = TAG_RELEASE_FORMAT.match(release).group(1)
         return Version(release, dev=None, labels=None)
     else:
         return Version("unknown", dev=None, labels=["g{}".format(git_hash)])
diff --git a/python/adbc_driver_postgres/adbc_driver_postgres/_version.py b/python/adbc_driver_postgres/adbc_driver_postgres/_version.py
index 09bfd6f..fb1829d 100644
--- a/python/adbc_driver_postgres/adbc_driver_postgres/_version.py
+++ b/python/adbc_driver_postgres/adbc_driver_postgres/_version.py
@@ -19,6 +19,7 @@
 # Generated by miniver (CC0).
 
 import os
+import re
 
 # This file is part of 'miniver': https://github.com/jbweston/miniver
 #
@@ -33,6 +34,7 @@ package_root = os.path.dirname(os.path.realpath(__file__))
 package_name = os.path.basename(package_root)
 
 STATIC_VERSION_FILE = "_static_version.py"
+TAG_RELEASE_FORMAT = re.compile(r"^adbc-([0-9]+\.[0-9]+\.[0-9]+)(?:-rc[0-9]+)?$")
 
 
 def get_version(version_file=STATIC_VERSION_FILE):
@@ -103,12 +105,14 @@ def get_version_from_git():
         .decode()
         .strip("v")  # Tags can have a leading 'v', but the version should not
         .rstrip("\n")
-        .rsplit("-", 3)  # Split the latest tag, commits since tag, and hash
+        .rsplit("-", 2)  # Split the latest tag, commits since tag, and hash
     )
 
     try:
-        _, release, dev, git = description
-    except ValueError:  # No tags, only the git hash
+        release, dev, git = description
+        release = TAG_RELEASE_FORMAT.match(release).group(1)
+    except (AttributeError, ValueError):
+        # Invalid tag; or no tags, only the git hash
         # prepend 'g' to match with format returned by 'git describe'
         git = "g{}".format(*description)
         # XXX: assume version if not given
@@ -150,11 +154,12 @@ def get_version_from_git_archive(version_info):
         # variables not expanded during 'git archive'
         return None
 
-    VTAG = "tag: adbc-"
+    VTAG = "tag: "
     refs = set(r.strip() for r in refnames.split(","))
     version_tags = set(r[len(VTAG) :] for r in refs if r.startswith(VTAG))
     if version_tags:
         release, *_ = sorted(version_tags)  # prefer e.g. "2.0" over "2.0rc1"
+        release = TAG_RELEASE_FORMAT.match(release).group(1)
         return Version(release, dev=None, labels=None)
     else:
         return Version("unknown", dev=None, labels=["g{}".format(git_hash)])
diff --git a/python/adbc_driver_sqlite/adbc_driver_sqlite/_version.py b/python/adbc_driver_sqlite/adbc_driver_sqlite/_version.py
index 09bfd6f..fb1829d 100644
--- a/python/adbc_driver_sqlite/adbc_driver_sqlite/_version.py
+++ b/python/adbc_driver_sqlite/adbc_driver_sqlite/_version.py
@@ -19,6 +19,7 @@
 # Generated by miniver (CC0).
 
 import os
+import re
 
 # This file is part of 'miniver': https://github.com/jbweston/miniver
 #
@@ -33,6 +34,7 @@ package_root = os.path.dirname(os.path.realpath(__file__))
 package_name = os.path.basename(package_root)
 
 STATIC_VERSION_FILE = "_static_version.py"
+TAG_RELEASE_FORMAT = re.compile(r"^adbc-([0-9]+\.[0-9]+\.[0-9]+)(?:-rc[0-9]+)?$")
 
 
 def get_version(version_file=STATIC_VERSION_FILE):
@@ -103,12 +105,14 @@ def get_version_from_git():
         .decode()
         .strip("v")  # Tags can have a leading 'v', but the version should not
         .rstrip("\n")
-        .rsplit("-", 3)  # Split the latest tag, commits since tag, and hash
+        .rsplit("-", 2)  # Split the latest tag, commits since tag, and hash
     )
 
     try:
-        _, release, dev, git = description
-    except ValueError:  # No tags, only the git hash
+        release, dev, git = description
+        release = TAG_RELEASE_FORMAT.match(release).group(1)
+    except (AttributeError, ValueError):
+        # Invalid tag; or no tags, only the git hash
         # prepend 'g' to match with format returned by 'git describe'
         git = "g{}".format(*description)
         # XXX: assume version if not given
@@ -150,11 +154,12 @@ def get_version_from_git_archive(version_info):
         # variables not expanded during 'git archive'
         return None
 
-    VTAG = "tag: adbc-"
+    VTAG = "tag: "
     refs = set(r.strip() for r in refnames.split(","))
     version_tags = set(r[len(VTAG) :] for r in refs if r.startswith(VTAG))
     if version_tags:
         release, *_ = sorted(version_tags)  # prefer e.g. "2.0" over "2.0rc1"
+        release = TAG_RELEASE_FORMAT.match(release).group(1)
         return Version(release, dev=None, labels=None)
     else:
         return Version("unknown", dev=None, labels=["g{}".format(git_hash)])