-
Notifications
You must be signed in to change notification settings - Fork 46
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 support to Gitlab CI #39
Comments
We're using it right now in our GitLab CI/CD and it works! |
Hello @kabalin Here is an example https://gist.github.com/adpe/834c741156edd6a6403eebe148a0ecec, but pay attention. It's not up-to-date. And as I noticed today at work, the Behat tests can't be run. The rest seems still to work. The problem is mainly, that from within the I'm now figuring out Behat tests can be run in another service container, and Maybe you have some idea, how to do that? Greets, |
I've seen some which work for a particular plugin but apply it to another one it rarely does work. I also think it would be good to have one well structured to allow for runs to happen in parallel - phpunit, behat & the rest - at least. But also Travis was useful for matrixes of Moodle version, db engine, php versions - that I have never seen in a gitlab-ci.yml for Moodle yet I think Gitlab would be worth the effort because there is some free runners one can use but more importantly any dev can setup a runner on a spare machine under the desk, cheap cloud server or roaring number crunching beast depending on their budget - https://docs.gitlab.com/runner/install/index.html |
Hi @aspark21 With different job definitions you could achieve the same as the matrix approach. Does somebody have Behat working in a GitLab CI/CD environment? Greets |
I've seen that you have Behat setup in this repository https://github.com/moodleworkplace/moodle-mod_coursecertificate/blob/master/.gitlab-ci.yml But I've problems to set up Behat for my plugin. Output: $ moodle-plugin-ci behat --suite default --profile chrome
RUN Behat features for local_<plugin-name>
In BehatCommand.php line 130:
Docker is not available, can't start Selenium server
behat [-m|--moodle MOODLE] [-p|--profile PROFILE] [--suite SUITE] [--start-servers] [--auto-rerun AUTO-RERUN] [--dump] [--] [<plugin>] Any hints? I'm using the [debug] Enabling Behat
RUN php -d log_errors=1 -d error_log=NULL /var/www/html/moodle/admin/tool/behat/cli/util_single_run.php --enable --add-core-features-to-theme
OUT Creating Behat configuration ... done in 4.13 seconds.
OUT Building theme CSS for boost [ltr] ... done in 2.09 seconds.
OUT Building theme CSS for classic [ltr] ... done in 1.67 seconds.
OUT Testing environment themes built
OUT Acceptance tests environment enabled on http://localhost:8000, to run the tests use:
OUT vendor/bin/behat --config /builds/ffhs-it-services/moodle/moodledata/behat_moodledata/behatrun/behat/behat.yml
OUT [info] Install completed
RES Command ran successfully
$ moodle-plugin-ci phplint Really appreciate any hints and help! Greets |
Hi @adpe,
Among the Wondering if the HTH, |
Hi @scara I've included this service as well the Greets |
Hi @adpe,
Not quite, since it is supported in the standard moodle-plugin-ci too. I still believe that one customization in the workplace flavour is to (optionally?) avoid creating the selenium instance: it would be nice if that feature could be ported into the standard version, here, to help CI scenarios like the one related to GL. HTH, |
Yep @scara - you're right. It tries actually to run the tests and not starting any more new Selenium server instance. Now I get following output: Behat requirement not satisfied: http://localhost:8000/behatrun1 is not available, ensure you specified correct url and that the server is set up and started.
.
.
.
Behat requirement not satisfied: http://localhost:8000/behatrun2 is not available, ensure you specified correct url and that the server is set up and started.
.
.
.
Behat requirement not satisfied: http://localhost:8000/behatrun3 is not available, ensure you specified correct url and that the server is set up and started.
.
.
.
Exit codes for each behat run:
behatrun1: 251
behatrun2: 251
behatrun3: 251 It's still not working and I tried different approaches. We're using our own infrastructure running GitLab and the GitLab Runners. Would good if @marinaglancy could assist me, so that we can provide a clean and good solution for the Moodle developers out there. Greets |
Here is behind the scenes part of export TRAVIS_BUILD_DIR="$CI_PROJECT_DIR"
if [[ "$DB" == "mysqli" ]]; then
export DB_HOST="mysql"
elif [[ "$DB" == "pgsql" ]]; then
export DB_HOST="postgres"
else
export DB_HOST="$DB"
fi
export IPADDRESS=`grep "${HOSTNAME}$" /etc/hosts |awk '{print $1}'`
export MOODLE_BEHAT_WWWROOT="http://${IPADDRESS}:8000"
export MOODLE_START_BEHAT_SERVERS="NO" Docker image is extending |
Thanks @kabalin Right now I'm using the workplace image to reduce the amount of errors and to get it finally run. But it's not working. This is my actual As I understand, I don't must care about the variables you are exporting right now in the workplage image. I must only add these to my file, if I'll use the default Do you see any errors on my actual file? Greets |
By the way. I've seen today that GitLab.com offers a CI/CD connection for external repositories: Greets |
I've now a working solution using the Hope that helps others as well! Greets |
Many thanks @adpe for investigation work and working example! Now we have a good starting point to make it recorded in docs one day and create |
As suggested by @danielneis in open-lms-open-source/moodle-plugin-ci#13 it could be really usefull to add Gitlab CI support :)
The text was updated successfully, but these errors were encountered: