Commit graph

42 commits

Author SHA1 Message Date
Christian Kellner
2902d0945b ci: check spelling via codespell
Use the github action[1] provided by the codespell project to
check the spelling on every PR.

[1] https://github.com/codespell-project/actions-codespell
2020-10-06 14:41:00 +02:00
Christian Kellner
a505a82169 ci: schedule coverity only for osbuild/osbuild
Don't schedule the run of coverity on forks of osbuild, but only
on the main repository.
2020-07-07 08:26:53 +02:00
Christian Kellner
3d13c825c0 ci: run coverity check every night
Add a github workflow that will trigger the run of coverity every
night at 05:00 UTC. Uses the new Makefile coverity targets.
2020-06-24 10:01:24 +02:00
David Rheinsberg
5c3ce5c30a ghci: merge unittest invocations
Merge all unittest invocations into a single Github-Workflow Job. This
simplifies our workflow and allows us to easily parallelize individual
jobs.
2020-06-05 09:27:40 +02:00
David Rheinsberg
0010514c4a test: move assembler-tests into ./test/run/
Move the last remaining test into the correct subdir. With this done,
all our tests run in one of the 3 groups:

   * `make test-src`
     Run tests against the source-code, including linters.

   * `make test-mod`
     Run unit-tests on the individual python modules. This needs no
     special permissions (unless noted in each test) or runtime
     environments. It is meant to be fast and easy to run in all
     circumstances.

   * `make test-run`
     Run tests that execute the osbuild pipeline. This requires
     superuser privileges and will likely take a while. Furthermore,
     this might produce large artifacts.
2020-06-05 09:27:40 +02:00
David Rheinsberg
55da864e0a build: align makefile targets with test-targets
Align the makefile targets with the test-targets (`module` -> `mod`,
etc.). This way, we have consistent names everywhere.

While at it, move the `make test-run` invocation closer to the others.
2020-06-05 09:27:40 +02:00
David Rheinsberg
d584a1e225 test: move stage-tests into test/run and test/data
Move the stage-tests over to the new test-infrastructure. This moves
the test invocation into `./test/run/test_stages.py`, so it is invoked
as part of the runtime-tests. Secondly, the test-data is stored in
./test/data/stages/ so the path is relative to
TestBase.locate_test_data().

