-
Notifications
You must be signed in to change notification settings - Fork 20
89 lines (76 loc) · 3.13 KB
/
test_schematic_api.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
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
# This workflow creates an instance of data curator app with schematic, then
# creates a flask server running schematic to test data curator's use of
# schematic's REST API endpoints.
name: test-schematic-api
on:
pull_request:
branches:
- main
jobs:
test-schematic-rest-api:
runs-on: ubuntu-latest
# This image seems to be based on rocker/r-ver which in turn is based on debian
container: rocker/rstudio
env:
# This should not be necessary for installing from public repo's however remotes::install_github() fails without it.
GITHUB_PAT: ${{ secrets.REPO_PAT }}
steps:
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y pip python3.8-venv libcurl4-openssl-dev
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-pandoc@v1
- name: Create and Activate Python Virtual Environment
shell: bash
run: |
python3 -m venv .venv
chmod 755 .venv/bin/activate
source .venv/bin/activate
- name: Install R Packages Dependencies
run: |
R -f install-pkgs.R
- name: Install Schematic
shell: bash
run: |
source .venv/bin/activate
# use 'poetry' to install schematic from the develop branch
pip3 install poetry
git clone --single-branch --branch develop https://github.com/Sage-Bionetworks/schematic.git
cd schematic
poetry build
pip3 install dist/schematicpy-1.0.0-py3-none-any.whl
- name: Set Configurations for Schematic
shell: bash
run: |
source .venv/bin/activate
# download data model to the correct location
R -e '
config <- yaml::yaml.load_file(".github/schematic_config.yml");
url <- config$model$input$download_url;
path <- config$model$input$location;
system(sprintf("mkdir -p %s", dirname(path)));
system(sprintf("wget %s -O %s", url, path));
'
# overwrite the config.yml in schematic
mv -f .github/schematic_config.yml schematic/config.yml
# write out configuration files using github secrets
echo "${{ secrets.SCHEMATIC_SYNAPSE_CONFIG }}" > schematic/.synapseConfig
echo "${{ secrets.SCHEMATIC_SERVICE_ACCT_CREDS }}" > schematic/schematic_service_account_creds.json
echo "${{ secrets.SCHEMATIC_CREDS_PATH }}" > schematic/credentials.json
echo "${{ secrets.SCHEMATIC_TOKEN_PICKLE }}" | base64 -d > schematic/token.pickle
- name: Run schematic API service
shell: bash
run: |
echo "SYNAPSE_PAT='${{ secrets.SYNAPSE_PAT }}'" > .Renviron
source .venv/bin/activate
cd schematic
pip3 uninstall -y markupsafe
pip3 install markupsafe==2.0.1
python3 run_api.py &
- name: Run tests
shell: Rscript {0}
run: |
devtools::test()