Repository navigation
152 lines (131 loc) · 3.95 KB
/
Copy pathbuild.yml
File metadata and controls
152 lines (131 loc) · 3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
---
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