Run testsuite in gitlab CI
The python rewrite has a testsuite, and I'm making sure that it runs with every commit locally.
When trying to run it in gitlab, it hangs forever here:
test/test_job_callback_get_repo_missing.py::test_callback_repo_missing_to_build_two_pkgs
This is the first test, that is actually building a package with pmbootstrap, so there's probably something going wrong there. In order to debug this, I suggest to add timeouts to the jobs, and print the full stack trace when hitting the timeout. Also we could upload the logs of the locally running tests as gitlab artifacts (which is essentially the pmbootstrap output).
https://gitlab.com/postmarketOS/build.postmarketos.org/-/jobs/313036542
Here's the code for .gitlab-ci.yml, which would make it run the testsuite:
pytest:
image: alpine:latest
before_script:
# Download pmaports-master.tar.gz, so we can use its install_pmbootstrap.sh.
# Get the whole repo and not just that script, because the script configures
# pmbootstrap to use the already downloaded copy of pmaports.
- wget -q "https://gitlab.com/postmarketOS/pmaports/-/archive/master/pmaports-master.tar.gz"
- tar -xf pmaports-master.tar.gz
# Install all bpo requirements
- ./pmaports-master/.gitlab-ci/install_pmbootstrap.sh py3-pip
- pip3 -q --disable-pip-version-check install -r requirements.txt pytest pytest-cov
# Put pmbootstrap dir in ../pmbootstrap (bpo.config.args.local_pmbootstrap)
- ln -s /tmp/pmbootstrap ../pmbootstrap
script:
- pytest --cov=bpo -vv test
Bonus points for displaying the coverage as badge: https://docs.gitlab.com/ee/user/project/pipelines/settings.html#test-coverage-parsing
EDIT: On second thought, we should run this with debian 9 and not alpine, since that is where it will be deployed. That might even work out of the box, because that's what I've been testing with.