Skip to content

Merge pull request #153 from issp-center-dev/mpi4py_run #48

Merge pull request #153 from issp-center-dev/mpi4py_run

Merge pull request #153 from issp-center-dev/mpi4py_run #48

Workflow file for this run

name: Run examples
on:
push:
branches:
- master
- develop
- deploy_examples_dcorelib # test branch
- '**-autodoc'
- '!gh-pages'
tags: '*'
jobs:
run-examples:
runs-on: ubuntu-latest
steps:
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- name: Checkout
uses: actions/checkout@v4
with:
path: main
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
- name: Run examples
run: |
cd ${GITHUB_WORKSPACE}/main/
export LOCAL_UID=$(id -u $USER)
export LOCAL_GID=$(id -g $USER)
echo "LOCAL_UID=${LOCAL_UID}" > .env
echo "LOCAL_GID=${LOCAL_GID}" >> .env
docker compose up -d examples
# Manually execute entrypoint script until the environmet is set up correctly
docker exec examples-container bash -c '/entrypoint-examples.sh'
docker exec examples-container bash -c 'cd examples; ls -l'
docker exec examples-container bash -c 'source /env-examples.sh; cd examples; DCORE_TRIQS_COMPAT=1 gosu user sh run_ci.sh'
- name: Deploy Configuration
run: |
mkdir ~/.ssh
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
echo "${{ secrets.GH_ACTIONS_DEPLOY_KEY }}" > ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
- name: Push
env:
GIT_USER: "DCore Developers"
GIT_EMAIL: "[email protected]"
REF_SLUG: ${{ env.GITHUB_REF_SLUG }}
run: |
cd ${GITHUB_WORKSPACE}
echo ${GITHUB_WORKSPACE}
feature_branch=${REF_SLUG%-autodoc}
if [ "_${REF_SLUG}" != "_${feature_branch}" ]; then
TARGET_NAME=${feature_branch}
else
TARGET_NAME=${REF_SLUG}
fi
rm -rf "gh-pages/examples_results_dcorelib/${TARGET_NAME}"
docker cp examples-container:/var/dcoretest/examples examples_results_dcorelib
cd examples_results_dcorelib
find . -name "*.eps" -or -name "*.ini" -or -name "*.png" | xargs -I@ install -D @ "${GITHUB_WORKSPACE}/gh-pages/examples_results_dcorelib/${TARGET_NAME}/"@
cd ${GITHUB_WORKSPACE}/gh-pages
git config --local user.name "${GIT_USER}"
git config --local user.email "${GIT_EMAIL}"
git remote set-url origin [email protected]:${GITHUB_REPOSITORY}.git
git pull
git add examples_results_dcorelib/${TARGET_NAME}
if git commit -m "Deploy docs to ${TARGET_NAME} by GitHub Actions triggered by ${GITHUB_SHA}"
then
git push origin gh-pages
else
echo "Nothing to deploy"
fi
- run: echo "This job's status is ${{ job.status }}."