Skip to content

Ubuntu test of OpenQuake Engine #118

Ubuntu test of OpenQuake Engine

Ubuntu test of OpenQuake Engine #118

name: Ubuntu test of OpenQuake Engine
on:
workflow_dispatch:
inputs:
git-ref:
description: Git Ref
default: master
required: true
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled'
required: false
default: false
schedule:
- cron: "0 4 * * *"
jobs:
install_and_test:
runs-on: ubuntu-latest
env:
GITHUB_PULL_REQUEST: ${{ github.event.number }}
GITHUB_DEF_BR: ${{ github.event.repository.default_branch }}
GITHUB_REF: ${{ github.ref }}
GITHUB_HD_REF: ${{ github.head_ref }}
GITHUB_BS_REF: ${{ github.base_ref }}
#more $GITHUB_EVENT_PATH
strategy:
matrix:
python-version: [3.8, 3.9, "3.10"]
steps:
# This Checkout use git-ref keyword from dispatch
- name: Clone Repository (Master)
uses: actions/checkout@v2
if: github.event.inputs.git-ref == ''
- name: Clone Repository (Custom Ref)
uses: actions/checkout@v2
if: github.event.inputs.git-ref != ''
with:
ref: ${{ github.event.inputs.git-ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install engine with install script
env:
BRANCH: ${{ github.event.inputs.git-ref }}
run: |
#PY_VER=`echo py${{ matrix.python-version }} | tr -d .`
#echo $PY_VER
#https://pip.pypa.io/en/stable/user_guide/
export PIP_DEFAULT_TIMEOUT=100
#
pip3 install --default-timeout=100 -U pip wheel setuptools
#pip3 install -r requirements-$PY_VER-linux64.txt
#pip3 install -e .\[osgeo\]
echo "branch to test: ${BRANCH}"
if [[ "$BRANCH" != "" ]]
then
python install.py devel --version ${BRANCH}
else
python install.py devel
fi
- name: Setup debugging session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: Run tests
run: |
source ~/openquake/bin/activate
pip install pytest
oq dbserver start
cd ~/work/oq-engine/oq-engine
oq engine --run demos/risk/ClassicalDamage/job_hazard.ini
#
export MPLBACKEND=Agg
pytest -vsx --color=yes openquake/hazardlib/tests/gsim/kotha_2020_test.py
pytest -vsx --color=yes openquake/sep/tests/test_utils.py
pytest -vsx --color=yes openquake/sep
#
oq engine --run https://downloads.openquake.org/jobs/risk_test.zip