AutoUpdated #124
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: PythonTest | |
on: | |
workflow_dispatch: | |
workflow_call: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
env: | |
SIRIUS_USER: ${{ secrets.SIRIUS_USER }} | |
SIRIUS_PW: ${{ secrets.SIRIUS_PW }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
id: pysirius_install | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install flake8 | |
pip install ./client-api_python/generated | |
echo "Finished Installing" | |
- name: Cache Sirius Release | |
id: cache-sirius | |
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: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 ./client-api_python --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 ./client-api_python --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Unset DISPLAY | |
run: echo "JAVA_TOOL_OPTIONS=-Djava.awt.headless=true" >> $GITHUB_ENV | |
- name: Run Rest Api | |
run: bash .updater/api/sirius/bin/sirius REST -p 8080 -s & | |
- name: Wait for Api to start | |
id: api_start | |
run: while ! nc -z localhost 8080; do sleep 0.1; done | |
- name: Login to SIRIUS | |
id: login | |
run: | | |
import os | |
import PySirius | |
accept_terms = True | |
account_credentials = PySirius.AccountCredentials(username=os.environ['SIRIUS_USER'], password=os.environ['SIRIUS_PW']) | |
configuration = PySirius.Configuration(host = "http://localhost:8080") | |
api_instance = PySirius.LoginAndAccountApi(PySirius.ApiClient(configuration)) | |
api_response = api_instance.login(accept_terms, account_credentials) | |
if isinstance(api_response, PySirius.AccountInfo): | |
exit(0) | |
else: | |
print('Login failed, aborting...') | |
exit(1) | |
shell: python | |
- name: Test actuator API | |
if: always() && steps.api_start.outcome == 'success' && steps.pysirius_install.outcome == 'success' && steps.login.outcome == 'success' | |
run: python test_actuator_api.py | |
working-directory: .updater/clientTests/PythonTests/test | |
- name: Test compounds API | |
if: always() && steps.api_start.outcome == 'success' && steps.pysirius_install.outcome == 'success' && steps.login.outcome == 'success' | |
run: python test_compounds_api.py | |
working-directory: .updater/clientTests/PythonTests/test | |
- name: Test features API | |
if: always() && steps.api_start.outcome == 'success' && steps.pysirius_install.outcome == 'success' && steps.login.outcome == 'success' | |
run: python test_features_api.py | |
working-directory: .updater/clientTests/PythonTests/test | |
- name: Test info API | |
if: always() && steps.api_start.outcome == 'success' && steps.pysirius_install.outcome == 'success' && steps.login.outcome == 'success' | |
run: python test_info_api.py | |
working-directory: .updater/clientTests/PythonTests/test | |
- name: Test jobs API | |
if: always() && steps.api_start.outcome == 'success' && steps.pysirius_install.outcome == 'success' && steps.login.outcome == 'success' | |
run: python test_jobs_api.py | |
working-directory: .updater/clientTests/PythonTests/test | |
- name: Test login_and_account API | |
if: always() && steps.api_start.outcome == 'success' && steps.pysirius_install.outcome == 'success' && steps.login.outcome == 'success' | |
run: python test_login_and_account_api.py | |
working-directory: .updater/clientTests/PythonTests/test | |
- name: Test projects API | |
if: always() && steps.api_start.outcome == 'success' && steps.pysirius_install.outcome == 'success' && steps.login.outcome == 'success' | |
run: python test_projects_api.py | |
working-directory: .updater/clientTests/PythonTests/test | |
- name: Test searchable_databases API | |
if: always() && steps.api_start.outcome == 'success' && steps.pysirius_install.outcome == 'success' && steps.login.outcome == 'success' | |
run: python test_searchable_databases_api.py | |
working-directory: .updater/clientTests/PythonTests/test |