From a71ea66b7aff6567f2252cb948b42a4e50895c98 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 21 Aug 2024 16:12:54 -0700 Subject: [PATCH] Attempt to set up CI --- .github/workflows/lint.yml | 35 +++++++++++++++++++ .github/workflows/publish.yml | 63 +++++++++++++++++++++++++++++++++++ setup.py | 18 ++-------- tox.ini | 6 +++- 4 files changed, 105 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..106a4748 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,35 @@ +name: Lint + +on: [push, pull_request] + +concurrency: + group: check-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: test with ${{ matrix.py }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + py: + - "3.8" + os: + - ubuntu-latest + - macos-latest + - windows-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup python for test ${{ matrix.py }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.py }} + - name: Install tox + run: python -m pip install tox-gh>=1.2 + - name: Setup test suite + run: tox -vv --notest + - name: Run test suite + run: tox --skip-pkg-install \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..7f414711 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,63 @@ +# Based on +# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ + +name: Publish Python distribution to PyPI + +on: + release: + types: [published] + push: + branches: [main] + pull_request: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install pypa/build + run: | + python -m pip install --upgrade build + python -m pip list + - name: Build a binary wheel and a source tarball + run: python -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: >- + Publish Python distribution to PyPI + if: github.event_name == 'release' # only publish to PyPI on releases + needs: + - build + runs-on: ubuntu-latest + environment: + name: release + url: https://pypi.org/p/compat-fork-hyper + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/setup.py b/setup.py index 94cd8d21..4f876b35 100644 --- a/setup.py +++ b/setup.py @@ -69,15 +69,11 @@ def run_tests(self): 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: Implementation :: CPython', ], install_requires=[ - 'h2>=2.4,<3.0,!=2.5.0', 'hyperframe>=3.2,<4.0', 'rfc3986>=1.1.0,<2.0', 'brotlipy>=0.7.0,<1.0' + 'h2>=2.4', 'hyperframe>=3.2', 'rfc3986>=1.1.0', 'brotlipy>=0.7.0' ], tests_require=['pytest', 'requests', 'mock'], cmdclass={'test': PyTest}, @@ -88,15 +84,5 @@ def run_tests(self): }, extras_require={ 'fast': ['pycohttpparser'], - # Fallback to good SSL on bad Python versions. - ':python_full_version < "2.7.9"': [ - 'pyOpenSSL>=0.15', 'service_identity>=14.0.0' - ], - # PyPy with bad SSL modules will likely also need the cryptography - # module at lower than 1.0, because it doesn't support CFFI v1.0 yet. - ':platform_python_implementation == "PyPy" and python_full_version < "2.7.9"': [ - 'cryptography<1.0' - ], - ':python_version == "2.7" or python_version == "3.3"': ['enum34>=1.0.4, <2'] } ) diff --git a/tox.ini b/tox.ini index 046619e9..49cec290 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{27,34,35,36}, pypy, lint +envlist = py{38}, pypy, lint [testenv] deps= -r{toxinidir}/test_requirements.txt @@ -15,3 +15,7 @@ commands= py.test {toxinidir}/test/ basepython=python3 deps = flake8==2.5.4 commands = flake8 hyper test + +[gh] +python = + 3.8 = py38,lint