-
Notifications
You must be signed in to change notification settings - Fork 2
199 lines (176 loc) · 6.58 KB
/
build-opencast-testing.yml
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: Build Opencast Testing RPMs
env:
arch: noarch
repo: testing
on:
workflow_dispatch:
schedule:
- cron: '30 2 * * *'
push:
branches:
- develop
- 'r/*'
paths:
- .trigger
- oc.version
- branch.version
- .github/workflows/build-opencast-testing.yml
- rpmbuild/SOURCES/*
- rpmbuild/SPECS/opencast.spec
jobs:
build:
strategy:
matrix:
osversion:
- 8
- 9
outputs:
oc-version: ${{ steps.version.outputs.version }}
arch: ${{ env.arch }}
repo: ${{ env.repo }}
new: ${{ steps.version-check.outputs.new }}
name: build (el${{ matrix.osversion }})
runs-on: ubuntu-latest
container:
image: docker.io/lkiesow/opencast-rpmbuild:el${{ matrix.osversion }}-oc17
steps:
- uses: actions/checkout@v4
- id: version
run: echo "version=$(cat oc.version)" >> $GITHUB_OUTPUT
- name: clone opencast
run: |
git clone --branch "$(cat branch.version)" --depth 1 https://github.com/opencast/opencast.git
- name: check if new version exists
id: version-check
working-directory: opencast
env:
S3_HOST: ${{ secrets.S3_HOST }}
run: |
curl -sO https://${S3_HOST}/opencast-pkg/rpms/${{ env.repo }}/el/${{ matrix.osversion }}/oc-${{ steps.version.outputs.version }}/${{ env.arch }}/latest.commit
git rev-parse HEAD > current.commit
if diff -q latest.commit current.commit; then
echo "Commit $(cat current.commit) already built"
echo "new=no" >> "$GITHUB_OUTPUT"
else
echo "Last built $(cat latest.commit). Building new commit $(cat current.commit)"
echo "new=yes" >> "$GITHUB_OUTPUT"
fi
- name: cache local maven repository
if: steps.version-check.outputs.new == 'yes'
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: clone mvn.opencast.org
if: steps.version-check.outputs.new == 'yes'
run: |
git clone --depth 1 https://github.com/opencast/mvn.opencast.org.git
- name: prepare additional maven repository
if: steps.version-check.outputs.new == 'yes'
working-directory: opencast
run: |
sed -i "s#https://mvn.opencast.org/#file://$(readlink -f ../mvn.opencast.org)#" pom.xml
- name: build opencast
if: steps.version-check.outputs.new == 'yes'
working-directory: opencast
run: >
mvn
--batch-mode
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
-Dcheckstyle.skip=true
-DskipTests
clean install
- name: list distributions to build
if: steps.version-check.outputs.new == 'yes'
run: |
find opencast/build/ -type f -name 'opencast-dist-*gz' \
| sed 's/^.*opencast-dist-\([^-]*\)-.*$/\1/' \
| tee rpmbuild/SPECS/dists
- name: mimic rpmdev-setuptree
if: steps.version-check.outputs.new == 'yes'
working-directory: rpmbuild
run: |
ln -s "$(pwd)" ~/rpmbuild
- name: move build artifacts
if: steps.version-check.outputs.new == 'yes'
run: |
mv -v opencast/build/opencast-dist-*.tar.gz rpmbuild/SOURCES/
- name: define rpm version
if: steps.version-check.outputs.new == 'yes'
run: |
echo "%octarversion ${{ steps.version.outputs.version }}-SNAPSHOT" >> ~/.rpmmacros
echo "%ocversion ${{ steps.version.outputs.version }}" >> ~/.rpmmacros
echo "%ocrelease 0.$(date +%Y%m%d%H%M%S)" >> ~/.rpmmacros
- name: build rpm
if: steps.version-check.outputs.new == 'yes'
working-directory: rpmbuild/SPECS
run: |
for dist in $(cat dists); do
rpmbuild -ba -D "ocdist ${dist}" opencast.spec
done
- name: list rpms
if: steps.version-check.outputs.new == 'yes'
working-directory: rpmbuild/RPMS/${{ env.arch }}
run: |
du -hs ./*.rpm
- name: prepare gpg
if: steps.version-check.outputs.new == 'yes'
env:
GPG_KEY: ${{ secrets.GPG_KEY_OC17 }}
run: |
echo "${GPG_KEY}" | gpg --import
echo '%_gpg_name [email protected]' >> ~/.rpmmacros
- name: sign rpms
if: steps.version-check.outputs.new == 'yes'
working-directory: rpmbuild/RPMS/${{ env.arch }}
run: |
rpmsign --addsign *.rpm
- uses: lkiesow/configure-s3cmd@v1
if: steps.version-check.outputs.new == 'yes'
with:
host: ${{ secrets.S3_HOST }}
access_key: ${{ secrets.S3_ACCESS_KEY }}
secret_key: ${{ secrets.S3_SECRET_KEY }}
- name: publish repository rpm
if: steps.version-check.outputs.new == 'yes'
working-directory: rpmbuild/RPMS/${{ env.arch }}
run: |
s3cmd put -P *.rpm "s3://opencast-pkg/rpms/${{ env.repo }}/el/${{ matrix.osversion }}/oc-${{ steps.version.outputs.version }}/${{ env.arch }}/"
# keep latest 14 * 6 = 84 builds
- name: remove old builds
if: steps.version-check.outputs.new == 'yes'
run: |
s3cmd ls "s3://opencast-pkg/rpms/${{ env.repo }}/el/${{ matrix.osversion }}/oc-${{ steps.version.outputs.version }}/${{ env.arch }}/opencast-" |\
sort |\
head -n -84 |\
sed 's_^.*s3://_s3://_' |\
while read i
do
s3cmd del "$i";
done
- name: keep track of latest build
if: steps.version-check.outputs.new == 'yes'
working-directory: opencast
run: |
s3cmd put -P current.commit "s3://opencast-pkg/rpms/${{ env.repo }}/el/${{ matrix.osversion }}/oc-${{ steps.version.outputs.version }}/${{ env.arch }}/latest.commit"
createrepo:
uses: opencast/opencast-rpmbuild/.github/workflows/createrepo.yml@develop
if: ${{ needs.build.outputs.new == 'yes' }}
needs: build
strategy:
matrix:
os-version:
- 8
- 9
with:
oc-version: ${{ needs.build.outputs.oc-version }}
os-version: ${{ matrix.os-version }}
arch: ${{ needs.build.outputs.arch }}
repo: ${{ needs.build.outputs.repo }}
secrets:
S3_HOST: ${{ secrets.S3_HOST }}
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}