-
Notifications
You must be signed in to change notification settings - Fork 95
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
Switch to GitHub Actions CI #1163
Conversation
I'm hitting some obstacles here... I'd like to keep the test suite as it is, so that it can be easily run on a developer machine, without involving e.g. Docker containers. So in this case, Fuseki needs to be running and initialized with the test data, which is normally done using the tests/init_fuseki.sh script. Then Fuseki can be accessed as http://localhost:13030/ (the default port 3030 is not used because that could interfer with another running instance of Fuseki). This works since the testconfig.ttl file specifies http://localhost:13030/ as the SPARQL endpoint to use. Under GitHub Actions, the normal way to run databases needed for unit tests is to set them up as service containers. So e.g. the stain/jena-fuseki image would be downloaded from Docker Hub and running in its own container. This seems pretty convenient once it's been set up, there's no need for the hassle of trying to download the correct Fuseki distribution archive from apache.org. Now there are two ways of running GitHub Actions:
OTOH, it would be nice to run the unit tests in parallel on multiple PHP versions. The normal Ubuntu 20.04 base image provides PHP 7.4 and 8.0, but no other versions (e.g. 7.2 or 7.3). There is a set of Actions modules(?) called php-actions which makes it possible to use other PHP versions - but in this case, the PHP environment is running in a container. So this leaves a choice:
There might be a way of running older/alternative PHP versions also in scenario 1, since many versions of PHP are available in Ondřej Surý's PPA and it's possible to install custom deb packages in the runner environment. But I'm a bit hesitant to go that way since php-actions seems to provide all the infrastructure necessary for running multiple PHP versions, in a nice package. |
In fact the
So the address is pretty heavily hardcoded in to the test suite. In the .php files we could probably read it from, say, an environment variable, but for the .ttl files there is no simple templating or variable expansion mechanism which would allow using two different addresses in different settings... Any ideas @kinow? |
I think I figured out a good solution...we should make GlobalConfig (and Vocabulary) check if there's an environment variable (FUSEKI_ADDRESS or something along those lines) and fall back to that if no |
Sounds like a good solution. I prefer the approach that tests multiple PHP versions too, while also isolating the testing environment with a container. If the env var approach becomes too hard to implement now, maybe we could simply have a port-forwarder listening for requests to Not elegant but only in case you'd prefer to leave the env var for later if it becomes too complicated 👍 |
I thought about this too... But I don't see how it would help in the scenario where it would matter. If we want to easily run tests on multiple PHP versions in parallel, we need to use the php-actions method where PHPUnit is run in its own container built using php-build based on the official PHP container - or at least that's how I understood it, I haven't studied it very deeply. We'd somehow have to smuggle in |
Now that it's possible to specify the Fuseki endpoint using an environment variable (#1166) I tried again setting this up via php-actions/phpunit. However, I hit new issues: the PHPUnit container is sitting on the default bridge network, so it cannot access the Fuseki service container. I opened an issue in php-actions/phpunit explaining the problem and suggesting potential fixes. |
…r.lock in the repo)
Codecov Report
@@ Coverage Diff @@
## master #1163 +/- ##
============================================
- Coverage 67.97% 67.89% -0.09%
- Complexity 1584 1587 +3
============================================
Files 32 32
Lines 3888 3884 -4
============================================
- Hits 2643 2637 -6
- Misses 1245 1247 +2
Continue to review full report at Codecov.
|
SonarCloud Quality Gate failed. 0 Bugs No Coverage information |
This is now basically working but the git history is very messy. I'm closing this and opening a new PR instead, with cleaner history. |
Initial draft PR trying to implement GitHub Actions CI instead of Travis CI.
Fixes #1147
TODO items: