Skip to content

Update main.yml

Update main.yml #135

Workflow file for this run

name: pyGIMLi CI
on:
push:
branches:
- dev
pull_request:
branches:
- dev
jobs:
pgcore:
name: Building pgcore & bindings
runs-on:
group: self-hosted
labels: test-runner
steps:
- name: Clean-up
run: rm -rf ~/.cache/pygimli
- name: Getting pyGIMLi sources
uses: actions/checkout@v4
with:
fetch-depth: 0 # checks out all branches and tags
path: source
- name: Creating virtual environment for the build
run: |
python -m venv venv-build
source ./venv-build/bin/activate
pip install -U pip
# run once for the deps
pip install -e source/.[build]
pip uninstall pygimli
pip list
- name: Running cmake
run: |
source venv-build/bin/activate
mkdir -p build
cd build
CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake ../source
- name: Build libgimli
working-directory: build
run: |
source ../venv-build/bin/activate
make -j 8 gimli
- name: Build Python bindings
working-directory: build
run: |
source ../venv-build/bin/activate
make pygimli J=4
rm -f wheelhouse/pgcore*.whl # remove old wheels
make whlpgcore
# install the wheel to ensure copying all *.so
pip install wheelhouse/pgcore*.whl
rm -f wheelhouse/pygimli*.whl # remove old wheels
make whlpygimli
pip install wheelhouse/pygimli*.whl
- name: Test bindings
run: |
source venv-build/bin/activate
python -c 'import pygimli; print(pygimli.version())'
python -c 'import pygimli; print(pygimli.Report())'
pgtest:
name: Running tests
runs-on: self-hosted
needs: pgcore
env:
OPENBLAS_CORETYPE: "ARMV8" # current bug in OpenBlas core detection
steps:
- name: Creating virtual environment for tests
run: |
python -m venv venv-test
source venv-test/bin/activate
which python
pip install -U pip
pip install -e source/.[test]
pip install build/wheelhouse/pgcore*.whl
pip install build/wheelhouse/pygimli*.whl
- name: Run pg.test()
run: |
source venv-test/bin/activate
which python
python -c 'import pygimli; print(pygimli.version())'
python -c 'import pygimli; print(pygimli.Report())'
python -c 'import pygimli; pygimli.test(show=False, abort=True)'
docs:
name: Build website with examples
needs: pgtest
runs-on: self-hosted
env:
DISPLAY: ":99.0"
PYVISTA_OFF_SCREEN: True
OPENBLAS_CORETYPE: "ARMV8" # current bug in OpenBlas core detection
steps:
- name: Creating virtual environment for docs
run: |
source venv-test/bin/activate
pip install -e source/.[doc]
pip install build/wheelhouse/pgcore*.whl
pip install build/wheelhouse/pygimli*.whl
- name: Clean gallery
working-directory: build
run: |
source ../venv-test/bin/activate
make clean-gallery
- name: Running sphinx
working-directory: build
run: |
source ../venv-test/bin/activate
xvfb-run make doc # xvfb is necessary for headless display of pyvista plots
merging:
name: Automerging
runs-on: self-hosted
needs: docs
if: github.ref == 'refs/heads/dev' # Only merge from dev
steps:
- name: Merge dev -> master (with rebase)
working-directory: source
run: |
# Authorize with personal access token
echo "config"
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
echo "remote"
git remote set-url origin https://florian-wagner:${{ secrets.SECRET }}@github.com/gimli-org/gimli.git
# Make sure to be in sync with dev on remote
echo "status"
git status
echo "fetch"
git fetch
echo "clean"
git clean -ffdx
echo "reset"
git reset --hard HEAD
# Rebase and push to master
echo "stash"
git stash
echo "rebase"
git rebase origin/master
git push origin HEAD:master --force-with-lease
upload-html:
name: Upload HTML to dev.pygimli.org
runs-on: self-hosted
needs: docs
if: github.ref == 'refs/heads/dev' # Only merge from dev
steps:
- name: Uploading built html files
working-directory: build
run: rsync -avP --delete doc/html/ /var/www/html