Skip to content

Commit

Permalink
tests: Switch from Travis to GitHub Actions (faster)
Browse files Browse the repository at this point in the history
Primary motivation for this is speed: GitHub Actions doesn't limit the
number of concurrent jobs to 4, and also provides a docker registry
(GitHub Packages) that we can use to cache the image (building the image
takes cca 5 minutes, fetching it would take less than 10 seconds). This
is done in another commit.

The workflow definition is a bit more complicated because coveralls
support for GitHub Actions is less mature than for Travis CI, so we need
to manually tell coveralls that all parallel builds have finished and
that it can publish the combined result. Also, coveralls-python support
is work-in-progress
(TheKevJames/coveralls-python#227) so I've
tagged a working snapshot of that PR in my fork. Once it's in a released
version of coveralls-python I'll switch to it.
  • Loading branch information
liskin committed Jul 6, 2020
1 parent 5699430 commit 29c1f62
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 25 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: tests
on: [push, pull_request]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- TASK_VERSION: v2.4.0
- TASK_VERSION: v2.4.1
- TASK_VERSION: v2.4.2
- TASK_VERSION: v2.4.3
- TASK_VERSION: v2.4.4
- TASK_VERSION: v2.5.0
- TASK_VERSION: v2.5.1
continue-on-error: ${{ matrix.continue-on-error == true }}
steps:
- uses: actions/checkout@v2
- name: Prepare docker image
run: docker-compose build --build-arg TASK_VERSION=${{ matrix.TASK_VERSION }} tests
- name: Test
run: make test PYTEST_FLAGS="-n8"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true

coveralls-finished:
needs: tests
runs-on: ubuntu-latest
steps:
- name: Finished
uses: coverallsapp/github-action@v1.1.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ RUN set -ex \
gcc \
musl-dev \
&& pip install \
coverage coveralls \
coverage \
https://github.com/liskin/coveralls-python/archive/ea93b7c62d7705e9cc593ae523c89015c4653905.zip \
pytest \
pytest-xdist \
https://github.com/liskin/vimrunner-python/archive/8c19ff88050c09236e7519425bfae33c687483df.zip \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pytest:
cover-pytest: pytest
coverage combine
coverage report
if [ "$$TRAVIS" ]; then coveralls; fi
if [ "$$GITHUB_ACTIONS" ]; then coveralls || :; fi

xvfb-%:
xvfb-run --server-args=-noreset $(MAKE) $*
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
_Proper project management in vim.
Standing on the shoulders of vimwiki and Taskwarrior_

[![Travis build status](https://travis-ci.org/tbabej/taskwiki.svg?branch=master)](https://travis-ci.org/tbabej/taskwiki)
[![GitHub Actions build status](https://github.com/tbabej/taskwiki/workflows/tests/badge.svg?branch=master)](https://github.com/tbabej/taskwiki/actions)
[![Coverage Status](https://coveralls.io/repos/tbabej/taskwiki/badge.svg?branch=master)](https://coveralls.io/r/tbabej/taskwiki?branch=master)
[![Code Health](https://landscape.io/github/tbabej/taskwiki/master/landscape.svg?style=flat)](https://landscape.io/github/tbabej/taskwiki/master)
[![Chat with developers](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tbabej/taskwiki)
Expand Down Expand Up @@ -295,7 +295,7 @@ need to install and enable either the `en_US` or `en_GB` locale. For example:

LANG=en_US python -m pytest

Finally you might want to have a look at [the travis configuration](.travis.yml)
Finally you might want to have a look at [the CI configuration](.github/workflows/tests.yaml)
and consider using a virtual machine or [Xvfb](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml).

#### Known issues
Expand Down
12 changes: 8 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ services:
tty: true
command: make xvfb-cover-pytest
environment:
COVERALLS_PARALLEL:
GITHUB_ACTIONS:
GITHUB_HEAD_REF:
GITHUB_REF:
GITHUB_RUN_ID:
GITHUB_RUN_NUMBER:
GITHUB_SHA:
GITHUB_TOKEN:
PYTEST_FLAGS: "-o cache_dir=/tmp/pytest-cache ${PYTEST_FLAGS:-}"
TRAVIS:
TRAVIS_JOB_ID:
TRAVIS_BRANCH:
TRAVIS_PULL_REQUEST:

0 comments on commit 29c1f62

Please sign in to comment.