Some slight tweaks to the "Spectrum Files" tab. #391
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build App | |
on: | |
push: | |
branches: | |
- master | |
concurrency: ci-${{ github.ref }} | |
jobs: | |
build-win: | |
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: Upload Windows artifact | |
uses: actions/upload-artifact@v4 | |
id: artifact-windows-upload-step | |
with: | |
name: windows-build | |
overwrite: true | |
path: '${{runner.temp}}\build_${{ runner.os }}_wx_app\InterSpec_app_${{ runner.os }}_WebView_latest*.zip' | |
# - 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 }}." | |
build-linux: | |
runs-on: ubuntu-latest # Use the latest Ubuntu environment | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
path: ${{ github.workspace }}/InterSpec_code | |
submodules: true # Recursively checkout submodules | |
- name: Cache npm dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{runner.temp}}/build_linux_working_dir | |
key: ${{ runner.os }}-build-npm-${{ hashFiles('target/electron/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-npm- | |
- name: Cache c++ dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{runner.temp}}/build_linux_electron | |
key: ${{ runner.os }}-build-cpp-${{ hashFiles('cmake/FetchInterSpecDeps.txt') }} | |
restore-keys: | | |
${{ runner.os }}-build-cpp- | |
- name: Make build directories | |
shell: bash | |
working-directory: ${{runner.temp}} | |
run: | | |
mkdir -p build_linux_electron | |
mkdir -p build_linux_working_dir | |
- name: Configure and build in Docker | |
uses: addnab/docker-run-action@v3 | |
env: | |
LEAFLET_KEY: ${{ secrets.LEAFLET_KEY }} | |
with: | |
image: quay.io/pypa/manylinux_2_28_x86_64 | |
shell: bash | |
options: --name manylinux-container -v ${{ github.workspace }}/InterSpec_code:/interspec -v ${{runner.temp}}/build_linux_electron/:/build_app -v ${{runner.temp}}/build_linux_working_dir:/build_working_dir -e LEAFLET_KEY=${{ secrets.LEAFLET_KEY }} | |
run: | | |
echo "Running Script from within docker" | |
/interspec/target/electron/build_linux_app_from_docker.sh /interspec /build_app /build_working_dir | |
- name: Upload Linux artifact | |
uses: actions/upload-artifact@v4 | |
id: artifact-linux-upload-step | |
with: | |
name: linux-build | |
overwrite: true | |
path: ${{runner.temp}}/build_linux_working_dir/InterSpec_app_Linux_Electron_latest_*.zip | |
release: | |
runs-on: ubuntu-latest | |
needs: [build-linux, build-win] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download Build Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: '*-build' | |
path: './artifacts' | |
merge-multiple: true | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Get Release ID | |
id: get_release | |
run: | | |
RELEASE_NAME="Development Build" | |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
RELEASE_ID=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ | |
"https://api.github.com/repos/${{ github.repository }}/releases" | \ | |
jq -r ".[] | select(.name == \"$RELEASE_NAME\") | .id") | |
echo "release_id=$RELEASE_ID" >> $GITHUB_ENV | |
- name: Delete Previous Assets | |
run: | | |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
RELEASE_ID=${{ env.release_id }} | |
PATTERN="InterSpec_app*" | |
# Get all assets for the release | |
ASSETS=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ | |
"https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID/assets") | |
# Loop through assets and delete those matching the pattern | |
echo "$ASSETS" | jq -c '.[]' | while read -r asset; do | |
ASSET_NAME=$(echo "$asset" | jq -r '.name') | |
ASSET_ID=$(echo "$asset" | jq -r '.id') | |
# Check if the asset name matches the pattern | |
if [[ "$ASSET_NAME" == $PATTERN ]]; then | |
echo "Deleting asset: $ASSET_NAME" | |
curl -X DELETE -H "Authorization: token $GITHUB_TOKEN" \ | |
"https://api.github.com/repos/${{ github.repository }}/releases/assets/$ASSET_ID" | |
fi | |
done | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
fail_on_unmatched_files: true | |
tag_name: "bleeding-edge" | |
release_name: "Development Build" | |
body: "An automated, and untested build of the latest code pushed to the repository.<br />Windows version requires Windows 10 or 11, but may work on Windows 7 with the Edge browser runtime installed.<br />Linux version requires `glibc >=2.28` based distro (e.g., Ubuntu 21.04+, RHEL 9+, Debian 11+, Fedora 34+)." | |
draft: false | |
generate_release_notes: false | |
prerelease: true | |
make_latest: true | |
files: "./artifacts/**" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |