Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace TravisCI with GitHub Actions #796

Merged
merged 18 commits into from
Dec 30, 2021
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: CI
on:
push:
branches:
- master
- release
pull_request:
victorlin marked this conversation as resolved.
Show resolved Hide resolved
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.6', '3.7', '3.8']
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
victorlin marked this conversation as resolved.
Show resolved Hide resolved
with:
python-version: ${{ matrix.python-version }}
mamba-version: "*"
channels: conda-forge,bioconda
channel-priority: true
activate-environment: test
- run: mamba install mafft raxml fasttree iqtree vcftools pip numpy
- run: pip install biopython==1.67
victorlin marked this conversation as resolved.
Show resolved Hide resolved
- run: pip install -e .[dev]
- run: conda info
- run: conda list
- run: pytest -c pytest.python3.ini --cov-report=xml --cov=augur
- run: cram --shell=/bin/bash tests/functional/*.t tests/builds/*.t
- run: bash tests/builds/runner.sh
- if: matrix.python-version == 3.8
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
deploy:
if: ${{ github.ref == 'refs/heads/release' }}
needs: [test]
runs-on: ubuntu-latest
steps:
- env:
TRAVIS_AUTH_TOKEN: ${{ secrets.TRAVIS_AUTH_TOKEN }}
run: |
set -euo pipefail

echo "Pinging Travis CI to rebuild Docker image"

body='{
"request": {
"branch": "master",
"message": "Build triggered from augur"
}
}'

curl -X POST https://api.travis-ci.com/repo/nextstrain%2Fdocker-base/requests \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token $TRAVIS_AUTH_TOKEN" \
-d "$body"
46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.com/nextstrain/augur.svg?branch=master)](https://travis-ci.com/nextstrain/augur)
[![Build Status](https://github.com/nextstrain/augur/actions/workflows/ci.yaml/badge.svg?branch=master)](https://github.com/nextstrain/augur/actions/workflows/ci.yaml)
[![PyPI version](https://badge.fury.io/py/nextstrain-augur.svg)](https://pypi.org/project/nextstrain-augur/)
[![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat)](http://bioconda.github.io/recipes/augur/README.html)
[![Documentation Status](https://readthedocs.org/projects/nextstrain-augur/badge/?version=latest)](https://docs.nextstrain.org/projects/augur/en/stable/)
Expand Down
2 changes: 1 addition & 1 deletion devel/test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Runs tests in a sandboxed environment that loosely replicates the Travis CI
# Runs tests in a sandboxed environment that loosely replicates the GitHub Actions
# environment.
set -euo pipefail

Expand Down
18 changes: 0 additions & 18 deletions devel/travis-rebuild-docker-image

This file was deleted.

26 changes: 10 additions & 16 deletions docs/contribute/DEV_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ For example, the following command only runs unit tests related to augur mask.

Troubleshooting tip: As tests run on the development code in the augur repository, your environment should not have an existing augur installation that could cause a conflict in pytest.

We use continuous integration with Travis CI to run tests on every pull request submitted to the project.
We use continuous integration with GitHub Actions to run tests on every pull request submitted to the project.
We use [codecov](https://codecov.io/) to automatically produce test coverage for new contributions and the project as a whole.

### Releasing

Before you create a new release, run all tests from a fresh conda environment to verify that nothing has broken since the last CI build on GitHub.
The following commands will setup the equivalent conda environment to the Travis CI environment, run unit and integration tests, and deactivate the environment.
The following commands will setup the equivalent conda environment to the GitHub Actions environment, run unit and integration tests, and deactivate the environment.

```bash
# Update Conda.
Expand Down Expand Up @@ -203,29 +203,23 @@ You will need to update the existing recipe YAML locally and create a pull reque
Add your GitHub username to the `recipe_maintainers` list, if this is your first time modifying the augur recipe.
After a successful pull request review, Bioconda will automatically update the augur package that users download.

### Travis CI
### Continuous Integration (CI)

Branches and PRs are tested by Travis CI jobs configured in `.travis.yml`.
Branches and PRs are tested by GitHub Actions workflows configured in `.github/workflows`.

Our Travis config uses two build stages: _test_ and _deploy_. Jobs in the
_test_ stage always run, but _deploy_ jobs only run sometimes (see below).
Our GitHub Actions workflow is comprised of two jobs: _test_ and _deploy_. Steps in the
_test_ job always run, but _deploy_ steps only run sometimes (see below).

The set of _test_ jobs are explicitly defined instead of auto-expanded from the
implicit job property matrix. Since top-level properties are inherited by all
jobs regardless of build stage, making the matrix explicit is less confusing
and easier to reason about. YAML's anchor (`&foo`) and alias merge key (`<<:
*foo`) syntax let us do this without repeating ourselves unnecessarily.
The _test_ job runs tests and uploads the the coverage report to Codecov.
Currently, only `pytest` results are included in the report.

New releases, via pushes to the `release` branch, trigger a new [docker-base][]
build to keep the Docker image up-to-date. This trigger is implemented in the
_deploy_ stage, which is implicitly conditioned on the previous _test_ stage's
_deploy_ job, which is implicitly conditioned on the previous _test_ job's
successful completion and explicitly conditioned on a non-PR trigger on the
`release` branch. Note that currently we cannot test this _deploy_ stage
`release` branch. Note that currently we cannot test this _deploy_ job
without making a release.

It can sometimes be useful to verify the config is parsed as you expect using
<https://config.travis-ci.com/explore>.

[docker-base]: https://github.com/nextstrain/docker-base

## Contributing documentation
Expand Down
2 changes: 1 addition & 1 deletion tests/builds/zika.t
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Build a tree from the multiple sequence alignment.
> --method iqtree \
> --tree-builder-args "-seed 314159" > /dev/null

$ python3 "$TESTDIR/../../scripts/diff_trees.py" "results/tree_raw.nwk" "$TMP/out/tree_raw.nwk" --significant-digits 5
$ python3 "$TESTDIR/../../scripts/diff_trees.py" "results/tree_raw.nwk" "$TMP/out/tree_raw.nwk" --significant-digits 4
{}

Confirm that tree log file exists.
Expand Down