]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Added more logic to wheel build [skip wheels] 7992/head
authorTrevor Gross <tgross@intrepidcs.com>
Sat, 7 May 2022 18:42:19 +0000 (14:42 -0400)
committerTrevor Gross <tgross@intrepidcs.com>
Sat, 7 May 2022 18:42:19 +0000 (14:42 -0400)
.github/workflows/cibuildwheels.yaml
pyproject.toml

index 07926efcefbe4b000aa579cad507ebcc374346b5..9712012d3bd0937ff70067275b107e057a2f3d66 100644 (file)
@@ -4,6 +4,8 @@ on:
   pull_request:
     branches:
       - main
+  release:
+    types: [created]  
     # paths-ignore:
     #   - "examples/**"
     #   - "doc/**"
@@ -11,7 +13,20 @@ on:
 jobs:
   build_wheels:
     name: Build wheels on ${{ matrix.os }}
-    # TODO: Add logic to run/ignore on [wheels-build] or [wheels-skip]
+    # Run if this is a release, OR if commit message contains "[build wheels]"
+    # OR if the event (PR) has the label "setup", but skip if the commit
+    # message contains "[skip wheels]"
+    if: >-
+      github.event_name == 'release' ||
+      (
+        (! contains(github.event.head_commit.message, '[skip wheels]')) && (
+          contains(github.event.head_commit.message, '[build wheels]')
+          (
+            github.event.action == 'labeled' &&
+            github.event.label.name == 'setup'
+          )
+        )
+      )
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
@@ -45,21 +60,29 @@ jobs:
           path: dist/*.tar.gz
 
 
-  # upload_pypi:
-  #   needs: [build_wheels, build_sdist]
-  #   runs-on: ubuntu-latest
-  #   # upload to PyPI on every tag starting with 'v'
-  #   if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
-  #   # alternatively, to publish when a GitHub Release is created, use the following rule:
-  #   # if: github.event_name == 'release' && github.event.action == 'published'
-  #   steps:
-  #     - uses: actions/download-artifact@v2
-  #       with:
-  #         name: artifact
-  #         path: dist
+  upload_pypi:
+    name: Upload wheels to pypi
+    # if: github.event_name == 'release'
+    needs: [build_wheels, build_sdist]
+    runs-on: ubuntu-latest
+    # upload to PyPI on every tag starting with 'v'
+    # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
+    # alternatively, to publish when a GitHub Release is created, use the following rule:
+    if: github.event_name == 'release' && github.event.action == 'published'
+    steps:
+      - uses: actions/download-artifact@v2
+        with:
+          name: artifact
+          path: dist
 
-  #     - uses: pypa/gh-action-pypi-publish@v1.4.2
-  #       with:
-  #         user: __token__
-  #         password: ${{ secrets.pypi_password }}
-  #         # To test: repository_url: https://test.pypi.org/legacy/
+      - uses: pypa/gh-action-pypi-publish@v1.4.2
+        with:
+          user: __token__
+          # password: ${{ secrets.pypi_token }}
+      #     # To test: repository_url: https://test.pypi.org/legacy/
+          password: ${{ secrets.test_pypi_token }}
+          repository_url: https://test.pypi.org/legacy/
+          print_hash: true
+      #     skip_existing: true
+      #     skip_existing
+      #     skip_existing
index 14d8cb4f9149acc75fde8fcb310eb802b26aee40..22d45fdcf9f2dda0010798b013edab1789c573b5 100644 (file)
@@ -95,6 +95,8 @@ warn_unused_ignores = false
 before-test = ""
 test-requires = "pytest pytest-xdist"
 # Need to change root directory, otherisw the plugin won't find setup.cfg
+# Todo: move this to a .sh file, and run
+# python -c 'from sqlalchemy.util import has_compiled_ext; assert has_compiled_ext()'
 test-command = "(cd {project}; pytest --trace-config;  pytest -n2 -q test --nomemory --notimingintensive)"
 
 build = "*"