]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
improve linux build 5241/head
authorFederico Caselli <cfederico87@gmail.com>
Thu, 9 Apr 2020 21:02:12 +0000 (23:02 +0200)
committerFederico Caselli <cfederico87@gmail.com>
Thu, 9 Apr 2020 21:02:12 +0000 (23:02 +0200)
Change-Id: I9bde5fb2cd9997c620d8ee3173fcd7fc6d80cae7

.github/workflows/create-wheels.yaml

index d3005a2bba4dc5c7d5c2988b8ece0735d977efa5..02bf73b433b838313ffd1a63c6449de3e6975673 100644 (file)
@@ -139,16 +139,20 @@ jobs:
         os:
           - "ubuntu-latest"
         python-version:
-          - "2.7"
-          - "3.5"
-          - "3.6"
-          - "3.7"
-          - "3.8"
+          # the versions are <python tag>-<abi tag> as specified in PEP 425.
+          - cp27-cp27m
+          - cp27-cp27mu
+          - cp35-cp35m
+          - cp36-cp36m
+          - cp37-cp37m
+          - cp38-cp38
         architecture:
           - x64
 
         include:
-          - python-version: "2.7"
+          - python-version: "cp27-cp27m"
+            extra-requires: "mock"
+          - python-version: "cp27-cp27mu"
             extra-requires: "mock"
 
       fail-fast: false
@@ -156,11 +160,22 @@ jobs:
     steps:
       - name: Checkout repo
         uses: actions/checkout@v2
+      
+      - name: Get python version
+        id: linux-py-version
+        env:
+          py_tag: ${{ matrix.python-version }}
+        # the command `echo "::set-output ...` is used to create an step output that can be used in following steps
+        # this is from https://github.community/t5/GitHub-Actions/Using-the-output-of-run-inside-of-if-condition/td-p/33920
+        run: |
+          version="${py_tag: 2:1}.${py_tag: 3:1}"
+          echo $version
+          echo "::set-output name=python-version::$version"
 
       - name: Set up Python
         uses: actions/setup-python@v1
         with:
-          python-version: ${{ matrix.python-version }}
+          python-version: ${{  steps.linux-py-version.outputs.python-version }}
           architecture: ${{ matrix.architecture }}
 
       - name: Remove tag_build from setup.cfg
@@ -176,22 +191,6 @@ jobs:
         run: |
           (cat setup.cfg) | %{$_ -replace "tag_build.?=.?dev",""} | set-content setup.cfg
 
-      - name: Create python PEP 425 tag for manylinux build
-        id: linux-py-version
-        env:
-          pyversion: ${{ matrix.python-version }}
-        # this steps creates the proper <python tag>-<abi tag> as specified in PEP 425.
-        # NOTE: python 38+ removed the `m` at the end, so this script is used to generate the proper abi tag
-
-        # the command `echo "::set-output ...` is used to create an step output that can be used in following steps
-        # this is from https://github.community/t5/GitHub-Actions/Using-the-output-of-run-inside-of-if-condition/td-p/33920
-        run: |
-          pv="${pyversion/./}"
-          [ "$pv" -lt "38" ] && end=m || end=''
-          pytag="cp${pv}-cp${pv}$end"
-          echo $pytag
-          echo "::set-output name=python-version::$pytag"
-
       - name: Create wheel for manylinux
         # this step uses the image provided by pypa here https://github.com/pypa/manylinux to generate the wheels on linux
         # the action uses the image for manylinux2010 but can generate also a manylinux1 wheel
@@ -201,28 +200,32 @@ jobs:
         # this action generates 3 wheels in wheelhouse/. linux, manylinux1 and manylinux2010
         with:
           # python-versions is the output of the previous step and is in the form <python tag>-<abi tag>. Eg cp37-cp37mu
-          python-versions: ${{ steps.linux-py-version.outputs.python-version }}
+          python-versions: ${{ matrix.python-version }}
           build-requirements: "setuptools wheel"
           # Create the wheel using --no-use-pep517 since locally we have pyproject
           # This flag should be removed once sqlalchemy supports pep517
           # `--no-deps` is used to only generate the wheel for the current library. Redundant in sqlalchemy since it has no dependencies
           pip-wheel-args: "--no-use-pep517 -v --no-deps"
 
-      - name: Install wheel
-        # install the created wheel without using the pypi index
-        run: |
-          pip install -U pip
-          pip --version
-          pip install -f wheelhouse --no-index sqlalchemy
-
-      - name: Check c extensions
-        run: |
-          python -c 'from sqlalchemy import cprocessors, cresultproxy, cutils'
-
-      - name: Test created wheel
+      - name: Check created wheel
+        # check that the wheel is compatible with the current installation.
+        # If it is then does:
+        # - install the created wheel without using the pypi index
+        # - check the c extension
+        # - runs the tests
         run: |
-          pip install pytest pytest-xdist ${{ matrix.extra-requires }}
-          pytest -n2 -q test -k 'not MockReconnectTest' --nomemory
+          pip install -q wheel
+          version=`python -W ignore -c 'from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag; print("{0}{1}-{2}".format(get_abbr_impl(), get_impl_ver(), get_abi_tag()))'`
+          echo Wheel tag ${{ matrix.python-version }}. Installed version $version.
+          if [[ "${{ matrix.python-version }}" = "$version" ]]
+          then
+            pip install -f wheelhouse --no-index sqlalchemy
+            python -c 'from sqlalchemy import cprocessors, cresultproxy, cutils'
+            pip install pytest pytest-xdist ${{ matrix.extra-requires }}
+            pytest -n2 -q test -k 'not MockReconnectTest' --nomemory
+          else
+            echo Not compatible. Skipping install.
+          fi
 
       - name: Get wheel names
         id: wheel-name