From 2c626c67070be00e0d3aa99c366629b3d4e2c087 Mon Sep 17 00:00:00 2001 From: Sergey Vilgelm Date: Sun, 26 Jan 2020 21:12:03 -0600 Subject: [PATCH 1/7] Run tests using github actions --- .github/workflows/test.yml | 65 +++++++++++++++++++++++++++++++++++ travis-bench-after-success.sh | 63 --------------------------------- 2 files changed, 65 insertions(+), 63 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100755 travis-bench-after-success.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..a8878bc8 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,65 @@ +name: Tests +on: + - push + - pull_request +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ".[dev]" + - name: Test with inv + run: inv cover qa + - name: Coveralls + run: | + pip install coveralls + coveralls --rcfile=coverage.rc + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + bench: + needs: test + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Checkout ${{ github.base_ref }} + uses: actions/checkout@v2 + with: + ref: ${{ github.base_ref}} + path: base + - name: Checkout ${{ github.ref }} + uses: actions/checkout@v2 + with: + ref: ${{ github.ref}} + path: ref + - name: Install dev dependencies + run: | + python -m pip install --upgrade pip + pip install -e "base[dev]" + pip install -e "base[ci]" + - name: Install ci dependencies for ${{ github.base_ref }} + run: pip install -e "base[ci]" + - name: Benchmarks for ${{ github.base_ref }} + run: | + cd base + inv benchmark --max-time 4 --save + - name: Install ci dependencies for ${{ github.ref }} + run: pip install -e "ref[ci]" + - name: Benchmarks for ${{ github.ref }} + run: | + cd ref + inv benchmark --max-time 4 --compare diff --git a/travis-bench-after-success.sh b/travis-bench-after-success.sh deleted file mode 100755 index 70020a17..00000000 --- a/travis-bench-after-success.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env bash -# -# Perform benchmark and compare with base branch results. -# Only here for information purpose -# Adapted from: -# - http://sunjay.ca/2017/04/27/rust-benchmark-comparison-travis -# - https://beachape.com/blog/2016/11/02/rust-performance-testing-on-travis-ci/ - -set -e -set -x - -# The Travis environment variables behave like so: -# TRAVIS_BRANCH -# - if PR build, this is the pr base branch -# - if push build, this is the branch that was pushed -# TRAVIS_PULL_REQUEST_BRANCH -# - if PR build, this is the "target" of the pr, i.e. not the base branch -# - if push build, this is blank -# -# Example: -# You open a PR with base `master`, and PR branch `foo` -# During a PR build: -# TRAVIS_BRANCH=master -# TRAVIS_PULL_REQUEST_BRANCH=foo -# During a push build: -# TRAVIS_BRANCH=foo -# TRAVIS_PULL_REQUEST_BRANCH= - -# Only run on branches -if [ "${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}" != "master" ]; then - REMOTE_URL="$(git config --get remote.origin.url)" - - # Clone the repository fresh..for some reason checking out master fails - # from a normal PR build's provided directory - cd ${TRAVIS_BUILD_DIR}/.. - git clone ${REMOTE_URL} "${TRAVIS_REPO_SLUG}-bench" - cd "${TRAVIS_REPO_SLUG}-bench" - - # Bench the pull request base or master - if [ -n "$TRAVIS_PULL_REQUEST_BRANCH" ]; then - git checkout -f "$TRAVIS_BRANCH" - else # this is a push build - # This could be replaced with something better like asking git which - # branch is the base of $TRAVIS_BRANCH - git checkout -f master - fi - - # Install dependencies in case of change between commits - pip install -e .[ci] - - # Perform benchmark and save result for comparison - inv benchmark --max-time 4 --save - - # Bench the current commit that was pushed - git checkout -f "${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}" - - # Install dependencies in case of change between commits - pip install -e .[ci] - - # Perform benchmark and compare with previous result - inv benchmark --max-time 4 --compare - -fi From 1574ce740f5f6b0dcf4862ab55fdd5c65a9cf5e6 Mon Sep 17 00:00:00 2001 From: Sergey Vilgelm Date: Sun, 26 Jan 2020 22:16:31 -0600 Subject: [PATCH 2/7] Add release workflow --- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..4e99d769 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Release +on: + push: + tags: + - "*" +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Checkout code + uses: actions/checkout@v2 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ".[dev]" wheel + - name: Fetch web assets + run: inv assets + - name: Publish + env: + TWINE_USERNAME: "__token__" + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* From 71193a48c0ed8a802db44b1ccc0ec06a4f96e745 Mon Sep 17 00:00:00 2001 From: Sergey Vilgelm Date: Sun, 26 Jan 2020 22:16:54 -0600 Subject: [PATCH 3/7] Remove .travis.yml --- .travis.yml | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f659c7b7..00000000 --- a/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -language: python -python: - - '2.7' - - '3.4' - - '3.5' - - '3.6' - - '3.7' - - '3.8' - - pypy - - pypy3 -jobs: - allow_failures: - - python: pypy3 - - python: '3.8' -install: - - pip install .[dev] -script: - - inv cover qa -after_success: - - pip install coveralls - - coveralls --rcfile=coverage.rc - - "./travis-bench-after-success.sh" -before_deploy: - - inv assets -deploy: - provider: pypi - user: "__token__" - password: - secure: Bhk0mw7iFn+kan/rBdegQe2gbvtTd12hCxZzHwZCCgyu6xCK4UT/6eW6KucT1BP5sOzCteYzRcdg5PBLLwXaKXuSVtGmdZwmQcVRgWuXCA9/9YdPJSCSO3dHoVYpiXP9Tc72qPVi/Wwj9t2U7V8IcGoH4NDJn8XM2dFSYHm/ZhXQCSBcXLjLx7EI1M7yXo4h3tLfEka9+VZ8jdEsP6NATaJIeBqo4X4hZj2n2ux6Q0CyxqQWsTx0iQUsKrML7a5lE9vz7Mk21NkZLb8LAg3lRrYEyC2rIdhXOxDED410MGpwMQDZ8MUF85vB1ri/EFLfcRvbFs8+W0vrqltmABlwoymvmtw4B/lbRyjmArjYKk8CCeK5z5KVx+QICrxXMEG/4CeS5vQCz/0uB+Fzu0Xv44kslOSaFewwow/arke80WzdzecBzAi+HANb1L7hufRb63tkmf0Uz3JX5HplI31FbT/pQoL1pZtFoHC9u3/iqYY39z/3Jv8+gop5ZX1WaIgxBxfCIVqx//p3pq9LYkI8zdFv54tD8UiKKJiwAzMIrYQJLkB5RtKBYxoyBXOdYb0H9vVWISXcwQVuKJiQWO/GDjE1KX3TApHSz73DqMemuG5BYDCf9qIbm49rYY57NyFNvgLJVZCwgrY5J9Otmk+e5sjGo3wkOWOriAO6QH7RqEI= - on: - tags: true - skip_existing: true - skip_cleanup: true From 5560c751907913142ba031cc642e2f788735a1a3 Mon Sep 17 00:00:00 2001 From: Sergey Vilgelm Date: Sun, 26 Jan 2020 22:47:22 -0600 Subject: [PATCH 4/7] Update Readme --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 4a63534c..7fab925e 100644 --- a/README.rst +++ b/README.rst @@ -2,9 +2,9 @@ Flask RESTX =========== -.. image:: https://secure.travis-ci.org/python-restx/flask-restx.svg?branch=master - :target: https://travis-ci.org/python-restx/flask-restx?branch=master - :alt: Build status +.. image:: https://github.com/python-restx/flask-restx/workflows/Tests/badge.svg?branch=master&event=push + :target: https://github.com/python-restx/flask-restx/actions?query=workflow%3ATests + :alt: Tests status .. image:: https://coveralls.io/repos/github/python-restx/flask-restx/badge.svg?branch=master :target: https://coveralls.io/github/python-restx/flask-restx?branch=master :alt: Code coverage From b4833ff39de9a33b5c43706f052ee0dc63cacab6 Mon Sep 17 00:00:00 2001 From: Sergey Vilgelm Date: Sun, 26 Jan 2020 22:53:47 -0600 Subject: [PATCH 5/7] Update classifiers --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 92d41864..33ab6234 100644 --- a/setup.py +++ b/setup.py @@ -97,10 +97,10 @@ def pip(filename): '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.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development :: Libraries :: Python Modules', 'License :: OSI Approved :: BSD License', From 4e9e6052ed00c34e74085ee865995ac58a83f5a5 Mon Sep 17 00:00:00 2001 From: Sergey Vilgelm Date: Fri, 31 Jan 2020 08:11:14 -0600 Subject: [PATCH 6/7] Resolve comments --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a8878bc8..b142cb80 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,12 +9,12 @@ jobs: matrix: python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] steps: - - name: Checkout code - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v1 with: python-version: ${{ matrix.python-version }} + - name: Checkout code + uses: actions/checkout@v2 - name: Install dependencies run: | python -m pip install --upgrade pip @@ -50,13 +50,13 @@ jobs: run: | python -m pip install --upgrade pip pip install -e "base[dev]" - pip install -e "base[ci]" - name: Install ci dependencies for ${{ github.base_ref }} run: pip install -e "base[ci]" - name: Benchmarks for ${{ github.base_ref }} run: | cd base inv benchmark --max-time 4 --save + mv .benchmarks ../ref/ - name: Install ci dependencies for ${{ github.ref }} run: pip install -e "ref[ci]" - name: Benchmarks for ${{ github.ref }} From 7ab92ebd630881a744195c272bffcc7677926a03 Mon Sep 17 00:00:00 2001 From: Sergey Vilgelm Date: Wed, 5 Feb 2020 09:48:05 -0600 Subject: [PATCH 7/7] Update Contributing.rst --- CONTRIBUTING.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 79488f87..b5e621d1 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -110,7 +110,7 @@ Release process --------------- The new releases are pushed on `Pypi.org `_ automatically -from `travis-ci `_ when we add a new tag (unless the +from `GitHub Actions `_ when we add a new tag (unless the tests are failing). Updating Copyright