-
Notifications
You must be signed in to change notification settings - Fork 72
219 lines (195 loc) · 7.67 KB
/
build.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
# Build, test and upload executables to GitHub
# depends on pre-installed software; see image definitions:
# - https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md
# - https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
# We use these tools from the runner images: git, gcc/XCode/MSVC, swig, Tcl/Tk on MacOS
# TODO: not building svs_viewer ('Cannot find GL, GLU, not building svs_viewer' and 'Cannot find opengl32, glu32, not building svs_viewer')
# TODO: not building with TCL support; need to install TCL from somewhere (maybe http://tclkits.rkeene.org/fossil/wiki/Downloads?)
# TODO: pin more dependency versions (python, swig, gcc/XCode/MSVC, etc.)
name: Build/Test
on:
push:
pull_request:
workflow_dispatch:
schedule:
# 5AM every Monday, to catch breaks due to changes in dependencies
- cron: "0 5 * * 1"
jobs:
"Posix":
name: build-*nix
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.X'
# TODO: install on other platforms, too
- name: Setup tcl (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install tcl-dev
- name: build
env:
# instructs SCons to print debug statements to stdout
SCONS_MSCOMMON_DEBUG: '-'
run: python3 scons/scons.py --scu --opt --verbose all performance_tests
- name: Pack artifacts
run: tar -czvf build.tar.gz out/
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: Soar-${{ matrix.os }}
path: ./build.tar.gz
- name: unit tests
working-directory: ./out
# TODO: why do these fail? Make them pass. testHamilton only fails on Mac, and only sometimes.
run: ./UnitTests -e PRIMS_Sanity1 -e PRIMS_Sanity2 -f testLoadLibrary -f testSmemArithmetic -f testHamilton
- name: SML Java tests
working-directory: ./out
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/out
run: java -jar java/soar-smljava.jar
- name: SML Python tests
working-directory: ./out
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/out
PYTHONUTF8: 1
run: python3 TestPythonSML.py
# TODO: run additional tests for Tcl, CSharp
# reports JUnit test results as GitHub PR check.
- name: publish test report
uses: mikepenz/action-junit-report@v3
# always run even if the previous step fails
if: always()
with:
report_paths: './out/TestResults.xml'
# disabled until https://github.com/mikepenz/action-junit-report/issues/40 is resolved
# fail_on_failure: true
annotate_only: true
# TODO: run SML tests (Python, Tcl, Java)
- name: performance tests
working-directory: ./out
run: sudo ./do_performance_test.sh
- name: upload performance test results
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-PerformanceTestResults.txt
path: ./out/SoarPerformanceTests/PerformanceTestResults.txt
# Using powershell means we need to explicitly stop on failure
Windows:
name: build-windows
runs-on: [windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
# This does not install MSVC or Visual Studio! We rely on the software installed already on the
# GH action runner, and this step just prepares the environment. We pin the VS version here because
# the error messages are much more helpful than the mess we get from SCons, which automatically
# falls back on a combo of Mingw with MSVC libs and then fails to build.
- name: switch to VS command prompt
uses: ilammy/msvc-dev-cmd@v1
# No easy/quick way to install TCL on Windows, so we download and build it ourselves.
- name: build and install Tcl
env:
TCL_DOWNLOAD_URL: https://kumisystems.dl.sourceforge.net/project/tcl/Tcl/8.6.13/tcl8613-src.zip
EXPECTED_TCL_HASH: 8999fcafab2d85473280e0bf6e390480496dfd53
run: |
(new-object System.Net.WebClient).DownloadFile($Env:TCL_DOWNLOAD_URL, 'tcl8613-src.zip')
# check that the file hash matches what we expect
$FileHash = Get-FileHash -Algorithm SHA1 tcl8613-src.zip
if ( $FileHash.Hash -ne $Env:EXPECTED_TCL_HASH ) {
throw "tcl download hash mismatch: $($FileHash.Hash)"
}
Expand-Archive tcl8613-src.zip -DestinationPath tcl8613-src
cd tcl8613-src\tcl8.6.13\win
&nmake -f makefile.vc release install INSTALLDIR=c:\progra~1\tcl
if ($lastexitcode -ne 0) {
throw "nmake exit code: $lastexitcode"
}
- name: build
env:
# instructs SCons to print debug statements to stdout
SCONS_MSCOMMON_DEBUG: '-'
run: |
./build.bat --scu --opt --verbose --tcl=c:\progra~1\tcl all performance_tests
if ($lastexitcode -ne 0) {
throw "build.bat exit code: $lastexitcode"
}
- name: Pack artifacts
shell: bash
run: tar -czvf build.tar.gz out/
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: Soar-Windows
path: ./build.tar.gz
- name: unit tests
working-directory: ./out
# TODO: why do these fail? Make them pass.
run: |
./UnitTests -e PRIMS_Sanity1 -e PRIMS_Sanity2 -f testSmemArithmetic
if ($lastexitcode -ne 0) {
throw "UnitTests exit code: $lastexitcode"
}
- name: SML Java tests
working-directory: ./out
run: |
java -jar java/soar-smljava.jar
if ($lastexitcode -ne 0) {
throw "soar-smljava exit code: $lastexitcode"
}
- name: SML Python tests
working-directory: ./out
env:
PYTHONUTF8: 1
run: |
python3 TestPythonSML.py
if ($lastexitcode -ne 0) {
throw "soar-smljava exit code: $lastexitcode"
}
# TODO: run additional tests for Tcl, CSharp
# reports JUnit test results as GitHub PR check.
- name: publish test report
uses: mikepenz/action-junit-report@v3
# always run even if the previous step fails
if: always()
with:
report_paths: './out/TestResults.xml'
# disabled until https://github.com/mikepenz/action-junit-report/issues/40 is resolved
# fail_on_failure: true
annotate_only: true
- name: performance tests
working-directory: ./out
run: |
bash ./do_performance_test.sh
if ($lastexitcode -ne 0) {
throw "do_performance_test exit code: $lastexitcode"
}
- name: upload performance test results
uses: actions/upload-artifact@v3
with:
name: Windows-PerformanceTestResults.txt
path: ./out/SoarPerformanceTests/PerformanceTestResults.txt