Skip to content

AutoUpdated

AutoUpdated #116

Workflow file for this run

# This workflow will install R, Rsirius dependencies and test the Rsirius package using testthat
# For more information see: https://github.com/r-lib/actions
name: RTest
on: [workflow_dispatch, workflow_call, pull_request]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
r-version: ["4.0.0", "4.1.0", "4.2.0", "4.3.0", "4.4.0"]
env:
SIRIUS_USER: ${{ secrets.SIRIUS_USER }}
SIRIUS_PW: ${{ secrets.SIRIUS_PW }}
steps:
- uses: actions/checkout@v3
- name: Set up R ${{ matrix.r-version }}
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r-version }}
- name: Install Rsirius dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache: false
working-directory: ./client-api_r/generated
- name: Install Rsirius
run: install.packages("/home/runner/work/sirius-client-openAPI/sirius-client-openAPI/client-api_r/generated", repos = NULL, type = "source")
shell: Rscript {0}
- name: Cache Sirius Release
uses: actions/cache@v3
with:
path: .updater/api/sirius
key: sirius
fail-on-cache-miss: true
- name: Download tomato_small project space
run: wget ${{ secrets.TOMATO_SMALL_DOWNLOAD_LINK }} -O tomato_small.sirius
- name: Change HOME to working directory of runner
run: echo "HOME=/home/runner/work/sirius-client-openAPI" >> $GITHUB_ENV
- name: Run Rest Api
run: bash .updater/api/sirius/bin/sirius REST -p 8080 -s &
- name: Wait for Api to start
run: while ! nc -z localhost 8080; do sleep 0.1; done
- name: Login to SIRIUS
run: |
library(Rsirius)
var_accept_terms <- TRUE
var_account_credentials <- AccountCredentials$new(Sys.getenv('SIRIUS_USER'), Sys.getenv('SIRIUS_PW'))
api_instance <- rsirius_api$new()
api_response <- api_instance$login_and_account_api$Login(var_accept_terms, var_account_credentials)
if (inherits(api_response, "AccountInfo")) {
quit(status=0)
} else {
print('Login failed, aborting...')
quit(status=1)
}
shell: Rscript {0}
- name: Copy tests into Rsirius folder for testing
run: |
mkdir -p client-api_r/generated/tests
cp -r .updater/clientTests/RTests/test client-api_r/generated/tests/testthat
cp .updater/clientTests/RTests/testthat.R client-api_r/generated/tests/testthat.R
# TODO move back after issues are fixed
rm client-api_r/generated/tests/testthat/test_compounds_api.R
- name: Build Rsirius
run: |
R CMD build ./client-api_r/generated
- name: Test Rsirius using testthat
run: |
R CMD check Rsirius_0.9.tar.gz --no-manual