Skip to content

Windows amd64 full tests of OpenQuake Engine #1047

Windows amd64 full tests of OpenQuake Engine

Windows amd64 full tests of OpenQuake Engine #1047

Workflow file for this run

name: Windows amd64 full tests of OpenQuake Engine
on:
workflow_dispatch:
inputs:
git-ref:
description: Git Ref
default: master
required: true
schedule:
- cron: "0 */12 * * *" # At minute 0 past every 12th hour
jobs:
install_oq:
runs-on: ${{ matrix.os }}
env:
GITHUB_PULL_REQUEST: ${{ github.event.number }}
GITHUB_DEF_BR: ${{ github.event.repository.default_branch }}
GITHUB_REF: ${{ github.ref }}
GITHUB_HEAD_REF: ${{ github.head_ref }}
GITHUB_BASE_REF: ${{ github.base_ref }}
BRANCH: ${{ github.event.inputs.git-ref }}
FROM_FORK: ${{ github.event.pull_request.head.repo.fork }}
strategy:
matrix:
#os: [windows-2022, windows-2025]
os: [windows-2022]
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Check out the codebase.
uses: actions/checkout@v4
# This Checkout use git-ref keyword from dispatch
- name: Clone Repository (Master or PR)
uses: actions/checkout@v4
if: github.event.inputs.git-ref == ''
with:
ref: ${{ github.head_ref }}
- name: Clone Repository (Custom Ref)
uses: actions/checkout@v4
if: github.event.inputs.git-ref != ''
with:
ref: ${{ github.event.inputs.git-ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# You can test your matrix by printing the current Python version
- name: Display Python version and check OS, after install OQ and test
env:
BRANCH: ${{ github.event.inputs.git-ref }}
GITHUB_HEAD_REF: ${{ github.head_ref }}
run: |
$need_to_run = 0
@"
import sys
import platform
py_version = ".".join(map(str, sys.version_info[:2]))
os_version = platform.platform(terse=True)
if py_version == "3.12" and os_version == "Windows-2019Server" :
print (1)
"@ | Tee-Object -FilePath "check.py" -Append
$need_to_run = python check.py
echo "to_run=$need_to_run" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Write-Host "Check value: $need_to_run"
if ($need_to_run -eq 1) {
Write-Host "We do not support this OS and python3.12"
exit 0
}
else
{
echo "${Env:environment}"
Write-Host $Env:GITHUB_REF
echo "Branch environment"
Write-Host $Env:BRANCH
set PIP_DEFAULT_TIMEOUT=100
python -m pip install pip --upgrade
#echo Branch to test %BRANCH%
#if %BRANCH%=="" (python install.py devel) else (python install.py devel --version %BRANCH%)
write-Host "Branch to test $($Env:BRANCH)"
#
if ($Env:BRANCH)
{
Write-Host "Install with workflow_dispatch"
Write-Host "python install.py devel --version ${env:BRANCH}"
python install.py devel --version ${env:BRANCH}
}
else
{
Write-Host "Install on user mode on scheduled task"
Write-Host "python install.py devel --version master"
python install.py devel --version master
}
C:\Users\runneradmin\openquake\Scripts\activate.ps1
python -m pip install pytest pyshp flake8
}
- name: Test importing pyproj and hazardlib in both orders, to check the pyproj wheel
if: always() && env.to_run == 0
run: |
C:\Users\runneradmin\openquake\Scripts\activate.ps1
cd D:\a\oq-engine\oq-engine\openquake
pytest baselib/tests/pyproj_wheel_test.py
pytest hazardlib/tests/pyproj_wheel_test.py
- name: Run oq calcs, webui console and curl for the standalone tools
timeout-minutes: 5
if: always() && env.to_run == 0
run: |
C:\Users\runneradmin\openquake\Scripts\activate.ps1
oq.exe --version
ping 127.0.0.1 -n 3 > null
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
do {
Write-Host "waiting..."
sleep 2
} until(Test-NetConnection 127.0.0.1 -Port 8800 | ? { $_.TcpTestSucceeded } )
Get-Job
Write-Host "Test webui and tools Web pages"
ping 127.0.0.1 -n 6 > null
Write-Host "curl.exe -I --fail -G http://127.0.0.1:8800/engine"
curl.exe -I --fail -G http://127.0.0.1:8800/engine
ping 127.0.0.1 -n 6 > null
Write-Host "curl.exe -X HEAD -I --fail http://127.0.0.1:8800/ipt/"
curl.exe -X HEAD -I --fail http://127.0.0.1:8800/ipt/
ping 127.0.0.1 -n 6 > null
Write-Host "curl.exe -X HEAD -I --fail http://127.0.0.1:8800/taxonomy/"
curl.exe -X HEAD -I --fail http://127.0.0.1:8800/taxonomy/
ping 127.0.0.1 -n 6 > null
- name: Run tests for calculators
if: always() && env.to_run == 0
run: |
C:\Users\runneradmin\openquake\Scripts\activate.ps1
oq --version
Start-Job -ScriptBlock{& 'C:\Users\runneradmin\openquake\Scripts\oq.exe' engine --upgrade-db}
cd D:\a\oq-engine\oq-engine
pytest --doctest-modules --disable-warnings --color=yes --durations=10 openquake/calculators
- name: Run tests for hazardlib, sep, commands, engine, hmtk, risklib, commonlib and baselib to test installation
if: always() && env.to_run == 0
run: |
C:\Users\runneradmin\openquake\Scripts\activate.ps1
oq --version
Start-Job -ScriptBlock{& 'C:\Users\runneradmin\openquake\Scripts\oq.exe' engine --upgrade-db}
sleep 10
cd D:\a\oq-engine\oq-engine\openquake
pytest --doctest-modules --disable-warnings --color=yes --durations=10 hazardlib sep commands engine hmtk risklib commonlib baselib
- name: Run tests for the engine server in public mode to test installation
if: always() && env.to_run == 0
run: |
C:\Users\runneradmin\openquake\Scripts\activate.ps1
oq --version
Start-Job -ScriptBlock{& 'C:\Users\runneradmin\openquake\Scripts\oq.exe' engine --upgrade-db}
sleep 10
cd D:\a\oq-engine\oq-engine
$Env:OQ_APPLICATION_MODE='PUBLIC'
python -m pip install https://wheelhouse.openquake.org/v3/py/pytest_django-4.9.0-py3-none-any.whl
pytest -v openquake\server\tests\test_public_mode.py
- name: Run tests for the engine server in read-only mode to test installation
if: always() && env.to_run == 0
run: |
C:\Users\runneradmin\openquake\Scripts\activate.ps1
oq --version
Start-Job -ScriptBlock{& 'C:\Users\runneradmin\openquake\Scripts\oq.exe' engine --upgrade-db}
sleep 10
cd D:\a\oq-engine\oq-engine
$Env:OQ_APPLICATION_MODE='READ_ONLY'
python -m pip install https://wheelhouse.openquake.org/v3/py/pytest_django-4.9.0-py3-none-any.whl
pytest -v openquake\server\tests\test_read_only_mode.py
- name: Run all demos
if: always() && env.to_run == 0
run: |
C:\Users\runneradmin\openquake\Scripts\activate.ps1
oq --version
Start-Job -ScriptBlock{& 'C:\Users\runneradmin\openquake\Scripts\oq.exe' engine --upgrade-db}
Write-Host "Run all demos having only job.ini"
$iniFilePaths = Get-ChildItem D:\a\oq-engine\oq-engine\demos -Recurse -Filter job.ini
foreach($iniFilePath in $iniFilePaths) {
Write-Host "Run $($iniFilePath.FullName)"
oq engine --run $iniFilePath.FullName --exports csv,hdf5
}
Write-Host "Run all demos having only job_hazard.ini and job_risk.ini"
$demoDirs = Get-ChildItem D:\a\oq-engine\oq-engine\demos -Recurse -Directory
foreach($demoDir in $demoDirs) {
$jobHazardPaths = Get-ChildItem $demoDir -Filter job_hazard.ini
foreach($jobHazardPath in $jobHazardPaths) {
Write-Host "Run $($jobHazardPath.FullName)"
oq engine --run $jobHazardPath.FullName --exports csv,hdf5
$jobRiskPath = $demoDir.FullName + "\job_risk.ini"
Write-Host "Run $($jobRiskPath)"
oq engine --run $jobRiskPath --exports csv,hdf5 --hc -1
}
}