This git repository contains the configuration used to build the docker image used for GitHub Actions. The resulting docker image is available at https://registry.opensuse.org/.
- The image is rebuilt whenever a commit it pushed to the
master
branch. - The submit.yml GitHub Action commits the configuration to the YaST:Head/ci-cpp-container OBS project
- The OBS tracks the dependencies and rebuilds the image if any dependant package is updated.
If for some reason the automatic rebuild do not work or it failed you can trigger the rebuild in the OBS just like for the other regular packages.
This image is based on the latest openSUSE Tumbleweed image, additionally it contains the packages needed for running the tests for YaST packages written in C++. It is possible to install additional packagers if needed, see the Examples section below.
The image contains the yast-ci-cpp
script which runs all the checks and tests.
The workflow is:
- Copy the sources into the
/usr/src/app
directory. - If the code needs additional packages install them using the
zypper install
command from the localDockerfile
. If the package can be used by more modules you can add it into the base Docker image here. - Run the
yast-ci-cpp
script. (Optionally you can use the-x
and-o
options to split the work into several smaller tasks and run them in parallel.)
Save as .github/workflows/ci.yml
file in your Git repository:
# See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: CI
on: [push, pull_request]
jobs:
Package:
runs-on: ubuntu-latest
container: registry.opensuse.org/yast/head/containers/yast-cpp:latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
- name: Prepare System
run: |
zypper --non-interactive in --no-recommends \
needed-package1 \
needed-package2
- name: Package Build
run: yast-ci-cpp
From the Git sources:
# you need the rubygem-yast-rake package installed
rake osc:build
From the OBS checkout:
# check it out if not already present
osc co YaST:Head/ci-cpp-container
cd YaST:Head/ci-cpp-container
# build it
osc build containers
️:warning: This approach is not 100% the same as building the image with osc
described above.
The osc
build injects some special modifications to allow building the image inside
the OBS build environment.
ℹ️️ You should prefer using the osc
method if possible, use the docker
build only as a fallback when the osc
build is not possible or does not work in your environment.
docker build -t ci-cpp-container-test -f package/Dockerfile package/