Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflows for codeql and component testing #350

Merged
merged 19 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Qanary component test pipeline

on:
pull_request:
branches: [master]

jobs:
test-java:
runs-on: ubuntu-latest
env:
BABELFY_API_KEY : someapikey
anbo-de marked this conversation as resolved.
Show resolved Hide resolved
CHATGPT_API_KEY : someapikey
DANDELION_API_KEY : someapikey
MEANINGCLOUD_API_KEY : someapikey
TAGME_API_KEY : someapikey
TEXTRAZOR_API_KEY : someapikey
OPENAI_API_KEY : someapikey
BABELFY_API_LIVE_TEST_ACTIVE : false
PLATYPUS_API_LIVE_TEST_ACTIVE : false
TEXTRAZOR_API_LIVE_TEST_ACTIVE : false
CHATGPT_API_LIVE_TEST_ACTIVE : false
DANDELION_API_LIVE_TEST_ACTIVE : false
MEANINGCLOUD_API_LIVE_TEST_ACTIVE : false
AGDISTIS_API_LIVE_TEST_ACTIVE : false
OPENAI_API_LIVE_TEST_ACTIVE : false
TAGME_API_LIVE_TEST_ACTIVE : false
steps:
- name: Configure java
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '17'
- uses: actions/checkout@v4
- name: Test Java components
run: bash -c ./service_config/test_java_components.sh
test-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test Python components
run: bash -c ./service_config/test_python_components.sh
19 changes: 19 additions & 0 deletions service_config/test_java_components.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# clone Qanary pipeline
git clone https://github.com/WDAqua/Qanary.git
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heinpa Seems to be not required anymore due to the Qanary packages stored at Maven repository, now.


# subshell building the Qanary pipeline
(
cd Qanary/
mvn --batch-mode clean install -Ddockerfile.skip=true -DskipTests -Dgpg.skip=true
)

# delete Qanary pipeline repository
rm -rf Qanary/

# test components
if ! mvn --batch-mode --no-transfer-progress test;
then
echo "Maven test failed"
exit 4 # stop if test fails
fi
23 changes: 23 additions & 0 deletions service_config/test_python_components.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# TODO: navigate into individual python components, setup venv and run tests, then deactivate

components=$(ls | grep -P "qanary-component.*Python-[a-zA-Z]+$")

for dir in $components
do
name=$(echo ${dir} | tr "[:upper:]" "[:lower:]")
echo "Testing ${name} ..."
cd $dir
python -m venv env
source env/bin/activate
pip install -r requirements.txt
if ! pytest;
then
echo "Pytest failed"
deactivate
exit 4 # stop if test fails
fi
deactivate
cd ..
done
Loading