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

Conversation

heinpa
Copy link
Collaborator

@heinpa heinpa commented Apr 24, 2024

Execute Java and Python component tests whenever a new PR is made to the master branch.
This should check that code changes do not change the intended behaviour or that tests were updated to reflect the new functionality.
These tests would also reveal if component updates depend on external updates to the Qanary repository (like commons). They would fail if some components depend on changes to Qanary, that have not yet made it into the main branch.
A GitHub action ensures that the tests are executed at least once before changes are merged into the main branch.

Execute CodeQL for every new PR and push to master branch.

@heinpa heinpa requested review from anbo-de and Perevalov April 24, 2024 17:27
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@heinpa
Copy link
Collaborator Author

heinpa commented Apr 24, 2024

Note that the checks executed as part of this PR are exactly the ones that are proposed.

test-python cannot succeed at this point, because tests were not updated to reflect changed behaviour on the current master branch (this is partly why I wanted to introduce this action).
Updates to the tests are proposed in PR 349.

test-java fails because OPENAI_API_KEY is supposedly not set. However, it does exist in the repository secrets and is referenced as environment variable in the workflow file. So I'm not quite sure what's wrong here.

@anbo-de @Perevalov
I would appreciate a review and help with the remaining issues to get these workflows running.

@heinpa
Copy link
Collaborator Author

heinpa commented Apr 24, 2024

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Code scanning with CodeQL has been removed from this PR again.
It would require separate building of the Qanary project beforehand, which is not yet implemented as an independent script.

@heinpa heinpa marked this pull request as ready for review May 7, 2024 10:29
@heinpa
Copy link
Collaborator Author

heinpa commented May 7, 2024

Live tests are no longer executed as part of the workflow

@heinpa
Copy link
Collaborator Author

heinpa commented May 10, 2024

Seems like because there is no more space left, not all packages can be installed while testing python components. This of course means the tests fail.

ERROR: Could not install packages due to an OSError: [Errno 28] No space left on device
./service_config/test_python_components.sh: line 15: pytest: command not found

SOLVED by adding a cleanup step after tests.
I have also added a summary at the end of the script for python tests.

@heinpa
Copy link
Collaborator Author

heinpa commented May 10, 2024

The Python tests script is taking a long time to run, compared to the one for Java components. I assume this is because of the re-installation of the requirements with pip (since the environment is created new for every component). Is there a better way to handle this?

I avoided a shared environment, mainly because it allows "laziness" when defining the individual requirement files for components.

EDIT
@anbo-de @Perevalov
I've now moved to a shared environment for all Python components, which speeds up the process quite a bit. Please share your thoughts on this!

@heinpa heinpa requested a review from Perevalov May 10, 2024 19:04
@heinpa heinpa marked this pull request as draft May 22, 2024 13:47
@anbo-de anbo-de marked this pull request as ready for review June 15, 2024 20:16
@anbo-de anbo-de self-assigned this Jun 15, 2024
@anbo-de anbo-de added the enhancement New feature or request label Jun 15, 2024
@@ -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.

if mkdir environments; then
echo "External environment directory created"
else
echo "External environment directory could not be created"
Copy link
Member

Choose a reason for hiding this comment

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

@heinpa Should there be a exit here to stop?

Copy link
Member

@anbo-de anbo-de left a comment

Choose a reason for hiding this comment

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

@heinpa Looks very good. Just minor changes. See comments.

@heinpa heinpa requested a review from anbo-de July 2, 2024 08:48
@heinpa
Copy link
Collaborator Author

heinpa commented Jul 2, 2024

@anbo-de requested changes have been added and subshell for building Qanary dependencies locally was removed.

There are now also exclusions for submodules:

TEST and BUILD:

  • Python: excluded using submodules list
  • Java: submodules must not be included in reactor -> a check is included

DEPLOY:

  • automatic deployment via microservice updater relies on explicit configuration of services in service_config.json -> don't include submodules

@anbo-de anbo-de merged commit d556317 into WDAqua:master Jul 18, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants