Merge pull request #9026 from gem/sigma #3510
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: demos | |
on: | |
workflow_dispatch: | |
inputs: | |
git-ref: | |
description: Git Ref | |
default: master | |
required: true | |
oq-release: | |
description: 'OQ Release' | |
required: true | |
default: 'latest' | |
type: choice | |
options: | |
- latest | |
- LTS | |
- dev | |
push: | |
branches: [ master ] | |
jobs: | |
demos: | |
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 }} | |
steps: | |
- name: Check out the codebase (Master) | |
if: github.event.inputs.git-ref == '' | |
uses: actions/checkout@v2 | |
- name: Check out the codebase (Custom Ref) | |
if: github.event.inputs.git-ref != '' | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.git-ref }} | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Upgrade pip and install requirements | |
run: | | |
pip install -U pip | |
pip install -r ./requirements-py38-linux64.txt | |
pip install pydata-sphinx-theme | |
- name: Install oq engine | |
run: | | |
pip install -e .[dev] | |
python3 -c "import openquake.baselib as m; print(m.__version__.rpartition('.')[0])" | |
- name: Run demos and upload to ci.openquake.org if not workflow_dispatch | |
if: github.event.inputs.git-ref == '' | |
shell: bash | |
env: | |
DOCS_SSH: ${{ secrets.DOCS_ARTIFACTS }} | |
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 }} | |
run: | | |
zip -q -r /tmp/demos.zip demos/ | |
OQ_DISTRIBUTE=zmq bin/run-demos.sh demos/ | |
oq dump /tmp/oqdata.zip | |
oq restore /tmp/oqdata.zip /tmp/oqdata | |
helpers/zipdemos.sh $(pwd)/demos | |
echo " Check if this is a pull request or not" | |
if [ -z "$GITHUB_HD_REF" ] | |
then | |
echo " Is not a pull request, use branch: $GITHUB_DEF_BR" | |
GITHUB_BR=`echo ${{ github.event.repository.default_branch }}` | |
else | |
echo " Is a pull request, use branch: $GITHUB_HD_BR" | |
GITHUB_BR=`echo ${{ github.head_ref }}` | |
fi | |
echo "BRANCH set to $GITHUB_BR" | |
gpg --quiet --batch --yes --decrypt --passphrase="$DOCS_SSH" --output ./.deploy_rsa ./.deploy_docs.enc | |
chmod 600 ./.deploy_rsa | |
eval $(ssh-agent -s) && ssh-add ./.deploy_rsa | |
set -x | |
scp -v -o ConnectTimeout=120 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null /tmp/demos.zip [email protected]:/var/www/artifacts.openquake.org/travis/demos-${GITHUB_BR}.zip | |
scp -v -o ConnectTimeout=120 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null /tmp/oqdata.zip [email protected]:/var/www/artifacts.openquake.org/travis/oqdata-${GITHUB_BR}.zip | |
set +x |