Skip to content

Draft don't merge

Draft don't merge #104

# 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()