Pmbootstrap finds all its host dependencies during init, ensure we do
that for pytest too.
Adapt require_programs() to use subprocess directly rather than have to
solve the weird dependency chain of pmb.helpers.run which depends on the
global context being initialised before it's usable.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Add some unit tests to ensure that the parser correctly detects boot
images with header v0, 2, and 3.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This test includes a binary blob which we want to avoid in our codebase.
It is also better suited as a unit test where it can contribute to code
coverage. Revert this and use a unit test version instead.
This reverts commit d19de946b3.
Add some unit tests to ensure that the parser correctly detects boot
images with header v0, 2, and 3.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
While there are places where it would make some sense to catch issues in
the lint stage, most of the lint failures are things like shellchcek or
ruff which don't actually effect the functionality of the code.
Let's just run pytest at the same time as these to speed up the overall
pipeline.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Use Alpine 3.17 to test pmbootstrap with older versions of Python
Fixes: #2477
Suggested-by: Oliver Smith <ollieparanoid@postmarketos.org>
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Refactor the integration test script to support running a variety of
tests, and add CI jobs for them.
Additionally, move the integration tests to their own stage so we don't
potentially waste a bunch of CI time running them on broken branches.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Use the new "Artifacts" directive for .ci/docs.sh and run the job in the
pmbootstrap chroot to avoid needing to install sphinx dependencies on
the host.
Fixes#2352
Adjust the pytest CI to work with the new tests.
It's useful to run pytest even when linters fail, so set allow_failure
for the lint jobs.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Currently there is very little info from test failures when the test
fails in some call to pmbootstrap. By saving the log file to CI
artifacts on failure, we can make it really easy to find/obtain
important stuff to help with debugging.
The local before_script variable overrides the global one, which I
assume wasn't the intent when the local before_script was added to
mr-settings. As such, add an achor to ensure that the global one is run
too.
Add the check again that ensures we can write to the target repository.
This is needed for our merge style, we add the MR-ID to the title of the
commit message, and may do small fixups while merging.
Replace .gitlab-ci.yml with a minimal .build.yml that runs a script in
the .ci dir for each task. Each of these scripts runs as root first,
installs dependencies, and then drops rights to the testuser and runs
the actual test. I went with this design, so we can add a
'pmbootstrap ci' command in following patches that run these in a
pmbootstrap chroot (see pmaports#2169).
Looking at flake8, we currently ignore W504 and W604. Would be nice to
fix these instead, but let's do that in another patch.
I've added a minver package to Alpine, so we don't need to install it
form pip anymore. Use minver's new --lint argument to simplify the
script, and as recommended by minver itself, use --no-parse-comments as
speed optimization since we don't have minver specific comments.
Using doas instead of sudo in build.yml would be nice, but this doesn't
work out of the box. Can be changed in the future.
Add a note to the pytest script, that 'pmbootstrap log' can be used to
follow the log while tests are running.
It's more annoying than useful to have to wait for the first stage
before the second stage (pytest) starts. I'd rather have the whole
pipeline run through quicker and see if there are python errors too even
if linting errors are not resolved yet.
In pmaports.git this makes more sense: there we have "lint" and "build"
and in the worst case "build" may take up to three hours. So it makes
sense to only start it if there are no cosmetic errors. But that's not
the case here.
CI started failing with:
/builds/ollieparanoid/pmbootstrap/venv/bin/python3: No module named pytest
I've briefly tried to fix this with the existing scripts. However,
instead of investing more time into that, do the long overdue
refactoring of the scripts that involve dropping the venv logic and
support for a custon gitlab-ci-runner using some python docker image as
base. This configuration hasn't been used for a long time and is
probably broken anyway.
Refactor the logic to skip the qemu test case in gitlab CI by using
pytest markers. The new script is now similar to bpo's .ci/pytest.py.