Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Commit 79866a2

Browse files
committed
move to github actions
switch from travis as it creates issues.
1 parent d911242 commit 79866a2

9 files changed

Lines changed: 217 additions & 113 deletions

File tree

.github/workflows/docs.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Documentation Checks
2+
3+
on: [push]
4+
5+
jobs:
6+
spell_check:
7+
strategy:
8+
max-parallel: 4
9+
matrix:
10+
os: [ubuntu-latest]
11+
12+
runs-on: ${{ matrix.os }}
13+
14+
steps:
15+
- name: Spell check install
16+
run: curl -L https://git.io/misspell | bash
17+
- name: Spell check docs
18+
run: bin/misspell -error docs/*
19+
20+
code_docs:
21+
strategy:
22+
max-parallel: 4
23+
matrix:
24+
os: [ubuntu-latest]
25+
python-version: [3.7]
26+
27+
runs-on: ${{ matrix.os }}
28+
29+
steps:
30+
- uses: actions/checkout@v1
31+
- name: Set up Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@v1
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
- name: Install dependencies
36+
run: |
37+
python -m pip install --upgrade pip
38+
pip install tox tox-gh-actions
39+
- name: Run docs tests
40+
run: tox -e docs
41+

.github/workflows/int.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Integration Tests
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
strategy:
8+
max-parallel: 4
9+
matrix:
10+
os: [ubuntu-latest]
11+
python-version: [3.7]
12+
13+
runs-on: ${{ matrix.os }}
14+
15+
name: Integration Tests
16+
17+
steps:
18+
- uses: actions/checkout@v1
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v1
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install requirements
24+
run: |
25+
wget https://github.com/openshift/source-to-image/releases/download/v1.2.0/source-to-image-v1.2.0-2a579ecd-linux-amd64.tar.gz
26+
tar -xvf source-to-image-v1.2.0-2a579ecd-linux-amd64.tar.gz
27+
sudo cp s2i /usr/local/bin
28+
pip install aiohttp
29+
pip install requests
30+
- name: Build image
31+
run: |
32+
s2i build . centos/python-36-centos7 cscfi/beacon-python
33+
34+
- name: Start Services
35+
run: |
36+
pushd deploy/test
37+
docker-compose up -d
38+
sleep 10
39+
docker exec test_beacon_1 beacon_init data/ALL.chrMT.phase3_callmom-v0_4.20130502.genotypes.vcf.gz data/example_metadata.json
40+
docker exec test_beacon_1 beacon_init data/ALL.chrMT.phase3_callmom-v0_4.20130502.genotypes.vcf.gz /exdata/example_metadata_registered.json
41+
docker exec test_beacon_1 beacon_init data/ALL.chrMT.phase3_callmom-v0_4.20130502.genotypes.vcf.gz /exdata/example_metadata_controlled.json
42+
docker exec test_beacon_1 beacon_init data/ALL.chrMT.phase3_callmom-v0_4.20130502.genotypes.vcf.gz /exdata/example_metadata_controlled1.json
43+
44+
- name: Run Integration test
45+
run: |
46+
pushd deploy/test
47+
python run_tests.py
48+
49+
- name: Collect logs from docker
50+
if: ${{ failure() }}
51+
run: cd deploy && docker-compose logs --no-color -t > ../tests/dockerlogs || true
52+
53+
- name: Persist log files
54+
if: ${{ failure() }}
55+
uses: actions/upload-artifact@v1
56+
with:
57+
name: test_debugging_help
58+
path: tests

.github/workflows/publish.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish Docker image
2+
3+
on:
4+
release:
5+
types: [published]
6+
push:
7+
branches: [master]
8+
9+
jobs:
10+
push_to_registry:
11+
name: Push Beacon Docker image to Docker Hub
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Login to DockerHub Registry
16+
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
17+
- name: Get the version
18+
id: vars
19+
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
20+
- name: Build the tagged Docker image
21+
run: docker build . --file Dockerfile --tag cscfi/beacon-python:${{steps.vars.outputs.tag}}
22+
- name: Push the tagged Docker image
23+
run: docker push cscfi/beacon-python:${{steps.vars.outputs.tag}}
24+
- name: Build the latest Docker image
25+
run: docker build . --file Dockerfile --tag cscfi/beacon-python:latest
26+
- name: Push the latest Docker image
27+
run: docker push cscfi/beacon-python:latest
28+
push_data_to_registry:
29+
name: Push Dataloader Docker image to Docker Hub
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v1
33+
- name: Login to DockerHub Registry
34+
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
35+
- name: Get the version
36+
id: vars
37+
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
38+
- name: Build the tagged Docker image
39+
run: |
40+
pushd deploy/test
41+
docker build . --file Dockerfile --tag cscfi/beacon-dataloader:${{steps.vars.outputs.tag}}
42+
- name: Push the tagged Docker image
43+
run: docker push cscfi/beacon-dataloader:${{steps.vars.outputs.tag}}
44+
- name: Build the latest Docker image
45+
run: |
46+
pushd deploy/test
47+
docker build . --file Dockerfile --tag cscfi/beacon-dataloader:latest
48+
- name: Push the latest Docker image
49+
run: docker push cscfi/beacon-dataloader:latest

.github/workflows/style.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Python style check
2+
3+
on: [push]
4+
5+
jobs:
6+
style_check:
7+
strategy:
8+
max-parallel: 4
9+
matrix:
10+
os: [ubuntu-latest]
11+
python-version: [3.6, 3.7]
12+
13+
runs-on: ${{ matrix.os }}
14+
15+
steps:
16+
- uses: actions/checkout@v1
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install tox tox-gh-actions
25+
- name: Test flake8 syntax with tox
26+
run: tox -e flake8
27+
- name: Do bandit static check with tox
28+
run: tox -e bandit

.github/workflows/unit.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Python Unit Tests
2+
3+
on: [push]
4+
5+
jobs:
6+
unit_test:
7+
strategy:
8+
max-parallel: 4
9+
matrix:
10+
os: [ubuntu-latest]
11+
python-version: [3.6, 3.7]
12+
13+
runs-on: ${{ matrix.os }}
14+
15+
steps:
16+
- uses: actions/checkout@v1
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install libcurl-devel
22+
run: sudo apt-get install libcurl4-openssl-dev
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install tox tox-gh-actions
27+
- name: Run unit tests
28+
env:
29+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
30+
run: tox -e unit_tests

.travis.yml

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

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
## beacon-python - Python-based Beacon API Web Server
22

3-
[![Build Status](https://travis-ci.org/CSCfi/beacon-python.svg?branch=master)](https://travis-ci.org/CSCfi/beacon-python)
4-
[![Coverage Status](https://coveralls.io/repos/github/CSCfi/beacon-python/badge.svg?branch=master)](https://coveralls.io/github/CSCfi/beacon-python?branch=master)
3+
![Integration Tests](https://github.com/CSCfi/beacon-python/workflows/Integration%20Tests/badge.svg)
4+
![Python Unit Tests](https://github.com/CSCfi/beacon-python/workflows/Python%20Unit%20Tests/badge.svg)
5+
[![Coverage Status](https://coveralls.io/repos/github/CSCfi/beacon-python/badge.svg?branch=HEAD)](https://coveralls.io/github/CSCfi/beacon-python?branch=HEAD)
56
[![Documentation Status](https://readthedocs.org/projects/beacon-python/badge/?version=latest)](https://beacon-python.readthedocs.io/en/latest/?badge=latest)
6-
[![Docker Image](https://images.microbadger.com/badges/image/cscfi/beacon-python.svg)](https://microbadger.com/images/cscfi/beacon-python)
77

88
Documentation: https://beacon-python.readthedocs.io
99

tests/coveralls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# Solution provided by https://stackoverflow.com/questions/32757765/conditional-commands-in-tox-tox-travis-ci-and-coveralls
99

1010
if __name__ == '__main__':
11-
if 'TRAVIS' in os.environ:
11+
if 'COVERALLS_REPO_TOKEN' in os.environ:
1212
rc = call('coveralls')
1313
sys.stdout.write("Coveralls report from TRAVIS CI.\n")
1414
# raise SystemExit(rc)

tox.ini

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,20 @@ deps =
3030
flake8-docstrings
3131
commands = flake8 .
3232

33-
[testenv]
33+
[testenv:unit_tests]
3434
setenv =
3535
CONFIG_FILE = {toxinidir}/tests/test.ini
36-
passenv = TRAVIS TRAVIS_*
36+
passenv =
37+
TRAVIS TRAVIS_*
38+
COVERALLS_REPO_TOKEN
3739
deps =
3840
.[test]
3941
-rrequirements.txt
4042
# Stop after first failure
4143
commands = py.test -x --cov=beacon_api tests/ --cov-fail-under=80
4244
python {toxinidir}/tests/coveralls.py
4345

44-
[travis]
45-
unignore_outcomes = True
46+
[gh-actions]
4647
python =
47-
3.6: py36
48-
3.7: py37
48+
3.6: flake8, unit_tests, docs, bandit
49+
3.7: flake8, unit_tests, docs, bandit

0 commit comments

Comments
 (0)