Skip to content

Commit

Permalink
Switch from Travis CI to GitHub Actions
Browse files Browse the repository at this point in the history
Travis has imposed quotas on builds that require us to contact them to
obtain OSS credits. The CI tool is irrelevant so long as builds do
happen, so switch to GitHub Actions for now. This is a little more
complicated that the switch for related projects like git-pw, given the
need for a database service. We may wish to investigate reusing some of
our own Docker files in the future but for now, this should do the
trick.

Signed-off-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit 9933a17)
  • Loading branch information
stephenfin committed May 10, 2022
1 parent 62b1946 commit 1057b9b
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 64 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
name: CI
on:
- push
- pull_request
jobs:
lint:
name: Run linters
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: python -m pip install tox
- name: Run tox
run: tox -e pep8
test:
name: Run unit tests
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9]
db: [postgres, mysql]
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: patchwork
POSTGRES_PASSWORD: patchwork
POSTGRES_USER: patchwork
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:latest
env:
MYSQL_DATABASE: patchwork
MYSQL_USER: patchwork
MYSQL_PASSWORD: patchwork
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install Python dependencies
run: python -m pip install tox tox-gh-actions codecov
- name: Log database configuration (mysql)
if: ${{ matrix.db == 'mysql' }}
run: mysql -h 127.0.0.1 -e "SELECT VERSION(), CURRENT_USER();" -uroot -proot patchwork
- name: Log database configuration (postgres)
if: ${{ matrix.db == 'postgres' }}
run: psql -h 127.0.0.1 -c "SELECT VERSION(), CURRENT_USER, current_database()" -U patchwork -d patchwork
env:
PGPASSWORD: patchwork
- name: Modify database user permissions (mysql)
if: ${{ matrix.db == 'mysql' }}
run: mysql -h 127.0.0.1 -e "GRANT ALL ON \`test\\_patchwork%\`.* to 'patchwork'@'%';" -uroot -proot
- name: Run unit tests (via tox)
run: tox
env:
PW_TEST_DB_TYPE: "${{ matrix.db }}"
PW_TEST_DB_USER: "patchwork"
PW_TEST_DB_PASS: "patchwork"
PW_TEST_DB_HOST: "127.0.0.1"
docs:
name: Build docs
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: python -m pip install tox
- name: Build docs (via tox)
run: tox -e docs
- name: Archive build results
uses: actions/upload-artifact@v2
with:
name: html-docs-build
path: docs/_build/html
retention-days: 7
59 changes: 0 additions & 59 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Patchwork
:target: https://codecov.io/gh/getpatchwork/patchwork
:alt: Codecov

.. image:: https://travis-ci.org/getpatchwork/patchwork.svg?branch=master
:target: https://travis-ci.org/getpatchwork/patchwork
.. image:: https://github.com/getpatchwork/patchwork/actions/workflows/ci.yaml/badge.svg
:target: https://github.com/getpatchwork/patchwork/actions/workflows/ci.yaml
:alt: Build Status

.. image:: https://readthedocs.org/projects/patchwork/badge/?version=latest
Expand Down
9 changes: 6 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ setenv =
passenv =
http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
PW_TEST_DB_TYPE PW_TEST_DB_USER PW_TEST_DB_PASS PW_TEST_DB_HOST
PW_TEST_DB_PORT
PW_TEST_DB_PORT PW_TEST_DB_NAME DJANGO_TEST_PROCESSES
commands =
python {toxinidir}/manage.py test --noinput --parallel -- {posargs:patchwork}

Expand Down Expand Up @@ -78,6 +78,9 @@ commands =
--branch {toxinidir}/manage.py test --noinput patchwork
coverage report -m

[travis]
[gh-actions]
python =
3.6: py36, pep8, coverage
3.6: py36
3.7: py37
3.8: py38
3.9: py39

0 comments on commit 1057b9b

Please sign in to comment.