Package for Windows #1067
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: Package for Windows | |
on: | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled ' | |
required: false | |
default: false | |
git-ref: | |
description: Branch of gem/oq-builders repository | |
default: master | |
required: true | |
path: | |
description: Path to upload packages | |
default: /oq-engine/ | |
required: true | |
oq-ref: | |
description: Branch of Openquake Engine | |
default: master | |
required: true | |
oq-rel: | |
description: Build Number of Openquake Engine | |
default: 1 | |
required: false | |
oq-tag: | |
description: Tag of OQ Release (if defined, also upload assets to Releases) | |
required: false | |
oq-science: | |
description: Build oq-mbtk and vmtk | |
default: 0 | |
required: true | |
# push: | |
# branches: | |
# - | |
schedule: | |
- cron: "30 21 * * *" | |
pull_request: | |
jobs: | |
Build_Installer: | |
runs-on: ubuntu-latest | |
env: | |
GEM_SET_BRANCH: ${{ github.event.inputs.oq-ref }} | |
GEM_SET_BRANCH_TOOLS: ${{ github.event.inputs.oq-ref }} | |
GEM_SET_RELEASE: ${{ github.event.inputs.oq-rel }} | |
GEM_SET_BUILD_SCIENCE: ${{ github.event.inputs.oq-science }} | |
GIT_BRANCH: ${{ github.ref }} | |
GIT_COMMIT_SHA: ${{ github.sha }} | |
steps: | |
- name: Clone Repository (Latest) | |
uses: actions/checkout@v4 | |
if: github.event.inputs.git-ref == '' | |
- name: Clone Repository (Custom Ref) | |
uses: actions/checkout@v4 | |
if: github.event.inputs.git-ref != '' | |
with: | |
ref: ${{ github.event.inputs.git-ref }} | |
- run: | | |
echo ${{ github.workspace }} | |
echo $GITHUB_WORKSPACE | |
- name: Docker build of the container and create installer | |
run: | | |
echo "Check variable for build packages" | |
echo "GEM_SET_BRANCH: ${GEM_SET_BRANCH}" | |
echo "GEM_SET_BRANCH_TOOLS: ${GEM_SET_BRANCH_TOOLS}" | |
echo "GEM_SET_RELEASE: ${GEM_SET_RELEASE}" | |
echo "GEM_SET_BUILD_SCIENCE: ${GEM_SET_BUILD_SCIENCE}" | |
sleep 2 | |
bash -x ci/windows_package.sh | |
# | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: NotSigned | |
path: /home/runner/work/oq-builders/oq-builders/out | |
retention-days: 5 | |
Test_OQ: | |
needs: Build_Installer | |
runs-on: windows-2019 | |
timeout-minutes: 45 | |
steps: | |
- name: Download Windows Installer from build job | |
uses: actions/download-artifact@v4 | |
with: | |
name: NotSigned | |
- name: Execute the Installer | |
run: | | |
pwd | |
Get-ChildItem -Path ${{ github.workspace }} | |
$Install = Get-ChildItem -Filter *.exe | |
Start-Process -FilePath $Install.Fullname -ArgumentList "/S" -Wait | |
$env:PATH += ";$env:LOCALAPPDATA\Programs\OpenQuake Engine\python3\Scripts" | |
- name: Run oq | |
run: | | |
$env:PATH += ";$env:LOCALAPPDATA\Programs\OpenQuake Engine\python3\Scripts" | |
oq.exe --version | |
oq.exe engine --run "https://downloads.openquake.org/pkgs/test_event_based_risk_inputs_bc.zip" | |
oq.exe engine --run "https://downloads.openquake.org/jobs/M4_Exercise.zip" | |
oq.exe engine --list-risk-calculations | |
- name: Run oq webui console and curl for the standalone tools | |
run: | | |
$env:PATH += ";$env:LOCALAPPDATA\Programs\OpenQuake Engine\python3\Scripts" | |
Write-Host ${env:PATH} | |
cd "$env:LOCALAPPDATA\Programs\OpenQuake Engine\python3\Scripts" | |
Start-Job -ScriptBlock{& oq.exe webui start 127.0.0.1:8800 -s 2>&1 > "$env:LOCALAPPDATA\Temp\webui.log" } | |
ping 127.0.0.1 -n 6 > null | |
Get-Job | |
netstat -o -n -a | findstr 8800 | |
Write-Host "Test webui and tools Web pages" | |
ping 127.0.0.1 -n 6 > null | |
curl.exe -I -G http://127.0.0.1:8800/engine | |
ping 127.0.0.1 -n 6 > null | |
curl.exe -X HEAD -I http://127.0.0.1:8800/ipt/ | |
ping 127.0.0.1 -n 6 > null | |
curl.exe -X HEAD -I http://127.0.0.1:8800/taxonomy/ | |
ping 127.0.0.1 -n 6 > null | |
curl.exe -X HEAD -I http://127.0.0.1:8800/taxtweb/ | |
ping 127.0.0.1 -n 6 > null | |
oq.exe engine --list-risk-calculations | |
curl.exe -v --fail -G http://127.0.0.1:8800/engine/1/outputs | |
- name: Upload Artifact WebUI log | |
uses: actions/upload-artifact@v4 | |
with: | |
name: WebUI_log | |
path: C:\\Users\\runneradmin\\AppData\\Local\\Temp\\webui.log | |
retention-days: 5 | |
- name: Test installation of oq-mbtk | |
run: | | |
$env:PATH="$env:LOCALAPPDATA\Programs\OpenQuake Engine\python3" | |
$env:PATH="$env:PATH;$env:LOCALAPPDATA\Programs\OpenQuake Engine\python3\Scripts" | |
python.exe -V | |
cd "$env:LOCALAPPDATA\Programs\OpenQuake Engine" | |
Remove-Item -Path .\oq-mbtk\openquake\cat\__init__.py | |
python.exe -m pip install pytest | |
pytest -vsx .\oq-mbtk\openquake\cat | |
if: github.event.inputs.oq-science == '1' | |
# Removed VMTK | |
#- name: Compare files of VMTK | |
# run: | | |
# $env:PATH="$env:LOCALAPPDATA\Programs\OpenQuake Engine\python3" | |
# $env:PATH="$env:PATH;$env:LOCALAPPDATA\Programs\OpenQuake Engine\python3\Scripts" | |
# python.exe -V | |
# cd "$env:LOCALAPPDATA\Programs\OpenQuake Engine" | |
# cd "oq-vmtk\demonstration_files" | |
# dir | |
# python.exe computation_scripts_example_lite.py | |
# cd "outputs\out_dynamic_an_edps_imls\CR_LFINF-CDN_H1" | |
# dir | |
# $dirB = "$env:GITHUB_WORKSPACE\ci\to_compare" | |
# $dirA = "$env:LOCALAPPDATA\Programs\OpenQuake Engine\oq-vmtk\demonstration_files\outputs\out_dynamic_an_edps_imls\CR_LFINF-CDN_H1" | |
# if ( Compare-Object (Get-Content $dirA\max_accels.csv) -DifferenceObject (Get-Content $dirB\max_accels.csv) -SyncWindow 0 ) { exit 1} else {"Files are the same"} | |
# if ( Compare-Object (Get-Content $dirA\imls.csv) -DifferenceObject (Get-Content $dirB\imls.csv) -SyncWindow 0 ) {exit 1} else {"Files are the same"} | |
# if ( Compare-Object (Get-Content $dirA\max_disps.csv) -DifferenceObject (Get-Content $dirB\max_disps.csv) -SyncWindow 0 ) {exit 1} else {"Files are the same"} | |
# if: github.event.inputs.oq-science == '1' | |
- run: | | |
Get-ChildItem -Path ${{ github.workspace }} | |
- name: Sign files with Trusted Signing | |
uses: azure/[email protected] | |
with: | |
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }} | |
endpoint: ${{ secrets.AZURE_ENDPOINT }} | |
trusted-signing-account-name: ${{ secrets.AZURE_CODE_SIGNING_NAME }} | |
certificate-profile-name: ${{ secrets.AZURE_CERT_PROFILE_NAME }} | |
files-folder: ${{ github.workspace }} | |
files-folder-filter: exe | |
file-digest: SHA256 | |
timestamp-rfc3161: http://timestamp.acs.microsoft.com | |
timestamp-digest: SHA256 | |
- run: | | |
Get-ChildItem -Path ${{ github.workspace }} | |
- name: Upload Signed Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Signed | |
path: ${{ github.workspace }} | |
retention-days: 5 | |
Upload_Installer_Signed: | |
needs: Test_OQ | |
runs-on: ubuntu-latest | |
env: | |
DOWNLOAD_SSH: ${{ secrets.DOWNLOAD_ARTIFACTS }} | |
folder: ${{ github.event.inputs.path }} | |
vtag: ${{ github.event.inputs.oq-tag }} | |
GITHUB_TOKEN: ${{ secrets.OQ_RELEASE_PAT }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Signed Windows Installer from test job | |
uses: actions/download-artifact@v4 | |
with: | |
name: Signed | |
- name: rsync to downloads.openquake.org | |
shell: bash | |
run: | | |
gpg --quiet --batch --yes --decrypt --passphrase="$DOWNLOAD_SSH" --output ./.deploy_rsa ./.oq_builders.enc | |
chmod 600 ./.deploy_rsa | |
eval $(ssh-agent -s) && ssh-add ./.deploy_rsa | |
# print value of folder | |
echo "Folder to upload packages: ${folder}" | |
if test -z "$folder" | |
then | |
echo "\$folder is empty" | |
folder=oq-engine/nightly/ | |
echo $folder | |
else | |
echo "\$folder is NOT empty" | |
fi | |
rsync -e 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 332' -ax OpenQuake_Engine* [email protected]:/mnt/box/openquake/downloads/pkgs/windows/${folder} | |
# check if we have a tag and need to upload to release | |
if [[ -n "${vtag}" ]]; then | |
echo "vtag is defined, so we need to upload files to OQ release" | |
gh release upload ${vtag} -R gem/oq-engine OpenQuake_Engine* | |
fi | |
Upload_Installer_NotSigned: | |
needs: Test_OQ | |
runs-on: ubuntu-latest | |
env: | |
DOWNLOAD_SSH: ${{ secrets.GEM_PASS_TO_WIN }} | |
IP_TOUP: ${{ secrets.GEM_IP_STORE }} | |
PORT_TOUP: ${{ secrets.GEM_PORT_STORE }} | |
USER_TOUP: ${{ secrets.GEM_USER_STORE }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Not Signed Windows Installer from test job | |
uses: actions/download-artifact@v4 | |
with: | |
name: NotSigned | |
- name: Setup debugging session | |
uses: mxschmitt/action-tmate@v3 | |
timeout-minutes: 35 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
- name: rsync to GEM | |
shell: bash | |
run: | | |
gpg --quiet --batch --yes --decrypt --passphrase="$DOWNLOAD_SSH" --output ./.deploy_rsa ./.oq_package.enc | |
chmod 600 ./.deploy_rsa | |
eval $(ssh-agent -s) && ssh-add ./.deploy_rsa | |
rsync -e 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p '${PORT_TOUP}' ' -ax OpenQuake_Engine* ${USER_TOUP}@${IP_TOUP}:/mnt/windows_pkg/ |