-
Notifications
You must be signed in to change notification settings - Fork 80
164 lines (163 loc) · 5.79 KB
/
pit.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
name: PiT
run-name: PiT ${{ inputs.version }} (lin=${{inputs.linux}} win=${{inputs.windows}} skip=${{inputs.skipcurrent}}) ${{inputs.starters}}
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: false
type: string
starters:
description: 'Starters to run, separated by comma'
required: false
type: string
skipcurrent:
description: 'Skip running tests in current version'
required: false
type: boolean
default: false
skipdev:
description: 'Skip running tests in dev mode'
required: false
type: boolean
default: false
debug:
description: 'Be verbose when running PiT steps'
required: false
type: boolean
default: false
linux:
description: 'Run build in linux runner'
required: false
type: boolean
default: true
windows:
description: 'Run build in windows runner'
required: false
type: boolean
default: false
generated:
description: 'Generate and run all supported start presets and archetypes'
required: false
type: boolean
default: false
demos:
description: 'Checkout and run all demos'
required: false
type: boolean
default: false
join:
description: 'Number of apps to run per container (default 1)'
required: false
type: choice
options: ["1", "2", "3", "4"]
default: "1"
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set.outputs.matrix }}
steps:
- id: set
shell: bash
run: |
# COMPUTE MATRIX
echo "Computing matrix ..."
[ -z "${{secrets.GHTK}}" -o -z "${{secrets.TB_LICENSE}}" -o -z "${{secrets.SS_LICENSE}}" -o -z "${{secrets.CE_LICENSE}}" ] && exit 1
V="${{inputs.version}}"
[ -n "$V" ] && echo "$V" | grep -Eqv '^[0-9]+(\.[0-9]+)*(-SNAPSHOT|\.alpha[0-9]+|\.beta[0-9]+|\.rc[0-9]+)?$' && echo "Invalid version" && exit 1
git clone -q https://${{secrets.GHTK}}@github.com/vaadin/platform-in-test-script.git pit
W="${{inputs.windows}}"
L="${{inputs.linux}}"
[ true != "$W" -a true != "$L" ] && W=true
[ true != "$L" -a true != "$W" ] && L=true
A="$A --starters=${{inputs.starters}}"
[ true = "${{inputs.generated}}" ] && A="$A --generated"
[ true = "${{inputs.demos}}" ] && A="$A --demos"
cmd="./pit/scripts/pit/run.sh $A --list=${{inputs.join}}"
echo "Generating list of starters: $cmd"
S=`eval $cmd`
M='{"include":['
for i in `echo $S`; do
J='{"app":"'$i'"'
[ -n "$V" ] && J=$J',"version":"'$V'"'
[ true = "$W" ] && M=$M$J',"os":"windows-latest"},'
[ true = "$L" ] && M=$M$J',"os":"ubuntu-22.04"},'
done
M=`echo $M | sed -e s/,$//`']}'
echo "Generated Matrix: $M"
echo "matrix=$M" >> $GITHUB_OUTPUT
run:
needs: prepare
strategy:
fail-fast: false
matrix: ${{fromJson(needs.prepare.outputs.matrix)}}
runs-on: ${{matrix.os}}
steps:
- run: |
# TEST PARAMETERS
[ -z "${{matrix.app}}" ] && exit 1
echo "RUNNING TEST FOR ${{matrix.app}} APP"
shell: bash
- run: |
# INSTALL PIT
git clone https://${{secrets.GHTK}}@github.com/vaadin/platform-in-test-script.git pit
cd pit && git rev-parse --short HEAD
shell: bash
- run: |
# INSTALL LICENSE
mkdir -p ~/.vaadin/
echo '{"username":"'`echo ${{secrets.TB_LICENSE}} | cut -d / -f1`'","proKey":"'`echo ${{secrets.TB_LICENSE}} | cut -d / -f2`'"}' > ~/.vaadin/proKey
echo "${{secrets.SS_LICENSE}}" > ~/vaadin.spreadsheet.developer.license
shell: bash
- if: ${{ env.ACT }}
run: |
# LINUX LIBS (ACT)
# see https://github.com/browser-actions/setup-chrome/issues/240
sudo ./pit/scripts/pit/docker/setup.sh --lib-chrome
- uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- uses: actions/setup-node@v4
with:
node-version: '18'
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- uses: stCarolas/setup-maven@v5
with:
maven-version: '3.9.0'
- run: |
# PIT TESTS ${{matrix.app}} ${{inputs.version}}
echo "${{toJSON(inputs)}}"
[ -n "${{inputs.version}}" ] && ARG="--version=${{inputs.version}}"
[ true = "${{inputs.skipcurrent}}" ] && ARG="$ARG --skip-current"
[ true = "${{inputs.skipdev}}" ] && ARG="$ARG --skip-dev"
[ true = "${{inputs.debug}}" ] && ARG="$ARG --debug"
./pit/scripts/pit/run.sh --path
CMD="./pit/scripts/pit/run.sh $ARG --starters=${{matrix.app}}"
# Output the PiT command to execute, so as we can run the same locally
echo "$CMD"
# Run PiT in test mode, so as we can copy and paste commands when reporting
$CMD --test
# Run PiT
$CMD
env:
GHTK: ${{secrets.GHTK}}
CE_LICENSE: ${{secrets.CE_LICENSE}}
OPENAI_TOKEN: ${{secrets.OPENAI_TOKEN}}
MAVEN_ARGS: ${{env.MAVEN_ARGS}}
shell: bash
- if: ${{ env.ACT }}
run: |
# WAIT (ACT)
echo "Keeping docker container running, push Ctrl-C to terminate ..."
read key
- if: ${{failure()}}
uses: actions/upload-artifact@v4
with:
name: failed-outputs-${{matrix.app}}
path: tmp/**/*.out
if-no-files-found: ignore
retention-days: 7