forked from opencast/opencast
-
Notifications
You must be signed in to change notification settings - Fork 0
194 lines (175 loc) · 6.63 KB
/
test-opencast-site.yml
File metadata and controls
194 lines (175 loc) · 6.63 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
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
name: Deploy » Site and Coverage
on:
pull_request:
paths:
- 'pom.xml'
- 'modules/**'
- 'docs/checkstyle/**'
- 'docs/log4j/**'
- 'assemblies/**'
- '.github/**'
- 'mvnw'
- '.mvn'
push:
paths:
- 'pom.xml'
- 'modules/**'
- 'docs/checkstyle/**'
- 'docs/log4j/**'
- 'assemblies/**'
- '.github/**'
- 'mvnw'
- '.mvn'
branches-ignore:
- 'dependabot/**' # Don't run dependabot branches, as they are already covered by pull requests
jobs:
build-mvn-site:
strategy:
matrix:
java:
- 21
name: build (java ${{ matrix.java }})
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
with:
submodules: 'recursive'
- name: cache local maven repository
uses: actions/cache@v5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: setup java
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: install dependencies
run: |
sudo apt update -q
sudo apt install -y -q \
bzip2 \
ffmpeg \
gzip \
hunspell \
hunspell-de-de \
procps \
s3cmd \
sox \
tar \
tesseract-ocr \
tesseract-ocr-deu \
unzip
# This needs to pass otherwise we can end up with modules which are *not* included in the code coverage reports!
- name: verify jacoco module depends on all opencast modules
run: |
.github/check-jacoco-deps.sh
- name: build opencast, skipping tests which run during site
run: |
./mvnw install -DskipTests -T1C -Pnone \
--batch-mode \
-Dcheckstyle.skip=true \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
#This has to happen in a separate step or else various service classes aren't visible
- name: build maven site
run: |
./mvnw site -T1C -Pnone \
--batch-mode \
-Dsurefire.rerunFailingTestsCount=2 \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120 && \
./mvnw site:stage -Pnone
- name: Save site build
uses: actions/upload-artifact@v7
if: >
github.event_name == 'push'
&& github.repository_owner == 'opencast'
&& (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/r/'))
with:
name: site_build
path: target/staging
- name: Save assets build
uses: actions/upload-artifact@v7
if: >
github.event_name == 'push'
&& github.repository_owner == 'opencast'
&& github.ref == 'refs/heads/develop'
with:
name: assets
path: .github/assets
# Normally here we would do the uploading, but I'm deliberately breaking the upload from the build so that we can
# as committers check more easily if it's the *build* that's broken, or if it's just the upload. The upload
# being broken can happen if there's an issue with github, for example, and it would be unfortunate if that broke
# our builds when *our* code is working.
deploy-mvn-site:
name: generate github pages for reports
runs-on: ubuntu-22.04
needs: build-mvn-site
concurrency:
group: opencast-site-build
cancel-in-progress: false
if: >
github.event_name == 'push'
&& github.repository_owner == 'opencast'
&& (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/r/'))
steps:
- name: Download site generation artifact
uses: actions/download-artifact@v8
with:
name: site_build
path: site_build
- name: Prepare git
run: |
git config --global user.name "Release Bot"
git config --global user.email "cloud@opencast.org"
- name: prepare github ssh key
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY_COVERAGE }}
run: |
install -dm 700 ~/.ssh/
echo "${DEPLOY_KEY}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: clone repository
run: |
git clone -b gh-pages "git@github.com:${{ github.repository_owner }}/coverage-reports.git" coverage-reports
- name: store site and build index
working-directory: coverage-reports
run: |
export TEMP=${{ github.ref_name }}
export BRANCH="${TEMP#r\/}"
rm -rf $BRANCH
mv ../site_build $BRANCH
#Generate an index, in case anyone lands at the root of the test domain
echo $'<html><head><link rel=stylesheet type=text/css href=assets/index.css /></head><body><div class="head-container"><img src=assets/opencast-white.svg /></div><div class="navbar-container"></div><div class="text-container"><p>Deployment of Opencast\'s Maven Site and Code Coverage. The branches listed here correspond to Opencast\'s own branches.</br><b>Please select a version.</b></p></div><ul>' > index.html
find . -mindepth 1 -maxdepth 1 -type d \
| grep '[0-9]*.x\|develop' \
| sort -r \
| sed 's/^\(.*\)$/<li><a href=\1>\1<\/a><\/li>/' >> index.html
echo '</ul></body></html>' >> index.html
git add $BRANCH index.html
git diff --staged --quiet || git commit --amend -m "Maven site build outputs"
- name: update CSS and other assets
if: github.ref == 'refs/heads/develop'
uses: actions/download-artifact@v8
with:
name: assets
path: assets_artifact
- name: commit CSS and other asset changes
if: github.ref == 'refs/heads/develop'
working-directory: coverage-reports
run: |
rm -rf assets
cp -rv ../assets_artifact/ ./assets
git add assets
git diff --staged --quiet || git commit --amend -m "Maven site build outputs"
- name: Push updates
working-directory: coverage-reports
run: git push origin gh-pages --force