Skip to content

Add pert distribution to gen_kw #830

Add pert distribution to gen_kw

Add pert distribution to gen_kw #830

name: Screenshot tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
contents: read
env:
UV_FROZEN: true
jobs:
test-screenshots:
name: Run screenshot tests
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: ./.github/actions/install_dependencies_qt
with:
os: ubuntu-latest
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
id: setup_python
with:
python-version: '3.14'
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
enable-cache: true
prune-cache: false
python-version: '3.14'
- name: Install ert
run: uv sync --group dev
- name: Fetch screenshot baselines from ert-testdata
run: uv run just fetch-screenshot-baselines
- name: Run screenshot tests
id: screenshot-tests
run: uv run just screenshot-comparison-test
continue-on-error: true
- name: Pack updated screenshots
if: steps.screenshot-tests.outcome == 'failure'
run: uv run just pack-updated-screenshots
- name: Fail on non-screenshot test failures
if: steps.screenshot-tests.outcome == 'failure'
run: |
if [ -z "$(find updated-screenshots -type f 2>/dev/null)" ]; then
echo "Screenshot tests failed, but no updated screenshots were produced."
echo "This indicates a failure unrelated to image diffs. Failing the job."
exit 1
fi
echo "Screenshot tests failed due to image diffs; updated screenshots were produced."
- name: Fail hard if screenshot fails on main branch
if: steps.screenshot-tests.outcome == 'failure' && github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
echo "Screenshot tests produced new/changed images after merge to main."
echo "This should not have happened and needs manual intervention."
echo "Maybe you forgot to merge a PR in ert-testdata?"
exit 1
- name: Prepare artifact
if: always()
run: |
mkdir -p artifact
echo '{"pr_number": ${{ github.event.number || 0 }}, "outcome": "${{ steps.screenshot-tests.outcome }}"}' > artifact/metadata.json
if [ -d updated-screenshots ]; then
cp -r updated-screenshots artifact/
fi
- name: Upload artifact
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: screenshot-results
path: artifact/