-
Notifications
You must be signed in to change notification settings - Fork 17
132 lines (116 loc) · 4.21 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: microsetta-interface CI
on:
pull_request:
push:
branches:
- master
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: lint it
run: python -m pip install --upgrade pip
- name: lint
run: |
pip install -q flake8
flake8 microsetta_interface
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup for conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.7
- name: Install
shell: bash -l {0}
run: |
conda create --yes -n test-microsetta-interface python=3.7
conda activate test-microsetta-interface
conda install --yes --file ci/conda_requirements.txt
pip install -r ci/pip_requirements.txt
pip install -e . --no-deps
- name: Test
shell: bash -l {0}
run: |
conda activate test-microsetta-interface
pytest
integration:
runs-on: ubuntu-latest
# Service containers to run with `runner-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:13.4
env:
POSTGRES_DB: ag_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# based on https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml#L44-L72
- 5432/tcp
steps:
# Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code
uses: actions/checkout@v2
- name: Setup for conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.7
- name: Install
env:
BRANCH: ${{ github.base_ref == 'master-overhaul' && 'master-overhaul' || 'master' }}
shell: bash -l {0}
run: |
echo Branch: $BRANCH
conda create --yes -n microsetta-interface python=3.7
conda activate microsetta-interface
conda install --yes --file ci/conda_requirements.txt
pip install -r ci/pip_requirements.txt
python setup.py compile_catalog
pip install -e . --no-deps
git clone -b $BRANCH --single-branch https://github.com/biocore/microsetta-private-api.git
pushd microsetta-private-api
pgport=${{ job.services.postgres.ports[5432] }}
sed -i "s/self.port = 5432/self.port = $pgport/" microsetta_private_api/config_manager.py
# PGPASSWORD is read by pg_restore, which is called by the build_db process.
export PGPASSWORD=postgres
conda create --yes -n microsetta-private-api python=3.7
conda activate microsetta-private-api
conda install --yes --file ci/conda_requirements.txt
pip install -r ci/pip_requirements.txt
pip install -e . --no-deps
# establish database state
python microsetta_private_api/LEGACY/build_db.py
popd
- name: Run integration tests
shell: bash -l {0}
run: |
conda activate microsetta-private-api
pushd microsetta-private-api
sed -i 's/"debug": true,/"debug": true, "disable_authentication": true,/' microsetta_private_api/server_config.json
python microsetta_private_api/server.py &
sleep 10 # give time to start up
popd
conda activate microsetta-interface
redis-server --daemonize yes
source keys_for_testing.sh
python microsetta_interface/tests/test_integration.py 2> >(tee -a stderr.log >&2)
# make sure we did not skip tests, which would indicate a failure in
# the harness. this test will produce an exit status of 1 if the
# test suite reports skipped tests
[[ $(tail -n 1 stderr.log | grep skipped) == "" ]];