]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
ci: move CI to github actions 3100/head
authorBen Darnell <ben@bendarnell.com>
Fri, 31 Dec 2021 20:26:28 +0000 (15:26 -0500)
committerBen Darnell <ben@bendarnell.com>
Sun, 16 Jan 2022 21:43:19 +0000 (16:43 -0500)
Our previous CI on Travis has been broken for a while due to their
move from travis-ci.org to travis-ci.com. Instead of fixing things up
there, move everything to github actions.

.github/workflows/build.yml [new file with mode: 0644]
.github/workflows/test.yml [new file with mode: 0644]
.travis.yml [deleted file]
pyproject.toml [new file with mode: 0644]
tornado/test/options_test.py

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644 (file)
index 0000000..71bb15e
--- /dev/null
@@ -0,0 +1,63 @@
+# The "build" workflow produces wheels (and the sdist) for all python
+# versions/platforms. Where possible (i.e. the build is not a cross-compile),
+# the test suite is also run for the wheel (this test covers fewer
+# configurations than the "test" workflow and tox.ini).
+name: Build
+
+on:
+  push:
+    branches:
+      # Run on release branches.
+      - "branch[0-9]*"
+      # Also run on certain other branches for testing.
+      - "build_workflow*"
+
+env:
+  python-version: '3.9'
+
+jobs:
+  build_sdist:
+    name: Build sdist
+    runs-on: ubuntu-20.04
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        name: Install Python
+        with:
+          python-version: ${{ env.python-version }}
+
+      - name: Check metadata
+        run: "python setup.py check"
+      - name: Build sdist
+        run: "python setup.py sdist && ls -l dist"
+
+      - uses: actions/upload-artifact@v2
+        with:
+          path: ./dist/tornado-*.tar.gz
+
+  build_wheels:
+    name: Build wheels on ${{ matrix.os }}
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        os: [ubuntu-20.04, windows-2019, macos-10.15]
+
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        name: Install Python
+        with:
+          python-version: ${{ env.python-version }}
+      - name: Set up QEMU
+        if: runner.os == 'Linux'
+        uses: docker/setup-qemu-action@v1
+        with:
+          platforms: all
+
+      - name: Build wheels
+        uses: pypa/cibuildwheel@v2.3.1
+
+      - uses: actions/upload-artifact@v2
+        with:
+          path: ./wheelhouse/*.whl
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644 (file)
index 0000000..fff9b40
--- /dev/null
@@ -0,0 +1,66 @@
+# The "test" workflow is run on every PR and runs tests across all
+# supported python versions and a range of configurations
+# specified in tox.ini. Also see the "build" workflow which is only
+# run for release branches and covers platforms other than linux-amd64
+# (Platform-specific issues are rare these days so we don't want to
+# take that time on every build).
+
+name: Test
+
+on: pull_request
+
+jobs:
+  # Before starting the full build matrix, run one test configuration
+  # and the linter (the `black` linter is especially likely to catch
+  # first-time contributors).
+  test_quick:
+    name: Run quick tests
+    runs-on: ubuntu-20.04
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        name: Install Python
+        with:
+          # Lint python version must be synced with tox.ini
+          python-version: '3.8'
+      - name: Install tox
+        run: python -m pip install tox
+
+      - name: Run test suite
+        run: python -m tox -e py38,lint
+
+  test_tox:
+    name: Run full tests
+    needs: test_quick
+    runs-on: ubuntu-20.04
+    strategy:
+      matrix:
+        include:
+          - python: '3.7'
+            tox_env: py37-full
+          - python: '3.8'
+            tox_env: py38-full
+          - python: '3.9'
+            tox_env: py39-full
+          - python: 'pypy3'
+            # Pypy is a lot slower due to jit warmup costs, so don't run the
+            # "full" test config there.
+            tox_env: pypy3
+          - python: '3.8'
+            # Docs python version must be synced with tox.ini
+            tox_env: docs
+
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        name: Install Python
+        with:
+          python-version: ${{ matrix.python}}
+      - name: Install apt packages
+        run: sudo apt-get update && sudo apt-get install libcurl4-openssl-dev
+      - name: Install tox
+        run: python -m pip install tox
+
+      - name: Run test suite
+        run: python -m tox -e ${{ matrix.tox_env }}
+  
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644 (file)
index f7b1e82..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-# https://travis-ci.org/tornadoweb/tornado
-
-os: linux
-dist: xenial
-language: python
-addons:
-  apt:
-    packages:
-      - libgnutls-dev
-
-env:
-  global:
-    - CIBW_BUILD="cp3[6789]*"
-    - CIBW_TEST_COMMAND="python3 -m tornado.test"
-    - CIBW_TEST_COMMAND_WINDOWS="python -m tornado.test --fail-if-logs=false"
-
-# Before starting the full build matrix, run one test configuration
-# and the linter (the `black` linter is especially likely to catch
-# first-time contributors).
-stages:
-  - quick
-  - test
-
-jobs:
-  fast_finish: true
-  include:
-    # We have two and a half types of builds: Wheel builds run on all supported
-    # platforms and run the basic test suite for all supported python versions.
-    # Sdist builds (the "and a half") just build an sdist and run some basic
-    # validation. Both of these upload their artifacts to pypi if there is a
-    # tag on the build and the key is available.
-    #
-    # Tox builds run a more comprehensive test suite with more configurations
-    # and dependencies (getting all these dependencies installed for wheel
-    # builds is a pain, and slows things down because we don't use as much
-    # parallelism there. We could parallelize wheel builds more but we're also
-    # amortizing download costs across the different builds). The wheel builds
-    # take longer, so we run them before the tox builds for better bin packing
-    # in our allotted concurrency.
-    - python: '3.8'
-      arch: amd64
-      services: docker
-      env: BUILD_WHEEL=1
-    - python: '3.8'
-      arch: arm64
-      services: docker
-      env: BUILD_WHEEL=1  ASYNC_TEST_TIMEOUT=15
-    - os: windows
-      env: PATH=/c/Python38:/c/Python38/Scripts:$PATH BUILD_WHEEL=1
-      language: shell
-      before_install:
-        - choco install python --version 3.8.0
-        # Windows build images have outdated root certificates; until that's
-        # fixed use certifi instead.
-        # https://github.com/joerick/cibuildwheel/issues/452
-        - python -m pip install certifi
-        - export SSL_CERT_FILE=`python -c "import certifi; print(certifi.where())"`
-    - os: osx
-      env: BUILD_WHEEL=1
-      language: shell
-
-    - python: '3.8'
-      arch: amd64
-      env: BUILD_SDIST=1
-
-    - python: '3.6'
-      env: TOX_ENV=py36-full
-    - python: '3.7'
-      env: TOX_ENV=py37-full
-    - python: '3.8'
-      env: TOX_ENV=py38-full
-    - python: '3.9-dev'
-      env: TOX_ENV=py39-full
-    - python: nightly
-      env: TOX_ENV=py3
-    - python: pypy3.6-7.3.1
-      # Pypy is a lot slower due to jit warmup costs, so don't run the "full"
-      # test config there.
-      env: TOX_ENV=pypy3
-    # Docs and lint python versions must be synced with those in tox.ini
-    - python: '3.8'
-      env: TOX_ENV=docs
-
-    # the quick stage runs first, but putting this at the end lets us take
-    # advantage of travis-ci's defaults and not repeat stage:test in the others.
-    - python: '3.8'
-      env: TOX_ENV=py38,lint
-      stage: quick
-
-install:
-  - if [[ -n "$TOX_ENV" ]]; then pip3 install tox; fi
-  - if [[ -n "$BUILD_WHEEL" ]]; then pip3 install cibuildwheel; fi
-  - if [[ -n "$BUILD_WHEEL" || -n "$BUILD_SDIST" ]]; then pip3 install twine; fi
-
-script:
-  - if [[ -n "$TOX_ENV" ]]; then tox -e $TOX_ENV -- $TOX_ARGS; fi
-  - if [[ -n "$BUILD_WHEEL" ]]; then cibuildwheel --output-dir dist && ls -l dist; fi
-  - if [[ -n "$BUILD_SDIST" ]]; then python setup.py check sdist && ls -l dist; fi
-
-after_success:
-  - if [[ ( -n "$BUILD_WHEEL" || -n "$BUILD_SDIST" ) && -n "$TRAVIS_TAG" && -n "$TWINE_PASSWORD" ]]; then twine upload -u __token__ dist/*; fi
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644 (file)
index 0000000..73200f4
--- /dev/null
@@ -0,0 +1,26 @@
+[tool.cibuildwheel]
+build = "cp3[789]*"
+test-command = "python -m tornado.test"
+
+[tool.cibuildwheel.macos]
+archs = "x86_64 universal2"
+# The arm portion of a universal wheel is a cross-compile and cannot
+# be tested on an x86 host. This must be configured explicitly to silence
+# a warning.
+test-skip = "*_universal2:arm64"
+
+[tool.cibuildwheel.windows]
+# TODO: figure out what's going on with these occasional log messages.
+test-command = "python -m tornado.test --fail-if-logs=false"
+
+[tool.cibuildwheel.linux]
+# Build wheels for the native platform (i.e. x86) as well as an emulated
+# build for aarch64.
+archs = "auto aarch64"
+
+[[tool.cibuildwheel.overrides]]
+# The emulated arm build is quite slow, so only run a portion of the test
+# suite. websocket_test is the most platform-dependent part of the tests
+# because it uses the C speedups module.
+select = "*linux_aarch64"
+test-command = "python -m tornado.test tornado.test.websocket_test"
index 633703dc8b68e12561b910556719b036394304ca..1fe582898af0187c75f247cec4386a3fefc5d82a 100644 (file)
@@ -279,9 +279,7 @@ class OptionsTest(unittest.TestCase):
                 options.define(a)
                 with self.assertRaises(Error) as cm:
                     options.define(b)
-                self.assertRegex(
-                    str(cm.exception), "Option.*foo.bar.*already defined"
-                )
+                self.assertRegex(str(cm.exception), "Option.*foo.bar.*already defined")
 
     def test_dash_underscore_cli(self):
         # Dashes and underscores should be interchangeable.