Skip to content

Build and test xtgeoviz #1177

Build and test xtgeoviz

Build and test xtgeoviz #1177

Workflow file for this run

name: Build and test xtgeoviz
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
schedule:
# Run nightly to check that tests are working with latest dependencies
- cron: "0 0 * * *"
permissions: {}
jobs:
test:
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
runs-on: [ubuntu-latest]
permissions:
contents: write # Write needed for docs
pull-requests: write
env:
MPLBACKEND: Agg
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Clone xtgeo-testdata
run: git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata
- name: Install
run: |
if [ "${{ github.event_name }}" = "schedule" ]; then
uv sync --all-extras --upgrade
else
uv sync --all-extras --frozen
fi
- name: Run tests
run: uv run pytest --disable-warnings
- name: Build documentation
if: ${{ always() }}
run: uv run sphinx-build -b html docs build/docs/html
- name: Update GitHub pages
if: github.repository_owner == 'equinor' && github.ref == 'refs/heads/main' && matrix.python-version == '3.11'
run: |
cp -R ./build/docs/html ../html
git checkout -- uv.lock
git config --local user.email "xtgeoviz-github-action"
git config --local user.name "xtgeoviz-github-action"
git fetch origin gh-pages
git checkout --track origin/gh-pages
git clean -f -f -d -x # Double -f is intentional
git rm -r *
cp -R ../html/* .
touch .nojekyll # If not, github pages ignores _* directories.
git add .
if git diff-index --quiet HEAD; then
echo "No changes in documentation. Skip documentation deploy."
else
git commit -m "Update Github Pages"
git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages
fi