diff --git a/.github/workflows/actions/entrypoint.sh b/.github/workflows/actions/entrypoint.sh deleted file mode 100755 index c819409..0000000 --- a/.github/workflows/actions/entrypoint.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# if testing locally try the docker image interactively -# docker run --net=host -it --rm -v $(pwd):/home/ quay.io/pypa/manylinux2010_x86_64 - -PYTHONS=("cp38-cp38" "cp39-cp39" "cp310-cp310") - -for PYTHON in ${PYTHONS[@]}; do - /opt/python/${PYTHON}/bin/pip install --upgrade pip wheel setuptools setuptools_scm build twine auditwheel - /opt/python/${PYTHON}/bin/pip install oldest-supported-numpy - /opt/python/${PYTHON}/bin/python -m build --sdist --wheel . --outdir /github/workspace/wheelhouse/ -done - -for whl in /github/workspace/wheelhouse/gsw*.whl; do - auditwheel repair $whl -done diff --git a/.github/workflows/actions/manylinux2010_x86_64/action.yml b/.github/workflows/actions/manylinux2010_x86_64/action.yml deleted file mode 100644 index 4ddbd10..0000000 --- a/.github/workflows/actions/manylinux2010_x86_64/action.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: 'build wheels with manylinux2010_x86_64' -description: 'build wheels with manylinux2010_x86_64' -runs: - using: 'docker' - image: docker://quay.io/pypa/manylinux2010_x86_64 - args: - - .github/workflows/actions/entrypoint.sh diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml deleted file mode 100644 index 7809153..0000000 --- a/.github/workflows/build_linux.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: linux-wheels - -on: - release: - types: - - published - -jobs: - packages: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Get tags - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - shell: bash - - - uses: ./.github/workflows/actions/manylinux2010_x86_64 - - name: copy manylinux wheels - run: | - mkdir dist - cp wheelhouse/gsw*manylinux2010_x86_64.whl dist/ - - - name: CheckFiles - run: | - ls dist - shell: bash - - - name: Test wheels - run: | - python -m pip install wheel twine - python -m pip install pytest numpy - cd dist && python -m pip install gsw*.whl && python -m pytest --pyargs gsw - python -m twine check * - shell: bash - - - name: Publish a Python distribution to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.PYPI_PASSWORD }} diff --git a/.github/workflows/build_mac.yml b/.github/workflows/build_mac.yml deleted file mode 100644 index c3234af..0000000 --- a/.github/workflows/build_mac.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: macOS-wheels - -on: - release: - types: - - published - -jobs: - packages: - name: Build wheel on ${{ matrix.os }} and ${{ matrix.python-version }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest] - python-version: ["3.8", "3.9", "3.10"] - - steps: - - uses: actions/checkout@v3 - - - name: Get tags - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - shell: bash - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install build tools - run: | - python -m pip install --upgrade pip wheel setuptools setuptools_scm build twine - python -m pip install oldest-supported-numpy - shell: bash - - - name: Build binary wheel - run: python -m build --wheel . --outdir dist - - - name: CheckFiles - run: | - ls dist - shell: bash - - - name: Test wheels - run: | - python -m pip install wheel twine - python -m pip install pytest numpy - cd dist && python -m pip install gsw*.whl && python -m pytest --pyargs gsw - python -m twine check * - shell: bash - - - name: upload wheel - uses: actions/upload-artifact@v3 - with: - name: dist_${{ matrix.os }}_${{ matrix.python-version }} - path: dist diff --git a/.github/workflows/build_win.yml b/.github/workflows/build_win.yml deleted file mode 100644 index 3f49872..0000000 --- a/.github/workflows/build_win.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: windows-wheels - -on: - release: - types: - - published - -jobs: - packages: - name: Build wheel on ${{ matrix.os }} and ${{ matrix.python-version }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-latest] - python-version: ["3.8", "3.9", "3.10"] - - steps: - - uses: actions/checkout@v3 - - - name: Get tags - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - shell: bash - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install build tools - run: | - python -m pip install --upgrade pip wheel setuptools setuptools_scm build twine - python -m pip install oldest-supported-numpy - shell: bash - - - name: Build binary wheel - run: python -m build --wheel . --outdir dist - - - name: CheckFiles - run: | - ls dist - shell: bash - - - name: Test wheels - run: | - python -m pip install wheel twine - python -m pip install pytest numpy - cd dist && python -m pip install gsw*.whl && python -m pytest --pyargs gsw - python -m twine check * - shell: bash - - - name: upload wheel - uses: actions/upload-artifact@v3 - with: - name: dist_${{ matrix.os }}_${{ matrix.python-version }} - path: dist diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml new file mode 100644 index 0000000..4a025e1 --- /dev/null +++ b/.github/workflows/cibuildwheel.yml @@ -0,0 +1,87 @@ +name: Wheels + +on: + pull_request: + + push: + tags: + - "v*" + +jobs: + build_bdist: + name: "Build ${{ matrix.os }} (${{ matrix.arch }}) wheels" + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest", "windows-latest", "macos-latest"] + arch: ["x86_64", "arm64", "AMD64"] + exclude: + - os: ubuntu-latest + arch: arm64 + - os: ubuntu-latest + arch: AMD64 + - os: windows-latest + arch: arm64 + - os: windows-latest + arch: x86_64 + - os: macos-latest + arch: AMD64 + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" + uses: pypa/cibuildwheel@v2.9.0 + env: + # Skips pypy and musllinux for now. + CIBW_SKIP: "pp* cp36-* cp37-* *-musllinux*" + CIBW_ARCHS: ${{ matrix.arch }} + CIBW_BUILD_FRONTEND: build + CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 + CIBW_TEST_SKIP: "*_arm64" + CIBW_TEST_REQUIRES: pytest + CIBW_TEST_COMMAND: > + python -c "import gsw; print(f'gsw v{gsw.__version__}')" && + python -m pytest --pyargs gsw + + - uses: actions/upload-artifact@v3 + with: + name: pypi-artifacts + path: ${{ github.workspace }}/wheelhouse/*.whl + + + show-artifacts: + needs: [build_bdist] + name: "Show artifacts" + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v3 + with: + name: pypi-artifacts + path: ${{ github.workspace }}/dist + + - shell: bash + run: | + ls -l ${{ github.workspace }}/dist + + + publish-artifacts-pypi: + needs: [build_bdist] + name: "Publish to PyPI" + runs-on: ubuntu-latest + # upload to PyPI for every tag starting with 'v' + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') + steps: + - uses: actions/download-artifact@v3 + with: + name: pypi-artifacts + path: ${{ github.workspace }}/dist + + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_PASSWORD }} + print_hash: true