Repository: Kinto/kinto (language: python)

Issue:
Add GitHub Actions workflows
As discussed in #2643, this PR mirrors the CI steps we're currently performing in Travis to GitHub Actions.

This PR makes the following changes:
- pip now installs using the [legacy resolver](https://pip.pypa.io/en/stable/user_guide/#resolver-changes-2020), which matches the installation behavior it used prior to the 20.3 upgrade released earlier this month. There are some incompatibilities in our dependencies, so I'm hoping that those get resolved by the time the legacy resolver is deprecated in January.
- Sphinx has been downgraded to the last known working version, 3.0.3.
- The latest versions of pip and virtualenv are installed into the environment prior to tox being run

In addition to the above changes, this PR adds GitHub Actions workflows mirroring the things we're currently doing in Travis.
Run some tests in GitHub Actions
I think it would be wise to have at least one set of CI validation coming from GitHub Actions, so that we have two sources of code quality, especially for times like now where open source builds on Travis are delayed for several hours. (As of writing, GHA are finishing within 10 minutes of a PR being opened, whereas Travis is just now running checks for a PR submitted 9 hours ago.)

I don't think we need to do the multiple Python version testing, but at least testing on the latest Python in GHA would be nice.


Discussion / hints:
@dstaley why the calls to `which`? Is it debugs? Shall we get rid of it?
> @dstaley why the calls to `which`? Is it debugs? Shall we get rid of it?

@Natim I don't see `which` in the diff. Could you link me to the line you're talking about?
My bad I probably looked at a commit diff rather than the PR diff.
@leplatrem @Natim if one of you could review this so I could merge it that would be great. It includes fixes to get Travis building again, so I can clear out some of the outstanding dependency update PRs.
I think it is good to go for me !
On Monday, Travis introduced a [new billing plan](https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing) for OSS projects that's based on a credits system. Since then, we've consumed almost half of our monthly allotment in just under 72 hours. They do have a [process in place](https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing#building-on-a-public-repositories-only) where we can request additional credits, but it sounds like this would be something we'd have to continually do as we ran out of credits.

I think it might be a wise idea to move as much CI testing as we can off of Travis and over to GitHub Actions. It looks like the JavaScript repos (`kinto-admin`, `kinto-http.js`, and `kinto.js`) trigger quite often, and are probably the lowest hanging fruit, so I'll work on migrating those over first. My hope is that we can get enough tests off of Travis so that we remain comfortably within their 1000 build minutes a month allotment.

@leplatrem @Natim just pinging you so you're aware!
I reached out to Travis support and we now have an additional 70,000 credits (7000 minutes) to use. This should (hopefully) give us about a month or so of runway to reduce our usage.
At least one user has been notified by Travis that the open source credit system is now on hold. [Source](https://twitter.com/james_hilliard/status/1336081776691843072). I'm going to try and get GHA to parity with Travis on all JavaScript repos by the end of this week.
I cannot promise to work on this in the short term, but I will reduce the frequency of `dependabot` right now, it may help a little bit
Well, it finally happened: we ran out of OSS credits. I'm going to ask Travis and see if we can get a few more just to get us through the transition.
I think we can just ditch TravisCI, it's fine.

Fix patch:
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index c05316575..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-dist: trusty
-language: python
-python: 3.6
-cache: pip
-services:
-  - memcached
-addons:
-  postgresql: "9.5"
-env:
-  - TOX_ENV=py36
-  - TOX_ENV=py36-raw
-install:
-  - pip install -U pip
-  - pip install tox
-  - pip install -U virtualenv
-before_script:
-  - echo "Pull request ${TRAVIS_PULL_REQUEST}"
-  - sudo sed -i "s/fsync/#fsync/" /etc/postgresql/9.5/main/postgresql.conf
-  - sudo /etc/init.d/postgresql restart
-  - psql -c "CREATE DATABASE testdb ENCODING 'UTF8' TEMPLATE template0;" -U postgres
-  - make version-file
-script:
-  - tox -e $TOX_ENV
-after_success:
-  # Report coverage results to coveralls.io
-  - pip install coveralls
-  - coveralls
-
-matrix:
-  include:
-    - python: 3.7
-      dist: xenial
-      env:
-        - ENV=code-lint
-      script:
-        - make lint
-    - python: 3.7
-      dist: xenial
-      env:
-        - TOX_ENV=py37
-    - python: 3.8
-      dist: xenial
-      env:
-        - TOX_ENV=py38
-    - python: 3.9
-      dist: xenial
-      env:
-        - TOX_ENV=py39
-    - python: 3.7
-      dist: xenial
-      env: ENV=functional
-      before_install:
-        - make install-dev
-        - make install-postgres
-      script:
-        - make runkinto & sleep 5
-        - make functional
-    - python: 3.7
-      dist: xenial
-      env:
-        - ENV=build-kinto-admin
-      script: make build-kinto-admin
-    - python: 3.7
-      dist: xenial
-      env:
-        - ENV=docs
-      script: make docs
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4edd1af43..43506e05a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -10,8 +10,7 @@ Before doing so, here are a few guidelines:
   our code.
 * A pull-request adding functionality should also update the documentation
   accordingly.
-* [Travis CI integration tests](https://travis-ci.org/Kinto/kinto) should be
-  green.
+* [CI integration tests](https://github.com/Kinto/kinto/actions) should be green.
 * If you're interested, you can also check the [contributing
   documentation](https://kinto.readthedocs.io/en/latest/community.html#how-to-contribute)
   guide which goes into more details.
diff --git a/Makefile b/Makefile
index 60535ccb5..9cecc0396 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ help:
 	@echo "  serve                       start the kinto server on default port"
 	@echo "  migrate                     run the kinto migrations"
 	@echo "  lint                        run the code linters"
-	@echo "  tests                       run all the tests with all the supported python interpreters (same as travis)"
+	@echo "  tests                       run all the tests with all the supported python interpreters (same as CI)"
 	@echo "  tdd                         run pytest-watch to rerun tests automatically on changes for tdd"
 	@echo "  tests-once  	             only run the tests once with the default python interpreter"
 	@echo "  functional                  run functional test against a real kinto"
diff --git a/README.rst b/README.rst
index 6e6e1ff14..be4fca454 100644
--- a/README.rst
+++ b/README.rst
@@ -1,7 +1,7 @@
 Kinto
 =====
 
-|coc| |gitter| |readthedocs| |pypi| |travis| |master-coverage|
+|coc| |gitter| |readthedocs| |pypi| |ci| |master-coverage|
 
 .. |coc| image:: https://img.shields.io/badge/%E2%9D%A4-code%20of%20conduct-blue.svg
     :target: https://github.com/Kinto/kinto/blob/master/CODE_OF_CONDUCT.md
@@ -10,8 +10,8 @@ Kinto
 .. |gitter| image:: https://badges.gitter.im/Kinto/kinto.svg
     :target: https://gitter.im/Kinto/kinto
 
-.. |travis| image:: https://travis-ci.org/Kinto/kinto.svg?branch=master
-    :target: https://travis-ci.org/Kinto/kinto
+.. |ci| image:: ![example branch parameter](https://github.com/Kinto/kinto/actions/workflows/test.yml/badge.svg?branch=master)
+    :target: https://github.com/Kinto/kinto/actions
 
 .. |readthedocs| image:: https://readthedocs.org/projects/kinto/badge/?version=latest
     :target: https://kinto.readthedocs.io/en/latest/
diff --git a/contribute.json b/contribute.json
index 631576222..b2886300e 100644
--- a/contribute.json
+++ b/contribute.json
@@ -4,7 +4,7 @@
   "repository": {
     "url": "https://github.com/Kinto/kinto",
     "license": "Apache License (2.0)",
-    "tests": "https://travis-ci.org/Kinto/kinto"
+    "tests": "https://github.com/Kinto/kinto/actions"
   },
   "participate": {
     "home": "https://kinto.readthedocs.io/en/latest/community.html#how-to-contribute",
diff --git a/docs/community.rst b/docs/community.rst
index 3d478d529..58658e77a 100644
--- a/docs/community.rst
+++ b/docs/community.rst
@@ -203,7 +203,7 @@ Before we merge a pull request, we check that it meets these guidelines:
 
 1. The pull request should include tests.
 2. If the pull request adds functionality, the docs should be updated.
-3. *TravisCI* integration tests should be *green* :) It will make sure the tests
+3. *CI* integration tests should be *green* :) It will make sure the tests
    pass with `every supported version of Python <https://github.com/Kinto/kinto/blob/master/tox.ini#L2>`_.
 
 
diff --git a/tox.ini b/tox.ini
index a8eb40f20..ae38c96db 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,7 +5,7 @@ requires =
     virtualenv >= 20.2.2
 
 [testenv]
-passenv = TRAVIS CI
+passenv = CI
 commands =
     python --version
     py.test --cov-report term-missing --cov-branch --cov-fail-under 100 --cov kinto {posargs}
@@ -18,7 +18,7 @@ deps =
 install_command = pip install {opts} {packages} -c{toxinidir}/requirements.txt
 
 [testenv:py38-raw]
-passenv = TRAVIS CI
+passenv = CI
 commands =
     python --version
     py.test {posargs}


Test patch:
diff --git a/kinto/core/testing.py b/kinto/core/testing.py
index d4dfba4f8..a3e0c5cf0 100644
--- a/kinto/core/testing.py
+++ b/kinto/core/testing.py
@@ -12,7 +12,7 @@
 from kinto.core.storage import generators
 from kinto.core.utils import encode64, follow_subrequest, memcache, sqlalchemy
 
-skip_if_ci = unittest.skipIf("CI" in os.environ, "travis")
+skip_if_ci = unittest.skipIf("CI" in os.environ, "ci")
 skip_if_no_postgresql = unittest.skipIf(sqlalchemy is None, "postgresql is not installed.")
 skip_if_no_memcached = unittest.skipIf(memcache is None, "memcached is not installed.")
 skip_if_no_statsd = unittest.skipIf(not statsd.statsd_module, "statsd is not installed.")