Skip to content

Update build

Update build #119

Workflow file for this run

---
name: build
on:
push:
branches: [master]
tags: ['*']
pull_request:
branches: [master]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- name: almalinux-9
shortcut: el9
container-name: almalinux9
- name: almalinux-10
shortcut: el10
container-name: almalinux10
- name: centos-stream-9
shortcut: el9s
container-name: el9stream
- name: centos-stream-10
shortcut: el10s
container-name: el10stream
name: Build on ${{ matrix.name }}
container:
image: quay.io/ovirt/buildcontainer:${{ matrix.container-name }}
steps:
- name: Checkout sources
uses: actions/checkout@v7
- name: Mark repository as safe
run: git config --global --add safe.directory "$(pwd)"
- name: Install dependencies
run: |
dnf install -y \
apache-commons-lang3 \
autoconf \
automake \
gcc \
git \
jackson-annotations \
jackson-core \
jackson-databind \
java-21-openjdk-devel \
javapackages-tools \
junit \
make \
maven \
maven-local-openjdk21 \
maven-source-plugin \
mockito \
rpm-build \
slf4j \
slf4j-jdk14
- name: Set build environment
run: |
TAG=$(git tag --points-at HEAD | head -1)
if [[ -n "$TAG" ]]; then
if [[ "$TAG" =~ -([0-9]+)$ ]]; then
echo "PACKAGE_RPM_RELEASE=${BASH_REMATCH[1]}" >> $GITHUB_ENV
else
echo "PACKAGE_RPM_RELEASE=1" >> $GITHUB_ENV
fi
else
echo "RELEASE_SUFFIX=.$(date --utc +%Y%m%d%H%M%S).git$(git rev-parse --short HEAD)" >> $GITHUB_ENV
fi
- name: Autogen
run: ./autogen.sh
- name: Configure
run: ./configure
- name: Run tests
run: mvn test -P\!slow-tests-disabled
- name: Build RPM
run: make -j rpm
- name: Collect artifacts
run: |
mkdir -p exported-artifacts
find tmp.repos -iname \*rpm -exec mv "{}" exported-artifacts/ \;
mv ./*tar.gz exported-artifacts/
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: rpm-${{ matrix.shortcut }}
path: exported-artifacts
publish-rpms:
permissions:
artifact-metadata: read
needs: build
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
uses: ovirt/ovirt-workflows/.github/workflows/publish-rpms.yml@main
secrets: inherit
publish-snapshot:
needs: build
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
name: Publish snapshot to maven central
container:
image: quay.io/ovirt/buildcontainer:el10stream
steps:
- name: Checkout sources
uses: actions/checkout@v7
- name: Mark git repo as safe
run: git config --global --add safe.directory $(pwd)
- name: Use cache for maven
uses: actions/cache@v6
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Maven settings.xml
uses: s4u/maven-settings-action@v3.1.0
with:
path: /root/.m2/settings.xml
servers: |
[{
"id": "central",
"username": "${{ secrets.SONATYPE_USERNAME }}",
"password": "${{ secrets.SONATYPE_TOKEN }}"
}]
- name: Publish snapshot
run: |
./autogen.sh
./configure --with-maven-version-snapshot
mvn --batch-mode -DskipTests deploy