While at it, this also drops the dynamic class modifications and instead
uses subTest(). This simplifies the code quite a bit and avoids
dynamically creating python code.
2020-06-05 09:27:40 +02:00
David Rheinsberg
e8445da3d9 test: move test_osbuild.py into module tests
Move the `test_osbuild.py` test into the module-test directory. This
test contains just a bunch of basic functionality tests for a selection
of osbuild modules. Hence, it can be run together with the other module
tests.
2020-06-05 09:27:40 +02:00
David Rheinsberg
3cf8b79e80 test: move test_objectstore into module-tests
Move `test_objectstore` into the module-level tests. This allows us to
run it as part of `make test-module.

Make sure to properly guard it as root-only module.
2020-06-05 09:27:40 +02:00
David Rheinsberg
9bb6123963 test: convert test_boot to runtime tests with F32
Move the `test_boot` suite into ./test/run closer to the other runtime
tests, and convert the used manifest over to an MPP based F32 manifest.
2020-06-05 09:27:40 +02:00
David Rheinsberg
2aa9755f88 ci: regenerate test data
Run the MPP tools in the CI and verify the committed test-data did not
change and is up-to-date.

This runs `make test-data` and then simply uses `git diff --exit-code`
to trigger a CI failure if there are any differences in ./test/data.
2020-06-05 09:27:40 +02:00
David Rheinsberg
a3d1e3ff50 test: import no-op test into the runtime-tests
Add a new trivial runtime-test which simply runs a no-op pipeline. This
is a fast, trivial test that simply verifies osbuild is properly setup
and accessible.

Remove the explicit no-op test from the CI, now that the test-suite has
it as well.
2020-06-05 09:27:40 +02:00
Major Hayden
0640610f54 Remove RPM builds in GitHub Workflows
We are now building RPMs via mock in Jenkins, so we don't need these RPM
build jobs in GitHub Workflows.

Signed-off-by: Major Hayden <major@redhat.com>
2020-05-22 09:00:01 -05:00
Major Hayden
53ba692dbe GH Actions: Use upstream Fedora containers
Work around the quay.io issues by using the standard Fedora containers.
Also, make most of the dnf operations a little quieter to make it easier
to find problems.

Signed-off-by: Major Hayden <major@redhat.com>
2020-05-22 10:39:51 +02:00
David Rheinsberg
0ffae822ce ci: run test-src with ghci
Use the GHCI image to run `make test-src`. This makes sure all our
dependencies are available (including `dnf`, `hawkey`, and other python
packages).
2020-05-20 18:54:38 +02:00
David Rheinsberg
134376d8da ci: move test_boot to github-actions
Move the `test_boot` test from Travis over to the Github-Actions based
CI. This is the last test on Travis, and the Travis CI can now be
disabled, if we so wish.

This test leaves a valid `travis.yml` file around, since Travis will
still be enabled on the repository. We should first disable Travis and
then drop this file, if we want to get rid of it.
2020-05-13 22:00:27 +02:00
David Rheinsberg
cd95a8a167 ci: use osbuild/containers images
Use the images provided by `osbuild/containers` tagged as GHCI (GitHub
CI). These images are fully under our control, cached on the GitHub
infrastructure, and prepared to run `systemd-nspawn` and friends in a
docker container.

The GHCI infrastructure is versioned. New updates to the CI
infrastructure are not automatically picked up. Instead, the `v1` tag
has to be explicitly redirected to new image builds to deploy them. If
a new deployment causes CI failures, we can simply redirect the `v1` tag
back to the previous image builds and get the previous behavior back.

The `osbuild/containers` repository contains the required
infrastructure for this logic. If new dependencies are required in the
CI environment, the respective Dockerfiles must be updated. As a
temporary workaround (e.g., as part of a PR that introduces this), you
can simply add `dnf install -y <package>` to the required entries in
`.github/workflows/*`.
2020-05-13 22:00:27 +02:00
David Rheinsberg
082b840d94 test: integrate pylint into the test infrastructure
Introduce a third test-group called `src` alongside `mod` and `run.
This will contain tests that run against the source code of osbuild.

This initial commit introduces `test/src/test_pylint.py` which will run
the python linter against all our sources.
2020-05-13 14:26:05 +02:00
Christian Kellner
cb0db496dc ci: validate the samples
Use the new `--inspect` feature of osbuild to validate all our
samples.
2020-05-06 15:42:23 +02:00
Christian Kellner
e77d95f4b7 osbuild: add meta module for metadata information
This new module contains utilities that help to introspect parts
that constitute the inner parts of osbuild, i.e. its stages
and assembler (which is also considered a type of stage in
this context). It contains the `StageInfo` class that can that
contains meta-information about the individual stage, such as
a short information (`info`), a longer description (`desc`) and
its JSON schema. A new Schema class represents schema data and
has a `validation` method that can be used to validate that json
data conforms to said schema.
A `Index` class can be used to obtain `StageInfo` and `Schema`
for entities identified via `klass` and `name`.
A top level `validate` method is introduced that can validate
manifest data.
Internally it uses the `jsonschema` package so add that as a
requirement and Install this dependency in the CI.
2020-05-06 15:42:23 +02:00
David Rheinsberg
20cf5dba6a test: '{. -> ./mod}/test_util_osrelease.py'
Move the os-release tests to the module-level tests and align its
coding-style with the others.
2020-04-28 15:39:00 +02:00
David Rheinsberg
aaa8854437 test: '{. -> ./run}/test_sources.py'
Move the runtime tests of source modules into the runtime-tests
subdirectory, so `make test-runtime` can pick them up.
2020-04-24 15:50:44 +02:00
David Rheinsberg
cecb27ac82 test: '{. -> ./mod}/test_util_ostree.py'
Move the OSTree utility tests into the module-unittests directory. Also
drop the `__main__` workaround while at it.
2020-04-24 15:50:44 +02:00
David Rheinsberg
6a7e811af2 test: '{. -> ./mod}/test_util_selinux.py'
Move the 'test_util_selinux.py' test into the module-unittest
subdirectory.

Drop the '__main__' hookup while at it. `python -m unittest --help`
explains how you can run individual tests.
2020-04-24 15:50:44 +02:00
David Rheinsberg
ff8cd76def test: provide Makefile convenience targets
Add convenience targets to `Makefile` which can run common sets of
tests. For now, add a target for pylint, module-unittests,
pipeline-runtime-tests, as well as all tests.

Currently, it is quite cumbersome to run a reasonable test-setup
locally. Pylint invokation is rather complex, the unittests and runtime
tests in ./test are mixed, and not all tests in ./test can necessarily
be run from a development system.

This commit prepares for a simpler setup:

  * Add `make test-pylint` to run pylint as it is run by CI.

  * Add `make test-module` to run all module-unittests. This is meant to
    be fast (preferably close to instant) and easy to run during
    development to do a short check whether there are obvious typos or
    other errors in local changes.
    If we can keep these tests to machine-local requirements, if we
    avoid any sleeps or heavy computations, then this will remain a
    convenient test-suite to run locally without having to wait for
    30min. In other words: We should be able to keep this under 10s (and
    for the long term under 1min) easily.

  * Add `make test-runtime` to run all osbuild pipeline executions. This
    is not meant to be fast, but thorough. This will require external
    sources (preferably limited to a suitable container image with
    everything embedded). This will very likely not be run during
    development, but rather by the CI.

  * Add `make test-all` to run all tests. Very handy for shy people when
    the chance of embarrassing copy-paste mistakes is too high to push
    publicly.

Additionally to these new targets, this PR introduces 2 new directories
in ./test: ./test/mod/ and ./test/run/
These are meant as equivalent to `test-module` and `test-runtime`. The
reason is that preferably we stick to the auto-discovery of `unittest`
to enumerate tests, rather than enrolling our own or having to enumerate
them explicitly somewhere.
However, we need some way to tell `unittest` which test belongs into
which group. The easiest setup is likely to just use sub-directories.
Note that `test-all` picks all tests independently of where they are
put, even if they are in further different sub-modules under ./test.

For now, no tests are moved into the new directories. I expect this to
take a bit, since there are several out-standing PRs that modify ./test.
I intend to do the final move once we agreed on this and we synchronized
our test-modifications.
2020-04-24 15:50:44 +02:00
David Rheinsberg
c2cb6073ad ci: pylint all the things
Make sure we always pylint all python sources. We currently skip tests
as well as osbuild/util. Fix this by always recursively looking for all
python sources and then linting them.
2020-04-20 18:58:26 +02:00
Christian Kellner
c435bb359e ci: run selinux and ostree unit tests
Add the new ostree and selinux unit tests to the github action CI
2020-04-15 15:39:45 +02:00
Major Hayden
3233093045 💃 Use pre-built containers
Now that containers are being built daily in GitHub Actions from
the container[0] repository, we can use those containers. That will
speed up the GitHub Actions for osbuild and reduce errors from
unreleased Fedora versions.

[0] https://github.com/osbuild/containers

Signed-off-by: Major Hayden <major@redhat.com>
2020-03-25 08:21:48 +01:00
David Rheinsberg
dedc801688 ci: import runtime tests to github actions
Continue our effort to move to Github-actions. This imports the runtime
tests from Travis into Github-actions. The `test_boot` test is still
left on travis, since it requires stacked KVM, which is not yet
available on github-actions.
2020-03-24 16:08:24 +01:00
David Rheinsberg
52b80a2a23 ci: allow tests to be run in forks
Drop the filter on `master`. This prevents us from running the CI on
forked repositories. In particular, it prevents us from pushing
branches to github-forks and have the CI run on them. This is very nice
to have as development tool, as it allows running the real CI without
opening a PR.
2020-03-24 16:08:24 +01:00
David Rheinsberg
9064788fdf ci: add job for documentation build and test
This adds another job to the CI runner. This builds and tests the
documentation. The tests are currently reduced to just verifying the
respective man-pages are actually generated. This can be extended on in
the future.
2020-03-09 13:20:42 +01:00
Major Hayden
94912a8759 📦 Use new 'make rpm' in GitHub Actions
Signed-off-by: Major Hayden <major@redhat.com>
2020-03-05 22:32:01 +01:00
Christian Kellner
a2cbed0ceb tests: copy on write checks for objectstore.Object
Verify the copy on write semantics of `objectstore.Object`, i.e.
content will only be copied at the moment a client wants to write
to `Object`. This also checks that `Object.base` works.

Modify the CI to execute the unit tests in a privileged container
because `Object.read()` works internally by bind mounting a path.
The mount operation needs at least CAP_SYS_ADMIN and overwriting
the file permissions CAP_DAC_OVERRIDE.
2020-02-28 16:11:49 +01:00
Lars Karlitski
294431ace1 test: add test for host detection
Includes a test for each of the runners we currently have, except for
fedora27, which is (hopefully) not used as a host OS anymore.
2020-02-28 16:06:30 +01:00
Major Hayden
7d53835bba 🤦‍♂️ Restore the Fedora modularity workaround
Signed-off-by: Major Hayden <major@redhat.com>
2020-02-27 20:19:51 +01:00
Major Hayden
4b2089bbf6 🌮 Merge GitHub Actions workflows
A single workflow allows us to re-use artifacts throughout all jobs.

Also, we can fail the tests early if there's a linting issue before
we spend time waiting for RPMs to build.

Signed-off-by: Major Hayden <major@redhat.com>
2020-02-27 19:59:03 +01:00
Major Hayden
4ad4587683 📦 Disable Fedora modular repos
Avoid delays and problems with the modularity repositories
by disabling them before building RPMs.

Signed-off-by: Major Hayden <major@redhat.com>
2020-02-27 19:51:48 +01:00
Major Hayden
cd4c6944c6 🧨 Run all RPM builds even if one fails
By default, GitHub Actions stops running all RPM builds if one fails.
This means that a temporary repository issue (like what is happening
with F32 today) stops all RPM builds.

Set the `fail-fast` option to `false` to disable this behavior.

Signed-off-by: Major Hayden <major@redhat.com>
2020-02-27 19:25:29 +01:00
Major Hayden
4c92b7a28b Run unit tests in GitHub Actions
Rename `lint.yml` to `tests.yml` to allow us to put more jobs under the
same test name.

Signed-off-by: Major Hayden <major@redhat.com>
2020-02-25 20:16:49 +01:00
Tom Gundersen
9d0f6bd85e github: build RPMs without git checkout
Make RPM building more similar to how RPMs will be built in koji.

This downloads the specfile from github at the given commit, appends
the commit sha to the specfile and uses spectools to download the
correct sources from github.

This should be equivalent to what is done in the makefile, the only
behavioral difference is that the rpms are now versioned based on
the git sha they are built from.

The main purpose of this change is to avoid any differences between
the CI and the real RPMs due to bugs in the Makefile. Correctly
versioned RPMs will also be handy for testing/debugging/deployment.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-02-25 16:13:31 +01:00
Major Hayden
f2c9276765 Run pylint via GitHub Actions
Get pylint results much easier by using GitHub Actions.

Signed-off-by: Major Hayden <major@redhat.com>
2020-02-24 23:10:16 +01:00
Major Hayden
cdc84a9ce2 Build RPMs via GitHub Actions
Signed-off-by: Major Hayden <major@redhat.com>
2020-02-24 20:02:30 +01:00