Repository navigation
166 lines (158 loc) · 6.92 KB
/
Copy pathpr_build_code.yml
File metadata and controls
166 lines (158 loc) · 6.92 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
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
---
name: Hop PR Build (Code)
# Path filters mirror gib.excludePathsMatching in the root pom: a change confined to
# these paths cannot affect the Maven build, so the workflow does not run at all.
# Keep both lists in sync when adding an exclusion. (Negation needs `paths`, not
# `paths-ignore`; later patterns win.)
on:
push:
paths:
- '**'
- '!docs/**'
- '!docker/**'
- '!helm/**'
- '!dist/**'
- '!integration-tests/**'
- '!*.md'
- '!Jenkinsfile*'
- '!.asf.yaml'
pull_request:
branches: [ 'main' ]
paths:
- '**'
- '!docs/**'
- '!docker/**'
- '!helm/**'
- '!dist/**'
- '!integration-tests/**'
- '!*.md'
- '!Jenkinsfile*'
- '!.asf.yaml'
# Supersede an in-flight PR build when the branch is pushed again; never cancel a
# push build, so every merge to main keeps its own result.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
# Full build only for pushes to main; incremental for pull requests and for
# pushes to any other branch.
GIB_DISABLE: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && 'true' || 'false' }}
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
# fetch-depth: 0 gives gitflow-incremental-builder the history it needs to
# find the merge base with origin/main. Harmless on the (full) main build.
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v6
with:
java-version: '21'
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v6
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-m2-
${{ runner.os }}-
# Source checks resolve no dependencies, so they skip GIB's upstream modules. Without
# this, buildUpstreamMode=impacted would pull in every plugin as an upstream of the
# assemblies (these steps do not pass -Dassemblies=false).
- name: RAT Check
run: mvn clean apache-rat:check -Dgib.disable=$GIB_DISABLE -Dgib.buildUpstream=false
- name: Checkstyle
run: mvn clean checkstyle:check -Dgib.disable=$GIB_DISABLE -Dgib.buildUpstream=false
- name: Spotless check
run: mvn spotless:check -Dgib.disable=$GIB_DISABLE -Dgib.buildUpstream=false
- name: Build with Maven
run: MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"; mvn clean install -T 1C -B -C -e -fae -V -Dmaven.compiler.fork=true -Dsurefire.rerunFailingTestsCount=2 -Dassemblies=false -Dmodule.zips=false -Djacoco.skip=true -Dgib.disable=$GIB_DISABLE --file pom.xml
# The build regenerates the configuration perspective's option tables from the
# @ConfigPlugin and @GuiWidgetElement annotations. If that leaves the working tree
# dirty, the committed page no longer matches the code it documents.
- name: Configuration documentation is up to date
run: |
CONFIG_DOCS=docs/hop-user-manual/modules/ROOT/partials/config
# --porcelain, not diff: a newly added configuration plugin writes a new .adoc, and an
# untracked file is invisible to git diff.
if [ -n "$(git status --porcelain -- $CONFIG_DOCS)" ]; then
echo "The configuration perspective's generated option tables are out of date."
echo "A configuration option was added, removed or changed without regenerating"
echo "the page that documents it."
echo
echo "To fix, from a full build of your branch:"
echo " mvn clean install -DskipTests"
echo "and commit the result under $CONFIG_DOCS."
echo
git status --short -- $CONFIG_DOCS
git diff -- $CONFIG_DOCS
exit 1
fi
echo "Generated configuration documentation matches the code."
# Add a UI and run the UI tests only
ui-tests:
runs-on: ubuntu-latest
# A hung SWT event loop used to sit here until GitHub's 6 hour default cut it off, with no
# log to show for it. The harness watchdog and the surefire fork timeout should fire long
# before this does; if this one trips, the hang is outside the test JVM.
timeout-minutes: 45
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v6
with:
java-version: '21'
distribution: 'temurin'
# Restore only: this job runs `package` and installs nothing, and it finishes before
# the build job. Saving here took the shared key first, so the build job's installed
# repository was never cached ("Unable to reserve cache"). Keep path and keys in sync
# with the build job, or the restore misses.
- name: Restore Maven packages
uses: actions/cache/restore@v6
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-m2-
${{ runner.os }}-
# SWT uses the GTK3 native bindings on Linux; Xvfb provides the virtual display.
- name: Install Xvfb and SWT GTK libraries
run: sudo apt-get update && sudo apt-get install -y xvfb libgtk-3-0
# On a PR this only runs the UI tests when the change touches a module the UI
# tests depend on; otherwise the incremental reactor prunes them away.
- name: Run SWTBot UI tests under Xvfb
run: >
xvfb-run -a --server-args="-screen 0 1280x1024x24"
mvn -B -V -Puitest -Dassemblies=false -Dmodule.zips=false -Djacoco.skip=true -Dgib.disable=$GIB_DISABLE package
- name: Upload SWTBot failure screenshots
if: failure()
uses: actions/upload-artifact@v7
with:
name: swtbot-screenshots
path: '**/screenshots/**'
if-no-files-found: ignore