Skip to content

Commit 1057b9b

Browse files
committed
Switch from Travis CI to GitHub Actions
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 <[email protected]> (cherry picked from commit 9933a17)
1 parent 62b1946 commit 1057b9b

File tree

4 files changed

+112
-64
lines changed

4 files changed

+112
-64
lines changed

.github/workflows/ci.yaml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
name: CI
3+
on:
4+
- push
5+
- pull_request
6+
jobs:
7+
lint:
8+
name: Run linters
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout source code
12+
uses: actions/checkout@v2
13+
- name: Set up Python 3.9
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: 3.9
17+
- name: Install dependencies
18+
run: python -m pip install tox
19+
- name: Run tox
20+
run: tox -e pep8
21+
test:
22+
name: Run unit tests
23+
runs-on: ubuntu-latest
24+
strategy:
25+
matrix:
26+
python: [3.6, 3.7, 3.8, 3.9]
27+
db: [postgres, mysql]
28+
services:
29+
postgres:
30+
image: postgres:latest
31+
env:
32+
POSTGRES_DB: patchwork
33+
POSTGRES_PASSWORD: patchwork
34+
POSTGRES_USER: patchwork
35+
ports:
36+
- 5432:5432
37+
options: >-
38+
--health-cmd pg_isready
39+
--health-interval 10s
40+
--health-timeout 5s
41+
--health-retries 5
42+
mysql:
43+
image: mysql:latest
44+
env:
45+
MYSQL_DATABASE: patchwork
46+
MYSQL_USER: patchwork
47+
MYSQL_PASSWORD: patchwork
48+
MYSQL_ROOT_PASSWORD: root
49+
ports:
50+
- 3306:3306
51+
options: >-
52+
--health-cmd="mysqladmin ping"
53+
--health-interval 10s
54+
--health-timeout 5s
55+
--health-retries 5
56+
steps:
57+
- name: Checkout source code
58+
uses: actions/checkout@v2
59+
- name: Set up Python ${{ matrix.python }}
60+
uses: actions/setup-python@v2
61+
with:
62+
python-version: ${{ matrix.python }}
63+
- name: Install Python dependencies
64+
run: python -m pip install tox tox-gh-actions codecov
65+
- name: Log database configuration (mysql)
66+
if: ${{ matrix.db == 'mysql' }}
67+
run: mysql -h 127.0.0.1 -e "SELECT VERSION(), CURRENT_USER();" -uroot -proot patchwork
68+
- name: Log database configuration (postgres)
69+
if: ${{ matrix.db == 'postgres' }}
70+
run: psql -h 127.0.0.1 -c "SELECT VERSION(), CURRENT_USER, current_database()" -U patchwork -d patchwork
71+
env:
72+
PGPASSWORD: patchwork
73+
- name: Modify database user permissions (mysql)
74+
if: ${{ matrix.db == 'mysql' }}
75+
run: mysql -h 127.0.0.1 -e "GRANT ALL ON \`test\\_patchwork%\`.* to 'patchwork'@'%';" -uroot -proot
76+
- name: Run unit tests (via tox)
77+
run: tox
78+
env:
79+
PW_TEST_DB_TYPE: "${{ matrix.db }}"
80+
PW_TEST_DB_USER: "patchwork"
81+
PW_TEST_DB_PASS: "patchwork"
82+
PW_TEST_DB_HOST: "127.0.0.1"
83+
docs:
84+
name: Build docs
85+
runs-on: ubuntu-latest
86+
steps:
87+
- name: Checkout source code
88+
uses: actions/checkout@v2
89+
with:
90+
fetch-depth: 0
91+
- name: Set up Python 3.9
92+
uses: actions/setup-python@v2
93+
with:
94+
python-version: 3.9
95+
- name: Install dependencies
96+
run: python -m pip install tox
97+
- name: Build docs (via tox)
98+
run: tox -e docs
99+
- name: Archive build results
100+
uses: actions/upload-artifact@v2
101+
with:
102+
name: html-docs-build
103+
path: docs/_build/html
104+
retention-days: 7

.travis.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Patchwork
1010
:target: https://codecov.io/gh/getpatchwork/patchwork
1111
:alt: Codecov
1212

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

1717
.. image:: https://readthedocs.org/projects/patchwork/badge/?version=latest

tox.ini

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ setenv =
2626
passenv =
2727
http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
2828
PW_TEST_DB_TYPE PW_TEST_DB_USER PW_TEST_DB_PASS PW_TEST_DB_HOST
29-
PW_TEST_DB_PORT
29+
PW_TEST_DB_PORT PW_TEST_DB_NAME DJANGO_TEST_PROCESSES
3030
commands =
3131
python {toxinidir}/manage.py test --noinput --parallel -- {posargs:patchwork}
3232

@@ -78,6 +78,9 @@ commands =
7878
--branch {toxinidir}/manage.py test --noinput patchwork
7979
coverage report -m
8080

81-
[travis]
81+
[gh-actions]
8282
python =
83-
3.6: py36, pep8, coverage
83+
3.6: py36
84+
3.7: py37
85+
3.8: py38
86+
3.9: py39

0 commit comments

Comments
 (0)