diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 97df0d6f7..35f42fef1 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -69,116 +69,69 @@ jobs: env: WHITESOURCE_API_KEY: ${{ secrets.WHITESOURCE_API_KEY }} - build-manylinux: + build: needs: lint - name: Build linux-py${{ matrix.python-version }} - runs-on: ubuntu-latest - container: quay.io/pypa/manylinux2010_x86_64 strategy: matrix: + os: + - image: ubuntu-20.04 + id: manylinux_x86_64 + - image: ubuntu-20.04 + id: manylinux_aarch64 + - image: windows-2019 + id: win_amd64 + - image: macos-10.15 + id: macosx_x86_64 + - image: macos-10.15 + id: macosx_arm64 python-version: ["3.7", "3.8", "3.9", "3.10"] + exclude: + - os: + id: macosx_arm64 + python-version: 3.7 + name: Build ${{ matrix.os.id }}-py${{ matrix.python-version }} + runs-on: ${{ matrix.os.image }} steps: - - uses: actions/checkout@v1 - - name: Updating path - run: | - echo "/opt/python/cp37-cp37m/bin/" >> $GITHUB_PATH - echo "/opt/python/cp38-cp38/bin/" >> $GITHUB_PATH - echo "/opt/python/cp39-cp39/bin/" >> $GITHUB_PATH - echo "/opt/python/cp310-cp310/bin/" >> $GITHUB_PATH - - name: Display Python version - run: python${{ matrix.python-version }} -c "import sys; print(sys.version)" - - name: Upgrade setuptools, pip, wheel and build - run: python${{ matrix.python-version }} -m pip install -U setuptools pip wheel build - - name: Generate wheel - run: python${{ matrix.python-version }} -m build --wheel --outdir dist_tmp . - - name: Run auditwheel - run: auditwheel repair --plat manylinux2014_x86_64 -L connector dist_tmp/snowflake_connector_python*.whl -w dist - - name: Show wheels generated - run: ls -lh dist - - uses: actions/upload-artifact@v1 + - name: Set shortver + run: echo "shortver=${longver//./}" >> $GITHUB_ENV + env: + longver: ${{ matrix.python-version }} + shell: bash + - name: Set up QEMU + if: ${{ matrix.os.id == 'manylinux_aarch64' }} + uses: docker/setup-qemu-action@v1 with: - name: linux_py${{ matrix.python-version }} - path: dist/ - - build-macos: - needs: lint - name: Build macos-py${{ matrix.python.version }} - runs-on: macos-latest - strategy: - matrix: - python: - - version: "3.7" - link: https://www.python.org/ftp/python/3.7.0/python-3.7.0-macosx10.9.pkg - - version: "3.8" - link: https://www.python.org/ftp/python/3.8.0/python-3.8.0-macosx10.9.pkg - - version: "3.9" - link: https://www.python.org/ftp/python/3.9.0/python-3.9.0-macosx10.9.pkg - - version: "3.10" - link: https://www.python.org/ftp/python/3.10.0/python-3.10.0post2-macos11.pkg - steps: + platforms: all - uses: actions/checkout@v2 - - name: Setup Python - run: | - curl "${{ matrix.python.link }}" -o python.pkg - sudo installer -pkg python.pkg -target / - curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py - python3 get-pip.py - - name: Display Python version - run: python3 -c "import sys; print(sys.version)" - - name: Upgrade setuptools, pip, wheel and build - run: python3 -m pip install -U setuptools pip wheel build - - name: Generate wheel - run: python3 -m build --wheel . + - name: Building wheel + uses: pypa/cibuildwheel@v2.3.1 env: + CIBW_BUILD: cp${{ env.shortver }}-${{ matrix.os.id }} MACOSX_DEPLOYMENT_TARGET: 10.14 # Should be kept in sync with ci/build_darwin.sh - - name: Show wheels generated - run: ls -lh dist/ - - uses: actions/upload-artifact@v2 - with: - name: macos_py${{ matrix.python.version }} - path: dist/ - - build-windows: - needs: lint - name: Build windows-py${{ matrix.python-version }} - runs-on: windows-latest - strategy: - matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] - steps: - - uses: actions/checkout@v2 - - name: Setup python - uses: actions/setup-python@main with: - python-version: ${{ matrix.python-version }} - - name: Display Python version - run: python -c "import sys; print(sys.version)" - - name: Upgrade setuptools, pip, wheel and build - run: python -m pip install -U setuptools pip wheel build - - name: Generate wheel - run: python -m build --wheel . + output-dir: dist - name: Show wheels generated run: ls -lh dist shell: bash - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v1 with: - name: windows_py${{ matrix.python-version }} + name: ${{ matrix.os.id }}_py${{ matrix.python-version }} path: dist/ test: name: Test ${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - needs: [build-manylinux, build-macos, build-windows] + needs: build runs-on: ${{ matrix.os.image_name }} strategy: fail-fast: false matrix: os: - image_name: ubuntu-latest - download_name: linux + download_name: manylinux_x86_64 - image_name: macos-latest - download_name: macos + download_name: macosx_x86_64 - image_name: windows-2019 - download_name: windows + download_name: win_amd64 python-version: ["3.7", "3.8", "3.9", "3.10"] cloud-provider: [aws, azure, gcp] steps: @@ -267,7 +220,7 @@ jobs: test-fips: name: Test FIPS linux-3.7-${{ matrix.cloud-provider }} - needs: build-manylinux + needs: build runs-on: ubuntu-latest strategy: fail-fast: false @@ -285,7 +238,7 @@ jobs: - name: Download wheel(s) uses: actions/download-artifact@v2 with: - name: linux_py3.7 + name: manylinux_x86_64_py3.7 path: dist - name: Show wheels downloaded run: ls -lh dist diff --git a/pyproject.toml b/pyproject.toml index 5781e5924..ad1f850c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,3 +8,20 @@ requires = [ # Must be kept in sync with the `setup_requirements` in `setup.cfg` "pyarrow>=6.0.0,<6.1.0", ] + +[tool.cibuildwheel] +test-skip = "*" +manylinux-x86_64-image = "manylinux2010" +environment = {AUDITWHEEL_PLAT="manylinux2014_$(uname -m)"} +build-verbosity = 1 + +[tool.cibuildwheel.linux] +archs = ["x86_64", "aarch64"] + +[tool.cibuildwheel.macos] +archs = ["x86_64", "arm64"] +# Don't repair macOS wheels +repair-wheel-command = "" + +[tool.cibuildwheel.windows] +archs = ["AMD64"]