Skip to content

Build/Test

Build/Test #269

Workflow file for this run

# 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