MacOS Monterey M1 #277
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: MacOS Monterey M1 | |
'on': | |
workflow_dispatch: | |
inputs: | |
git-ref: | |
description: Git Ref | |
default: master | |
required: true | |
schedule: | |
- cron: "15 12 * * *" | |
jobs: | |
install_and_test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [m1] | |
python-version: [3.9.13, "3.10.11"] | |
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 Python3 with installer from python.org | |
run: | | |
macpython_py_prefix=/Library/Frameworks/Python.framework/Versions | |
macpython_url=https://www.python.org/ftp/python | |
downloads_dir=/tmp | |
py_version=${{ matrix.python-version }} | |
py_inst=$py_version.pkg | |
inst_path=$downloads_dir/$py_inst | |
retval="" | |
# exit early on curl errors, but don't let it exit the shell | |
# https://www.python.org/ftp/python/3.9.13/python-3.9.13-macos11.pkg | |
macpy_download=$macpython_url/$py_version/python-$py_version-macos11.pkg | |
curl -f $macpy_download > $inst_path || retval=$? | |
if [ ${retval:-0} -ne 0 ]; then | |
echo "Python download failed! " | |
exit $retval | |
fi | |
# | |
sudo installer -pkg $inst_path -target / | |
py_mm=${py_version%.*} | |
python=$macpython_py_prefix/$py_mm/bin/python$py_mm | |
# Install certificates for Python | |
inst_cmd="/Applications/Python ${py_mm}/Install Certificates.command" | |
if [ -e "$inst_cmd" ]; then | |
sh "$inst_cmd" | |
fi | |
- name: Run Installation of oq-engine in devel mode | |
env: | |
BRANCH: ${{ github.event.inputs.git-ref }} | |
run: | | |
set -x | |
export PIP_DEFAULT_TIMEOUT=100 | |
macpython_py_prefix=/Library/Frameworks/Python.framework/Versions | |
py_version=${{ matrix.python-version }} | |
py_mm=${py_version%.*} | |
python=$macpython_py_prefix/$py_mm/bin/python$py_mm | |
$python -V | |
$python -m pip install -U pip wheel | |
# | |
echo "branch to test: ${BRANCH}" | |
if [[ "$BRANCH" != "" ]] | |
then | |
$python install.py devel --version ${BRANCH} | |
else | |
$python install.py devel | |
fi | |
- name: Run demos to test installation | |
run: | | |
source ~/openquake/bin/activate | |
pip3 install pytest | |
oq --version | |
oq dbserver start | |
sleep 10 | |
# test for engine | |
#pytest -vsx --color=yes /Users/runner/runner-isolation/actions-runner/_work/oq-engine/oq-engine/openquake/sep | |
# | |
#pytest -vsx --color=yes /Users/runner/runner-isolation/actions-runner/_work/oq-engine/oq-engine/openquake/hazardlib/tests/gsim/kotha_2020_test.py | |
# | |
#pytest -vsx --color=yes /Users/runner/runner-isolation/actions-runner/_work/oq-engine/oq-engine/openquake/calculators | |
# Run calcs | |
oq engine --run https://downloads.openquake.org/jobs/risk_test.zip | |
sleep 15 | |
oq engine --run /Users/runner/runner-isolation/actions-runner/_work/oq-engine/oq-engine/demos/hazard/AreaSourceClassicalPSHA/job.ini |