-
Notifications
You must be signed in to change notification settings - Fork 21
159 lines (136 loc) · 7.95 KB
/
build_app.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
name: Build App
on:
push:
branches:
- master
concurrency: ci-${{ github.ref }}
jobs:
build-app:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Latest MSVC-2022",
os: windows-latest,
artifact: "windows_msvc2022.7z",
build_type: "Release",
cc: "cl",
cxx: "cl",
archiver: "7z a",
generators: "Visual Studio 17 2022"
}
steps:
- name: Check out repository code
uses: actions/[email protected]
with:
submodules: 'true'
- name: Setup Dev Env
uses: ./.github/actions/setup_dev_env
- name: Cache wxWidgets config/build
id: cache-wx-build
uses: actions/cache@v3
with:
path: '${{runner.temp}}/build_${{ runner.os }}_wx_app'
key: ${{ runner.os }}-build-wxapp-${{ hashFiles('**/CMakeLists.txt') }}
#key: ${{ runner.os }}-build-wxapp
- name: Initial wxWidgets config/build
shell: pwsh
env:
LEAFLET_KEY: ${{ secrets.LEAFLET_KEY }}
if: steps.cache-wx-build.outputs.cache-hit != 'true' && runner.os == 'Windows'
working-directory: ${{runner.temp}}
run: |
if (-Not (Test-Path 'build_${{ runner.os }}_wx_app')){ mkdir build_${{ runner.os }}_wx_app }
cd build_${{ runner.os }}_wx_app
#cmake -DInterSpec_FETCH_DEPENDENCIES=OFF -DCMAKE_INSTALL_PREFIX=InterSpec_app_${{runner.os}}_WebView_latest -DCMAKE_PREFIX_PATH="${{runner.temp}}\install" -DNO_CMAKE_SYSTEM_PATH=ON -DCMAKE_FIND_USE_CMAKE_SYSTEM_PATH=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache "${{github.workspace}}/target/wxWidgets"
$prefix = "${{runner.temp}}/install"
$install_dir = "InterSpec_app_Windows_WebView_latest"
cmake -DInterSpec_FETCH_DEPENDENCIES=OFF -DUSE_LEAFLET_MAP=ON -DLEAFLET_MAPS_KEY="$env:LEAFLET_KEY" -DUSE_REMOTE_RID=ON -DUSE_REL_ACT_TOOL=ON -DUSE_DETECTION_LIMIT_TOOL=ON -DCMAKE_INSTALL_PREFIX="$install_dir" -DCMAKE_PREFIX_PATH="${{runner.temp}}\install" -DNO_CMAKE_SYSTEM_PATH=ON -DCMAKE_FIND_USE_CMAKE_SYSTEM_PATH=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DwxWidgets_ROOT_DIR="$prefix" -DwxWidgets_LIB_DIR="$prefix/lib/vc_x64_lib" -DwxWidgets_CONFIGURATION="msw" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_CONFIGURATION_TYPES="Release" -DCMAKE_CONFIGURATION_TYPES="Release" -G "Ninja" "${{github.workspace}}/target/wxWidgets"
# The build -j1 is needed for debug builds to avoid error "fatal error C1041: cannot open program database...", which I think is happening, not because of the "/FS" flag, but because of multiple targets sharing an intermediate directory - maybe
- name: wxWidgets app build
shell: pwsh
if: runner.os == 'Windows'
working-directory: ${{runner.temp}}/build_${{ runner.os }}_wx_app
run: |
if (Test-Path 'InterSpec_app_Windows_WebView_latest'){ Remove-Item 'InterSpec_app_Windows_WebView_latest' -Recurse -Force }
cmake --build . --config Release
cmake --build . --config Release --target install
$notes = "InterSpec_app_${{ runner.os }}_WebView_latest\build_info.txt"
echo "This is an automated build of InterSpec built on the github infrastruction at $(date)" >> $notes
echo "No testing has been performed on this build." >> $notes
echo "InterSpec code git has SHA: ${{ github.sha }}" >> $notes
echo "The Edge browser runtime is required to be installed to run; this will typically already be installed on Windows 10, and may be installed on Windows 7, but this hasnt been tested." >> $notes
echo "Before zipping, files present for the bbuild are:"
ls
Get-ChildItem InterSpec_app_${{ runner.os }}_WebView_latest*.zip | foreach { Remove-Item -Path $_.FullName }
echo "After removing old zip files"
ls
Compress-Archive -CompressionLevel Optimal -Path .\InterSpec_app_${{ runner.os }}_WebView_latest -DestinationPath InterSpec_app_${{ runner.os }}_WebView_latest_$(get-date -f yyyy-MM-dd).zip
echo "After zipping, files present for the build are:"
ls
echo "And files in base dir"
ls ${{runner.temp}}
ls ${{ github.workspace }}
if (Test-Path -Path '${{runner.temp}}\.sccache'){ ls ${{runner.temp}}\.sccache } else { echo "${{runner.temp}}\.sccache Does not exist"}
if (Test-Path -Path 'D:\a\InterSpec'){ ls D:\a\InterSpec } else { echo "D:\a\InterSpec Does not exist"}
if (Test-Path -Path 'D:\a\InterSpec\InterSpec'){ ls D:\a\InterSpec\InterSpec } else { echo "D:\a\InterSpec\InterSpec Does not exist"}
if (Test-Path -Path 'D:\a\InterSpec\InterSpec\.sccache'){ ls D:\a\InterSpec\InterSpec\.sccache } else { echo "D:\a\InterSpec\InterSpec\.sccache Does not exist"}
# sccache --show-stats || & { "ignore failure"; $global:LASTEXITCODE = 0 }
# sccache --stop-server || & { "ignore failure"; $global:LASTEXITCODE = 0 }
- name: Upload wxWidgets app to as GitHub Artifact
uses: actions/[email protected]
if: runner.os == 'Windows'
with:
name: InterSpec_app_${{ runner.os }}_WebView_latest
path: '${{runner.temp}}/build_${{ runner.os }}_wx_app/InterSpec_app_${{ runner.os }}_WebView_latest'
# - name: Upload sccache Artifact
# uses: actions/[email protected]
# if: runner.os == 'Windows'
# with:
# name: sccache_log
# path: '${{runner.temp}}/sccache_log.txt'
- name: Test app build worked
shell: pwsh
working-directory: ${{runner.temp}}/build_${{ runner.os }}_wx_app/InterSpec_app_${{ runner.os }}_WebView_latest
run: |
$p = Start-Process .\InterSpec.exe -ArgumentList @("--test-load", "--mult-instance", "--no-restore") -PassThru
$errTimedOut = $null
$p | Wait-Process -Timeout 120 -ErrorAction SilentlyContinue -ErrorVariable errTimedOut
if ($errTimedOut) { Stop-Process -InputObject $p -Force }
echo "Exit code of InterSpec test load was was" $p.ExitCode
$rval = $p.ExitCode
exit $rval
# If Stop-Process had to be used, the exit code will be -1. If resources didnt load -12. If timed out inside InterSpec -11. If all was okay, 0
# However, some time in Jun 2023, things started timing out (to give return code -11) regularly, even though everything was fine - so we'll allow this, for the moment, but need to look into more.
# Then test file o
#
# Then maybe do a test with something like Puppeteer, by starting the app on a given port, like:
# $p = Start-Process .\Release\InterSpec.exe -ArgumentList @("--no-token", "--port=8088", "--mult-instance", "--no-restore") -PassThru
# Update the bleeding-edge tag to be current commit
- name: Run latest-tag
uses: EndBug/[email protected]
with:
ref: bleeding-edge
description: Latest successful automated build
- name: Create Release
uses: ncipollo/[email protected]
with:
artifacts: '${{runner.temp}}\build_${{ runner.os }}_wx_app\InterSpec_app_${{ runner.os }}_WebView_latest*.zip'
draft: false
prerelease: true
body: "An automated, and untested build of the latest code pushed to the repository. Requires Windows 10, or may work on Windows 7 with the Edge browser runtime installed."
allowUpdates: true
generateReleaseNotes: false
name: "Development Build"
removeArtifacts: true
replacesArtifacts: true
tag: 'bleeding-edge'
commit: ${{ github.sha }}
makeLatest: true
- name: "Cleanup and finish"
run: |
Get-ChildItem InterSpec_app_${{ runner.os }}_WebView_latest*.zip | foreach { Remove-Item -Path $_.FullName }
echo "Job status is ${{ job.status }}."