Changed cwdPath logic to not leak memory. #6403
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 Windows | |
on: | |
push: | |
pull_request: | |
branches: | |
- master | |
env: | |
IS_JENKINS_SIGNING_ALLOWED: true | |
jobs: | |
build-windows: | |
runs-on: windows-2019 | |
env: | |
# enable starting Qt GUI Applications | |
QT_QPA_PLATFORM: offscreen | |
steps: | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
setup-python: 'false' | |
version: '6.6.1' | |
target: 'desktop' | |
arch: 'win64_msvc2019_64' | |
- name: Install Dependencies | |
# choco install of version 1.9.3 produced a checksum error | |
run: choco install doxygen.install --version=1.9.2 | |
- name: Uninstall Chocolatey | |
run: move "$env:PROGRAMDATA\chocolatey" "$env:PROGRAMDATA\_chocolatey" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
fetch-depth: 0 | |
- name: Create Python virtualenv | |
run: | | |
mkdir "${{ runner.workspace }}\_build\complete\.venv\" | |
# At the moment (2021-10-27) there is no official Python 3.10 lxml package available on pypi. Thus we use python 3.9. | |
py -3.9 -m venv "${{ runner.workspace }}\.venv" | |
CALL "${{ runner.workspace }}\.venv\Scripts\activate.bat" | |
echo Upgrading pip | |
python -m pip install --upgrade pip | |
pip install wheel | |
echo Installing python requirements | |
pip install -r "%GITHUB_WORKSPACE%\doc\requirements.txt" | |
shell: cmd | |
- name: CMake SDK | |
run: | | |
mkdir "${{ runner.workspace }}\_build\sdk\" | |
cd "${{ runner.workspace }}/_build/sdk" | |
cmake %GITHUB_WORKSPACE% -G "Visual Studio 16 2019" -A x64 -T v142 ^ | |
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=cmake/submodule_dependencies.cmake ^ | |
-DHAS_HDF5=ON ^ | |
-DHAS_QT=ON ^ | |
-DHAS_CURL=OFF ^ | |
-DHAS_CAPNPROTO=OFF ^ | |
-DHAS_FTXUI=ON ^ | |
-DBUILD_DOCS=OFF ^ | |
-DBUILD_APPS=OFF ^ | |
-DBUILD_SAMPLES=OFF ^ | |
-DBUILD_TIME=ON ^ | |
-DBUILD_PY_BINDING=OFF ^ | |
-DBUILD_CSHARP_BINDING=OFF ^ | |
-DBUILD_ECAL_TESTS=OFF ^ | |
-DECAL_INCLUDE_PY_SAMPLES=OFF ^ | |
-DECAL_INSTALL_SAMPLE_SOURCES=OFF ^ | |
-DECAL_JOIN_MULTICAST_TWICE=OFF ^ | |
-DECAL_NPCAP_SUPPORT=ON ^ | |
-DECAL_THIRDPARTY_BUILD_CMAKE_FUNCTIONS=ON ^ | |
-DECAL_THIRDPARTY_BUILD_PROTOBUF=ON ^ | |
-DECAL_THIRDPARTY_BUILD_SPDLOG=ON ^ | |
-DECAL_THIRDPARTY_BUILD_TINYXML2=ON ^ | |
-DECAL_THIRDPARTY_BUILD_FINEFTP=OFF ^ | |
-DECAL_THIRDPARTY_BUILD_CURL=OFF ^ | |
-DECAL_THIRDPARTY_BUILD_GTEST=OFF ^ | |
-DECAL_THIRDPARTY_BUILD_HDF5=ON ^ | |
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON ^ | |
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON ^ | |
-DECAL_THIRDPARTY_BUILD_QWT=OFF ^ | |
-DECAL_THIRDPARTY_BUILD_UDPCAP=ON ^ | |
-DBUILD_SHARED_LIBS=OFF ^ | |
-DCMAKE_PREFIX_PATH="%ProgramFiles%/Cap'n Proto/lib/cmake/CapnProto" ^ | |
-DCMAKE_BUILD_TYPE=Debug ^ | |
-DCPACK_PACK_WITH_INNOSETUP=OFF | |
shell: cmd | |
- name: CMake Complete | |
run: | | |
CALL "${{ runner.workspace }}\.venv\Scripts\activate.bat" | |
cd "${{ runner.workspace }}/_build/complete" | |
cmake %GITHUB_WORKSPACE% -G "Visual Studio 16 2019" -A x64 -T v142 ^ | |
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=cmake/submodule_dependencies.cmake ^ | |
-DHAS_HDF5=ON ^ | |
-DHAS_QT=ON ^ | |
-DHAS_CURL=ON ^ | |
-DHAS_CAPNPROTO=OFF ^ | |
-DHAS_FTXUI=ON ^ | |
-DBUILD_DOCS=ON ^ | |
-DBUILD_APPS=ON ^ | |
-DBUILD_SAMPLES=ON ^ | |
-DBUILD_TIME=ON ^ | |
-DBUILD_PY_BINDING=OFF ^ | |
-DBUILD_CSHARP_BINDING=ON ^ | |
-DBUILD_ECAL_TESTS=ON ^ | |
-DECAL_INCLUDE_PY_SAMPLES=OFF ^ | |
-DECAL_INSTALL_SAMPLE_SOURCES=ON ^ | |
-DECAL_JOIN_MULTICAST_TWICE=OFF ^ | |
-DECAL_NPCAP_SUPPORT=ON ^ | |
-DECAL_THIRDPARTY_BUILD_CMAKE_FUNCTIONS=ON ^ | |
-DECAL_THIRDPARTY_BUILD_PROTOBUF=ON ^ | |
-DECAL_THIRDPARTY_BUILD_SPDLOG=ON ^ | |
-DECAL_THIRDPARTY_BUILD_TINYXML2=ON ^ | |
-DECAL_THIRDPARTY_BUILD_FINEFTP=ON ^ | |
-DECAL_THIRDPARTY_BUILD_CURL=ON ^ | |
-DECAL_THIRDPARTY_BUILD_GTEST=ON ^ | |
-DECAL_THIRDPARTY_BUILD_HDF5=ON ^ | |
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON ^ | |
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON ^ | |
-DECAL_THIRDPARTY_BUILD_QWT=ON ^ | |
-DECAL_THIRDPARTY_BUILD_UDPCAP=ON ^ | |
-DBUILD_SHARED_LIBS=OFF ^ | |
-DCMAKE_PREFIX_PATH="%ProgramFiles%/Cap'n Proto/lib/cmake/CapnProto" ^ | |
-DCMAKE_BUILD_TYPE=Release ^ | |
-DCPACK_PACK_WITH_INNOSETUP=ON | |
shell: cmd | |
- name: Build SDK | |
run: cmake --build . --config Debug | |
working-directory: ${{ runner.workspace }}/_build/sdk | |
- name: Build Release | |
run: cmake --build . --config Release | |
working-directory: ${{ runner.workspace }}/_build/complete | |
- name: Create config path and copy ecal.yaml | |
run: | | |
mkdir "%ALLUSERSPROFILE%\eCAL" | |
copy ".\ecal\core\cfg\gen\ecal.yaml" "%ALLUSERSPROFILE%\eCAL" | |
working-directory: ${{ runner.workspace }}/_build/complete | |
shell: cmd | |
- name: Run Tests | |
run: ctest -C Release -V | |
working-directory: ${{ runner.workspace }}/_build/complete | |
- name: Pack SDK | |
run: cpack -C Debug | |
working-directory: ${{ runner.workspace }}/_build/sdk | |
- name: Pack complete setup | |
run: cpack -C Release | |
working-directory: ${{ runner.workspace }}/_build/complete | |
- name: Get Project version from git tag | |
shell: powershell | |
run: | | |
# Use git describe to get the tag / commit description | |
$VERSION = git describe --tags --dirty | |
#remove the leading 'v' from the tag, if it exists | |
$VERSION = $VERSION -replace '^v', '' | |
echo "VERSION=$VERSION" >> "$Env:GITHUB_ENV" | |
- name: Set output binary name | |
shell: powershell | |
run: | | |
$BINARY_NAME = "ecal_${{ env.VERSION }}-win64" | |
echo "BINARY_NAME=$BINARY_NAME" >> "$Env:GITHUB_ENV" | |
- name: Rename the setup exe | |
shell: powershell | |
run: | | |
$LS_OUT = ls *.exe | |
$SETUP_NAME = "$($LS_OUT.Name)" | |
Rename-Item -Path "$SETUP_NAME" -NewName "${{ env.BINARY_NAME }}.exe" | |
working-directory: ${{ runner.workspace }}/_build/complete/_deploy/ | |
- name: Upload Windows setup | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unsigned-setup | |
path: ${{ runner.workspace }}/_build/complete/_deploy/*.exe | |
# -------------------------------------------------------------------------------------------------- | |
sign-windows-installer: | |
runs-on: windows-2019 | |
needs: build-windows | |
steps: | |
# Download the installer from the previous job | |
- name: Download Windows setup | |
uses: actions/download-artifact@v4 | |
with: | |
name: unsigned-setup | |
path: ${{ runner.workspace }}/_build/complete/_deploy | |
- name: Sign the installer on Eclipse CI | |
if: env.IS_JENKINS_SIGNING_ALLOWED == 'true' && env.JENKINS_USERNAME != '' && env.JENKINS_API_TOKEN != '' && env.JENKINS_JOB_TOKEN != '' | |
run: | | |
$LS_OUT = ls *.exe | |
$ASSET_NAME = "$($LS_OUT.Name)" | |
$ASSET_NAME_OLD = "$($ASSET_NAME).old" | |
$ASSET_NAME_NEW = "$ASSET_NAME" | |
$JENKINS_JOB = 'gh_auto_file' | |
$JENKINS_BASE_URL = "https://ci.eclipse.org/ecal" | |
$JENKINS_CRUMB_URL = "$JENKINS_BASE_URL/crumbIssuer/api/json" | |
$JENKINS_JOB_URL = "$JENKINS_BASE_URL/job/$JENKINS_JOB" | |
$JENKINS_TRIGGER_URL = "$JENKINS_JOB_URL/buildWithParameters?token=$Env:JENKINS_JOB_TOKEN" | |
$WAIT_FOR_JENKINS_SEC = 10 | |
$COUNTER_LIMIT = 30 | |
$RESPONSE_CODE = 0 | |
$CRUMB_ID = '' | |
$CRUMB_FIELD = '' | |
$CRUMB_COOKIE = '' | |
$COUNTER = 0 | |
$QUEUE_URL = '' | |
$BUILD_NUM = 0 | |
$BUILD_URL = '' | |
Write-Output "-- get a Jenkins crumb & cookie" | |
$AUTH_CREDENTIAL = $Env:JENKINS_USERNAME + ':' + $Env:JENKINS_API_TOKEN | |
$AUTH_ENCODED = [System.Text.Encoding]::UTF8.GetBytes($AUTH_CREDENTIAL) | |
$AUTH_INFO = [System.Convert]::ToBase64String($AUTH_ENCODED) | |
$CRUMB_HEADERS = @{ | |
'Authorization'="Basic $($AUTH_INFO)" | |
} | |
$RESPONSE = Invoke-WebRequest -Uri $JENKINS_CRUMB_URL -Method GET -Headers $CRUMB_HEADERS | |
$RES_CODE = $RESPONSE.StatusCode | |
Write-Output " ++ Jenkins crumb retrieval - HTTP status code: $RES_CODE" | |
if ($RES_CODE -ge 200 -and $RES_CODE -lt 300) { | |
$JSON_CONTENT = $RESPONSE.Content | ConvertFrom-Json | |
$CRUMB_ID = $JSON_CONTENT.crumb | |
$CRUMB_FIELD = $JSON_CONTENT.crumbRequestField | |
$CRUMB_COOKIE = $RESPONSE.Headers['Set-Cookie'] | |
#Write-Output " ++ Jenkins crumb: '$CRUMB_ID'" | |
#Write-Output " ++ Jenkins cookie: '$CRUMB_COOKIE'" | |
} else { | |
Write-Output " ** determination of the Jenkins crumb failed" | |
Exit 1 | |
} | |
Write-Output "-- trigger a new build of '$JENKINS_JOB' with installer '$ASSET_NAME'" | |
$TRIGGER_HEADERS = @{ | |
'Authorization'="Basic $($AUTH_INFO)" | |
'Cookie'=$CRUMB_COOKIE | |
$CRUMB_FIELD=$CRUMB_ID | |
} | |
$FORM = @{ | |
'GH_FILE_NAME'= $ASSET_NAME | |
'GH_EXECUTABLE'= Get-Item -Path $ASSET_NAME | |
} | |
$RESPONSE = Invoke-WebRequest -Uri $JENKINS_TRIGGER_URL -Method POST -Headers $TRIGGER_HEADERS -Form $FORM | |
$RES_CODE = $RESPONSE.StatusCode | |
Write-Output " ++ trigger build - HTTP status code: $RES_CODE" | |
if ($RES_CODE -ge 200 -and $RES_CODE -lt 300) { | |
$QUEUE_URL = $RESPONSE.Headers.location | |
$QUEUE_URL = "$($QUEUE_URL)api/json/" | |
Write-Output " ++ queue URL: $QUEUE_URL" | |
} else { | |
Write-Output " ** trigger failure" | |
Exit 1 | |
} | |
Write-Output "-- get the new build number" | |
while ($true) { | |
$COUNTER++ | |
if ($COUNTER -gt $COUNTER_LIMIT) { | |
Write-Output " ** determination of the new build number failed after $COUNTER_LIMIT tries" | |
Exit 1 | |
} | |
$RESPONSE = Invoke-WebRequest -Uri $QUEUE_URL | |
$RES_CODE = $RESPONSE.StatusCode | |
Write-Output " ++ build number retrieval - HTTP status code: $RES_CODE" | |
if ($RES_CODE -ge 200 -and $RES_CODE -lt 300) { | |
$JSON_CONTENT = $RESPONSE.Content | ConvertFrom-Json | |
$EXECUTABLE = $JSON_CONTENT.executable | |
$BUILD_NUM = $EXECUTABLE.number | |
if ($BUILD_NUM) { | |
Write-Output " ++ #build number: $BUILD_NUM" | |
$BUILD_URL = $EXECUTABLE.url | |
Break | |
} else { | |
Write-Output " ++ ... pending, wait for $WAIT_FOR_JENKINS_SEC s" | |
Start-Sleep -s $WAIT_FOR_JENKINS_SEC | |
} | |
} else { | |
Write-Output " ** determination of the build number failed, trying again after $WAIT_FOR_JENKINS_SEC s" | |
Start-Sleep -s $WAIT_FOR_JENKINS_SEC | |
} | |
} | |
$JENKINS_STATUS_URL = "$($BUILD_URL)api/json" | |
Write-Output "-- check build status of #Build $BUILD_NUM with $JENKINS_STATUS_URL" | |
while ($true) { | |
$RESPONSE = Invoke-WebRequest -Uri $JENKINS_STATUS_URL | |
$RES_CODE = $RESPONSE.StatusCode | |
Write-Output " ++ status check - HTTP status code: $RES_CODE" | |
if ($RES_CODE -ge 200 -and $RES_CODE -lt 300) { | |
$CONTENT = ConvertFrom-Json $RESPONSE.Content | |
$NUMBER = $CONTENT | Select-Object -expand 'number' | |
if ($NUMBER -eq $BUILD_NUM) { | |
$BUILDING = $CONTENT | Select-Object -expand 'building' | |
if ($BUILDING) { | |
Write-Output " ++ ... building, wait for $WAIT_FOR_JENKINS_SEC s" | |
Start-Sleep -s $WAIT_FOR_JENKINS_SEC | |
} else { | |
$RESULT = $CONTENT | Select-Object -expand 'result' | |
if ($RESULT -eq 'SUCCESS') { | |
Write-Output " ++ build success, asset name: '$ASSET_NAME'" | |
Break | |
} else { | |
Write-Output " ** build failure" | |
Exit 1 | |
} | |
} | |
} else { | |
Write-Output " ++ ... pending, wait for $WAIT_FOR_JENKINS_SEC s" | |
Start-Sleep -s $WAIT_FOR_JENKINS_SEC | |
} | |
} else { | |
Write-Output " ** status check failure" | |
Exit 1 | |
} | |
} | |
$JENKINS_DOWNLOAD_URL = "$JENKINS_JOB_URL/$BUILD_NUM/artifact/$ASSET_NAME" | |
Write-Output "-- download the newly-signed Windows installer from #Build $BUILD_NUM with $JENKINS_DOWNLOAD_URL" | |
Rename-Item -Path "$ASSET_NAME" -NewName "$ASSET_NAME_OLD" | |
$RESPONSE = Invoke-WebRequest -Uri $JENKINS_DOWNLOAD_URL -OutFile $ASSET_NAME_NEW -PassThru | |
$RES_CODE = $RESPONSE.StatusCode | |
Write-Output " ++ download installer - HTTP status code: $RES_CODE" | |
if ($RES_CODE -ge 200 -and $RES_CODE -lt 300) { | |
Write-Output "IS_DOWNLOAD_AVAILABLE=true" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "ASSET_NAME=$ASSET_NAME" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output " ++ downloaded signed installer: '$ASSET_NAME'" | |
} else { | |
Write-Output " ** download failure" | |
Exit 1 | |
} | |
env: | |
JENKINS_USERNAME: ${{ secrets.JENKINS_USERNAME }} | |
JENKINS_API_TOKEN: ${{ secrets.JENKINS_API_TOKEN }} | |
JENKINS_JOB_TOKEN: ${{ secrets.JENKINS_TOKEN_GH_FILE }} | |
working-directory: ${{ runner.workspace }}/_build/complete/_deploy | |
- name: Determine name of the installer for zip file | |
shell: powershell | |
run: | | |
$INSTALLER_NAME = "${{ env.ASSET_NAME }}" | |
$INSTALLER_NAME_WITHOUT_EXE = $INSTALLER_NAME.Substring(0, $INSTALLER_NAME.Length - 4) | |
echo "ARTIFACT_NAME=$INSTALLER_NAME_WITHOUT_EXE" >> "$Env:GITHUB_ENV" | |
- name: Upload Windows setup signed on Eclipse CI | |
if: env.IS_DOWNLOAD_AVAILABLE == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: ${{ runner.workspace }}/_build/complete/_deploy/${{ env.ASSET_NAME }} |