-
Notifications
You must be signed in to change notification settings - Fork 6
225 lines (196 loc) · 6.06 KB
/
build-and-test.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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: Build and Test
on:
#push:
# branches: [ t8 ]
pull_request:
branches: [ t8, master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
pull-requests: write
steps:
# --------------------------
- name: Cache OpenAF runtime
uses: actions/cache@v1.2.1
with:
key : oaf-t8
path: /tmp/oaf
# --------------
- name: Checkout
uses: actions/checkout@v3.5.2
# -----------------------
- name: Compile ojob yaml
uses: openaf/ojob-action@v4
with:
ojob: ojob.io/ojob/compile
args: "source=ojob.yaml target=ojob.json"
dist: t8
# -------------
- name: Checkin
uses: openaf/ojob-action@v4
env :
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
ojob: ojob.io/git/hub/checkIn
args: 'message="Update\ ojob.json"'
dist: t8
# --------------------
- name: Setup Java JDK
uses: actions/setup-java@v1.4.4
with:
java-version: 1.8
java-package: jdk
architecture: x64
# -----------
- name: Build
uses: openaf/ojob-action@v4
with:
ojob: build.yaml
# -----------------------
- name: Update openaf.jar
uses: actions/upload-artifact@v3
with:
name: openaf.jar
path: openaf.jar
# ----------------------------
- name: Upload openaf.jar.orig
uses: actions/upload-artifact@v3
with:
name: openaf.jar.orig
path: openaf.jar.orig
test:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
pull-requests: write
steps:
# --------------------------
- name: Cache OpenAF runtime
uses: actions/cache@v1.2.1
with:
key : oaf-t8
path: /tmp/oaf
# --------------
- name: Checkout
uses: actions/checkout@v3.5.2
# ----------------------------------
- name: Download artifact openaf.jar
uses: actions/download-artifact@v3
with:
name: openaf.jar
path: .
# ---------------------------------------
- name: Download artifact openaf.jar.orig
uses: actions/download-artifact@v3
with:
name: openaf.jar.orig
path: .
# -------------------
- name: Execute tests
run : |
cd tests
java -jar ../openaf.jar --ojob -e "autoTestAll.yaml"
# ------------------------------------
- name: Convert autoTestAll.md to html
uses: openaf/ojob-action@v4
with:
dist: t8
ojob: ojob.io/formats/md2html
args: md=tests/autoTestAll.md html=tests/autoTestAll.html compact=true
# ----------------------------
- name: Upload autoTestAll.md
uses: actions/upload-artifact@v3.1.2
with:
name: autoTestAll.html
path: tests/autoTestAll.html
# ---------------------
- name: Generate badges
uses: openaf/ojob-action@v4
with:
dist: t8
def : |
todo:
- (if ): |
"{{$env 'GITHUB_EVENT_NAME'}}" != "pull_request"
((then)):
- Create badge results
- Create badge asserts
((else)):
- (log): Ignoring badge generation on pull request
ojob:
opacks :
- openaf: 20230520
- Badgen
catch : printErrnl("[" + job.name + "] "); if (isDef(exception.javaException)) exception.javaException.printStackTrace(); else printErr(exception)
logToConsole: true # to change when finished
templateArgs: true
include:
- badgen.yaml
jobs:
# --------------------------
- name: Create badge asserts
to :
- (template): "{{asserts}}"
((outPath): status
((key ): args
((out ): args
- (log ): "Generating badge file '{{file}}'..."
- name : Badgen generate file
args :
labelColor: grey3
icon : "openaf_grey.svg"
file : "tests/asserts.svg"
exec : |
var data = io.readFileJSON("tests/autoTestAll.results.json")
args.asserts = data.asserts
args.label = "OpenAF tests asserts"
args.color = "blue"
# --------------------------
- name: Create badge results
to :
- (template): "(FAIL: {{fail}}, PASS: {{pass}}, TOTAL: {{count}})"
((outPath): status
((key ): args
((out ): args
- (log ): "Generating badge file '{{file}}'..."
- name : Badgen generate file
args :
labelColor: grey3
icon : "openaf_grey.svg"
file : "tests/results.svg"
exec : |
var data = io.readFileJSON("tests/autoTestAll.results.json")
args.fail = data.fail
args.pass = data.pass
args.count = data.count
args.label = "OpenAF tests"
args.color = "green"
if (args.fail > 0) args.color = "red"
# --------------
- name: Check in
uses: openaf/ojob-action@v4
env :
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
def : |
todo:
- (if ): >
"{{$env 'GITHUB_EVENT_NAME'}}" != "pull_request"
((then)):
- (runfile): ojob.io/git/hub/contentIn
((args )):
message: "Test results badge"
paths : "tests/results.svg,tests/asserts.svg,tests/autoTestAll.md"
((else)):
- (log): Ignoring check in on pull request
dist: t8
# ------------------
- name: Test results
run : |
grep -q '"fail":0' tests/autoTestAll.results.json || exit -1