diff options
author | Bob Ippolito <bob@redivi.com> | 2021-09-29 12:39:57 -0700 |
---|---|---|
committer | Bob Ippolito <bob@redivi.com> | 2021-11-15 10:21:40 -0800 |
commit | d0746cc87cb01e30280e5e5106c426e1909f7a45 (patch) | |
tree | ff8452331b5d07f7689964e327185f0007080f3d | |
parent | dc336dea43ed57a14445339eade738845adaab2e (diff) | |
download | xattr-d0746cc87cb01e30280e5e5106c426e1909f7a45.tar.gz |
Switch to github actions
-rw-r--r-- | .github/workflows/build-and-deploy.yml | 116 | ||||
-rw-r--r-- | .travis.yml | 59 | ||||
-rwxr-xr-x | .travis/install.sh | 33 | ||||
-rwxr-xr-x | .travis/run.sh | 29 | ||||
-rw-r--r-- | pyproject.toml | 14 | ||||
-rw-r--r-- | setup.py | 5 | ||||
-rw-r--r-- | xattr/tests/__init__.py | 1 |
7 files changed, 134 insertions, 123 deletions
diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml new file mode 100644 index 0000000..ad5a636 --- /dev/null +++ b/.github/workflows/build-and-deploy.yml @@ -0,0 +1,116 @@ +name: Build and upload to PyPI + +# Build on every branch push, tag push, and pull request change: +on: [push, pull_request] +# Alternatively, to publish when a (published) GitHub Release is created, use the following: +# on: +# push: +# pull_request: +# release: +# types: +# - published + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - 'ubuntu-latest' + - 'macos-latest' + + steps: + - uses: actions/checkout@v2 + + - name: Set up QEMU + if: runner.os == 'Linux' + uses: docker/setup-qemu-action@v1 + with: + platforms: arm64 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.2.2 + env: + CIBW_BUILD_FRONTEND: "build" + CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 + CIBW_MANYLINUX_I686_IMAGE: manylinux2014 + CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 + CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: manylinux2014 + CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux2014 + CIBW_MANYLINUX_PYPY_I686_IMAGE: manylinux2014 + CIBW_ARCHS_LINUX: "auto aarch64" + CIBW_ARCHS_MACOS: "x86_64 universal2 arm64" + + - name: Build Python 2.7 wheels + if: runner.os != 'Windows' + uses: pypa/cibuildwheel@v1.12.0 + env: + CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010 + CIBW_MANYLINUX_I686_IMAGE: manylinux2010 + CIBW_BUILD: "cp27-*" + CIBW_SKIP: "pp*" + CIBW_ARCHS_LINUX: "auto aarch64" + + - uses: actions/upload-artifact@v2 + if: "github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')" + with: + path: ./wheelhouse/*.whl + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + name: Install Python + with: + python-version: '3.9' + + - name: Build sdist + run: python setup.py sdist + + - uses: actions/upload-artifact@v2 + if: "github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')" + with: + 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.event.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/ + + upload_pypi_test: + 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.event.ref, 'refs/tags/test-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_TEST }} + repository_url: https://test.pypi.org/legacy/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7e436af..0000000 --- a/.travis.yml +++ /dev/null @@ -1,59 +0,0 @@ -language: python -cache: - directories: - - "$HOME/.cache/pip" - - "$HOME/.pyenv" -matrix: - include: - - name: 'Ubuntu: 3.8' - os: linux - python: 3.8 - - name: 'Ubuntu: 3.7' - os: linux - python: 3.7 - - name: 'Ubuntu: 3.6' - os: linux - python: 3.6 - - name: 'Ubuntu: 3.5' - os: linux - python: 3.5 - - name: 'Ubuntu: 2.7' - os: linux - python: 2.7 - - name: 'Ubuntu: PyPy 3.5' - os: linux - env: PYPY_URL=https://bitbucket.org/pypy/pypy/downloads/pypy3-v6.0.0-linux64.tar.bz2 - - name: 'Ubuntu: PyPy 2.7' - os: linux - env: PYPY_URL=https://bitbucket.org/pypy/pypy/downloads/pypy2-v6.0.0-linux64.tar.bz2 - - name: 'OSX: 3.7' - os: osx - language: generic - env: PYENV_VERSION=3.7.4 BUILD_SDIST=true - osx_image: xcode_9.4 - - name: 'OSX: 3.6' - os: osx - language: generic - env: PYENV_VERSION=3.6.5 - osx_image: xcode_9.4 - - name: 'OSX: 2.7' - os: osx - language: generic - env: PYENV_VERSION=2.7.15 - osx_image: xcode_9.4 -install: -- "./.travis/install.sh" -script: -- "./.travis/run.sh" -deploy: - provider: releases - api_key: - secure: ik/Btxv+NMOGjKuNnilYSeATYwL7sHy8nildzQcF+GMCFL8mDcerXRoC1jOF+ETsmSOAZ95NOEUGNiyvCApy4VgYvBvz7mJzdaob034+GXOStEIdBBvV8v9XB9XwQpJUUGvRMSF9WMUGmhyQ9PQEPOHfERgLkdlcY24djCJm/6A= - file: - - dist/*.whl - - dist/*.tar.gz - file_glob: true - on: - repo: xattr/xattr - tags: true - skip_cleanup: true diff --git a/.travis/install.sh b/.travis/install.sh deleted file mode 100755 index 1ff4a03..0000000 --- a/.travis/install.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -set -e -set -x - -install_pypy() { - pypy_dir="/home/travis/pypy" - curl -L "$PYPY_URL" -o "pypy.tar.bz2" - mkdir "$pypy_dir" - tar xf "pypy.tar.bz2" -C "$pypy_dir" --strip-components=1 - if [ -f "$pypy_dir/bin/pypy" ]; then - ln -s "$pypy_dir/bin/pypy" "pypy" - elif [ -f "$pypy_dir/bin/pypy3" ]; then - ln -s "$pypy_dir/bin/pypy3" "pypy" - fi - ./pypy -m ensurepip -} - -install_pyenv() { - brew update > /dev/null - brew upgrade readline openssl pyenv - eval "$(pyenv init -)" - pyenv install -sv "$PYENV_VERSION" - pip install --upgrade pip - pyenv rehash - python -m pip install wheel -} - -if [[ -n "$PYPY_URL" ]]; then - install_pypy -elif [[ -n "$PYENV_VERSION" && "$TRAVIS_OS_NAME" == "osx" ]]; then - install_pyenv -fi diff --git a/.travis/run.sh b/.travis/run.sh deleted file mode 100755 index 206bf68..0000000 --- a/.travis/run.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -set -e -set -x - -if [[ -n "$PYENV_VERSION" ]]; then - eval "$(pyenv init -)" -fi - -if [[ -n "$PYPY_URL" ]]; then - cmd=./pypy -else - cmd=python -fi - -"$cmd" setup.py build_ext -i -"$cmd" -m compileall -f . -"$cmd" setup.py test - -if [[ -n "$PYENV_VERSION" && "$TRAVIS_OS_NAME" == 'osx' ]]; then - python setup.py bdist_wheel -fi - -if [[ "$BUILD_SDIST" == 'true' ]]; then - "$cmd" setup.py sdist --formats=gztar - # Ensure the package installs from tarball correctly. - filename=$("$cmd" setup.py --fullname) - pip install "dist/$filename.tar.gz" -fi diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..13cbddf --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[tool.cibuildwheel] +test-requires = "pytest" +test-command = "pytest {project}/xattr/tests" + +[tool.cibuildwheel.linux] +before-all = "yum install -y libffi-devel" + +[[tool.cibuildwheel.overrides]] +select = "*-manylinux2_*" +before-all = "apt-get -y install libffi-dev" + +[[tool.cibuildwheel.overrides]] +select = "*-musllinux*" +before-all = "apk add libffi-dev"
\ No newline at end of file @@ -49,8 +49,9 @@ setup( "xattr = xattr.tool:main", ], }, - install_requires=["cffi>=1.0.0"], - setup_requires=["cffi>=1.0.0"], + # Keep this in sync with pyproject.toml + install_requires=["cffi>=1.0"], + setup_requires=["cffi>=1.0"], cffi_modules=["xattr/lib_build.py:ffi"], test_suite="xattr.tests.all_tests_suite", zip_safe=False, diff --git a/xattr/tests/__init__.py b/xattr/tests/__init__.py index 739dd58..3e75a10 100644 --- a/xattr/tests/__init__.py +++ b/xattr/tests/__init__.py @@ -6,6 +6,7 @@ import unittest def all_tests_suite(): suite = unittest.TestLoader().loadTestsFromNames([ 'xattr.tests.test_xattr', + 'xattr.tests.test_tool', ]) return suite |