Skip to content

MacOS Intel install and test #927

MacOS Intel install and test

MacOS Intel install and test #927

name: MacOS Intel install and test
"on":
workflow_dispatch:
inputs:
git-ref:
description: Git Ref
default: master
required: true
schedule:
- cron: "0 1 * * *"
push:
branches: [macos_test]
jobs:
install_and_test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13]
python-version: ["3.11", "3.12"]
steps:
# This Checkout use git-ref keyword from dispatch
- name: Clone Repository (Master)
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 }}
- name: Set up Python3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Run Installation of oq-engine in devel mode
env:
BRANCH: ${{ github.event.inputs.git-ref }}
run: |
export PIP_DEFAULT_TIMEOUT=100
pip3 install -U pip wheel setuptools
#
echo "branch to test: ${BRANCH}"
if [[ "$BRANCH" != "" ]]
then
python install.py devel --version ${BRANCH}
else
python install.py devel
fi
source ~/openquake/bin/activate
pip3 install pytest pyshp flake8
oq --version # makes numba compile, so dbserver start becomes quicker
oq dbserver start
sleep 10
- name: Run demos to test installation
run: |
set -x
source ~/openquake/bin/activate
oq info venv
oq info cfg
cd ~/work/oq-engine/oq-engine/demos
ls -lrt
# run demos with job_hazard.ini and job_risk.ini
for demo_dir in $(find . -type d | sort); do
if [ -f $demo_dir/job_hazard.ini ]; then
oq engine --run $demo_dir/job_hazard.ini --exports csv,hdf5
oq engine --run $demo_dir/job_risk.ini --exports csv,hdf5 --hc -1
fi
done
# run the other demos
for ini in $(find . -name job.ini | sort); do
oq engine --run $ini --exports csv,hdf5
done
- name: Run tests for calculators to test installation
if: always()
run: |
source ~/openquake/bin/activate
cd ~/work/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()
run: |
curl -O https://downloads.openquake.org/test_data/exposure.hdf5
source ~/openquake/bin/activate
cd ~/work/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()
run: |
source ~/openquake/bin/activate
cd ~/work/oq-engine/oq-engine
# -v 2 also logs the test names
OQ_APPLICATION_MODE=PUBLIC ./openquake/server/manage.py test -v 2 tests.test_public_mode
- name: Run tests for the engine server in read-only mode to test installation
if: always()
run: |
source ~/openquake/bin/activate
cd ~/work/oq-engine/oq-engine
# -v 2 also logs the test names
OQ_APPLICATION_MODE=READ_ONLY ./openquake/server/manage.py test -v 2 tests.test_read_only_mode
# NOTE: we shouldn't need to install the engine in AELO mode on mac
# - name: Run tests for the engine server in aelo mode to test installation
# if: always()
# run: |
# source ~/openquake/bin/activate
# cd ~/work/oq-engine/oq-engine
# -v 2 also logs the test names
# OQ_APPLICATION_MODE=AELO OQ_CONFIG_FILE=openquake/server/tests/data/openquake.cfg ./openquake/server/manage.py test -v 2 tests.test_aelo_mode