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.
120 lines
2.9 KiB
YAML
120 lines
2.9 KiB
YAML
name: Tests
|
|
|
|
on: [pull_request, push]
|
|
|
|
jobs:
|
|
pylint:
|
|
name: "pylint"
|
|
runs-on: ubuntu-latest
|
|
container: docker.io/library/python:3.7
|
|
steps:
|
|
- name: Install pylint
|
|
run: pip install pylint==2.4.1 jsonschema
|
|
- name: Clone repository
|
|
uses: actions/checkout@v2
|
|
- name: Run pylint
|
|
run: make test-pylint
|
|
|
|
module:
|
|
name: "Module Unittests"
|
|
runs-on: ubuntu-latest
|
|
container: docker.io/library/python:3.7
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v2
|
|
- name: Run Module Unittests
|
|
run: make test-module
|
|
|
|
documentation:
|
|
name: "📚 Documentation"
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: docker.io/library/python:3.7
|
|
steps:
|
|
- name: Install Dependencies
|
|
run: |
|
|
pip install docutils
|
|
|
|
- name: Clone repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
path: osbuild
|
|
|
|
- name: Generate Documentation
|
|
run: |
|
|
make \
|
|
-f osbuild/Makefile \
|
|
SRCDIR=osbuild \
|
|
BUILDDIR=build \
|
|
RST2MAN=rst2man.py \
|
|
man
|
|
|
|
- name: Verify Documentation
|
|
working-directory: build
|
|
run: |
|
|
test -d docs
|
|
test -f docs/osbuild.1
|
|
|
|
unit_tests:
|
|
name: "unit"
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: docker.io/library/python:3.7
|
|
options: --privileged # Needed for bind mounts in unit tests
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
path: osbuild
|
|
|
|
- name: Install Dependencies
|
|
run: pip install jsonschema
|
|
|
|
- name: Run test_osbuild
|
|
run: |
|
|
cd osbuild
|
|
python3 -m unittest -v test.test_osbuild
|
|
|
|
- name: Run test_objectstore
|
|
run: |
|
|
cd osbuild
|
|
python3 -m unittest -v test.test_objectstore
|
|
|
|
rpm_build:
|
|
name: "📦 RPM"
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
fedora_release: ["31", "32", "33"]
|
|
container:
|
|
image: "quay.io/osbuild/osbuild-fedora${{ matrix.fedora_release }}:latest"
|
|
steps:
|
|
- name: "📥 Prepare container"
|
|
run: |
|
|
echo "fastestmirror=1" >> /etc/dnf/dnf.conf
|
|
echo "install_weak_deps=0" >> /etc/dnf/dnf.conf
|
|
rm -fv /etc/yum.repos.d/fedora*modular*
|
|
|
|
- name: "🗄️ Clone the repository"
|
|
uses: actions/checkout@v2
|
|
|
|
- name: "🛒 Install RPM build dependencies"
|
|
run: dnf -y builddep osbuild.spec
|
|
|
|
- name: "🛠️ Build RPMs"
|
|
run: |
|
|
mkdir rpms
|
|
make srpm
|
|
cp -av rpmbuild/SRPMS/*.rpm rpms/
|
|
make rpm
|
|
cp -av rpmbuild/RPMS/*/*.rpm rpms/
|
|
|
|
- name: "📤 Upload artifacts"
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: rpms
|
|
path: rpms/
|
|
|
|
- name: "🔎 Test RPM installation"
|
|
run: dnf -y install $(ls rpms/*.noarch.rpm)
|