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>
143 lines
3.5 KiB
YAML
143 lines
3.5 KiB
YAML
name: Tests
|
|
|
|
on: [pull_request, push]
|
|
|
|
jobs:
|
|
source_tests:
|
|
name: "Source Tests"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: "Clone Repository"
|
|
uses: actions/checkout@v2
|
|
- name: "Run Source Tests"
|
|
uses: osbuild/containers/ghci/actions/ghci-osbuild@ghci/v1
|
|
with:
|
|
run: make test-src
|
|
|
|
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
|
|
|
|
sample_validation:
|
|
name: "sample validation"
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: docker.io/library/python:3.7
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
path: osbuild
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
pip install jsonschema
|
|
|
|
- name: Validate the samples
|
|
run: |
|
|
cd osbuild
|
|
for f in samples/*; do
|
|
python3 -m osbuild --libdir . --inspect "$f" > /dev/null
|
|
done
|
|
|
|
rpm_build:
|
|
name: "📦 RPM"
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
fedora_release: ["31", "32", "33"]
|
|
container:
|
|
image: "docker.io/library/fedora:${{ matrix.fedora_release }}"
|
|
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*
|
|
dnf -y upgrade
|
|
dnf -y install dnf-plugins-core findutils git make rpm-build rpmdevtools
|
|
|
|
- name: "🗄️ Clone the repository"
|
|
uses: actions/checkout@v2
|
|
|
|
- name: "🛒 Install RPM build dependencies"
|
|
run: dnf -qy 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)
|