-
Notifications
You must be signed in to change notification settings - Fork 14
88 lines (74 loc) · 2.22 KB
/
test.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
name: KBase Catalog test
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
# run workflow when merging to main or develop
branches:
- main
- master
- develop
jobs:
catalog_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- python-version: '3.7'
mongo-version: '3.6'
- python-version: '3.7'
mongo-version: '7.0.4'
services:
mongo:
image: mongo:${{matrix.mongo-version}}
ports:
- 27017:27017
options: --name mongo${{matrix.mongo-version}}
steps:
- name: Repo checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python-version}}
- name: Install dependencies and set up test config
shell: bash
env:
KBASE_CI_TOKEN: ${{ secrets.KBASE_CI_TOKEN }}
ADMIN_USER: ${{ secrets.KBASE_BOT_USER_CI }}
run: |
# test mongo connection
curl http://localhost:27017
returncode=$?
if [ $returncode != 0 ]; then exit $returncode; fi
# set HOMEDIR
export HOMEDIR=`pwd`
# move to parent dir to install binaries etc
cd ..
# setup kb-sdk
mkdir -p $(pwd)/bin
docker run ghcr.io/kbase/kb_sdk_patch-develop:br-0.0.4 genscript > $(pwd)/bin/kb-sdk
chmod 755 $(pwd)/bin/kb-sdk
export PATH=$(pwd)/bin:$PATH
# install catalog dependencies
cd $HOMEDIR
pip install -r requirements.txt
# setup test config
cp -n test/test.cfg.example test/test.cfg
sed -i "s#^nms-admin-token.*#nms-admin-token=$KBASE_CI_TOKEN#" test/test.cfg
sed -i "s#^method-spec-admin-users.*#method-spec-admin-users=$ADMIN_USER#" test/test.cfg
- name: Run tests
shell: bash
run: make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true