Skip to content

Commit

Permalink
Merge Everest into ert
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide committed Sep 16, 2024
1 parent e143031 commit 7556552
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 46 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ jobs:
strategy:
fail-fast: false
matrix:
test-type: [ 'performance-tests', 'unit-tests', 'gui-tests', 'cli-tests' ]
test-type: [ 'integration-tests', 'unit-tests', 'gui-test' ]
python-version: [ '3.8', '3.11', '3.12' ]
os: [ ubuntu-latest ]
uses: ./.github/workflows/test_ert.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
test-type: ${{ matrix.test-type }}
secrets: inherit

test-slurm:
strategy:
Expand All @@ -53,14 +52,13 @@ jobs:
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
secrets: inherit

test-mac-for-tags:
if: github.ref_type == 'tag' # only test all variants for tags
strategy:
fail-fast: false
matrix:
test-type: [ 'performance-tests', 'unit-tests', 'gui-tests', 'cli-tests' ]
test-type: [ 'integration-tests', 'unit-tests', 'gui-test' ]
python-version: [ '3.8', '3.12' ]
os: [ 'macos-13', 'macos-14', 'macos-14-large']
exclude:
Expand All @@ -76,22 +74,20 @@ jobs:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
test-type: ${{ matrix.test-type }}
secrets: inherit

test-mac:
if: github.ref_type != 'tag' # one combination when not tag
strategy:
fail-fast: false
matrix:
test-type: [ 'performance-tests', 'unit-tests', 'gui-tests', 'cli-tests' ]
test-type: [ 'integration-tests', 'unit-tests', 'gui-test' ]
python-version: [ '3.12' ]
os: [ 'macos-latest' ]
uses: ./.github/workflows/test_ert.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
test-type: ${{ matrix.test-type }}
secrets: inherit

docs-ert:
name: Test ert docs
Expand Down Expand Up @@ -136,7 +132,7 @@ jobs:
- name: Test docs
run: |
sphinx-build -n -v -E -W ./docs ./tmp/ert_docs
sphinx-build -n -v -E -W ./docs/ert ./tmp/ert_docs
publish:
name: Publish to PyPI
Expand All @@ -160,4 +156,4 @@ jobs:
find artifacts -name "*.whl" -exec mv '{}' dist/ \;
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.10.1
uses: pypa/gh-action-pypi-publish@v1.8.11
79 changes: 79 additions & 0 deletions .github/workflows/mac-run-tests-build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: macos-run-tests-build-docs

on:
pull_request:
workflow_dispatch:
push:
branches:
- main
tags: "*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

env:
NO_PROJECT_RES: 1

jobs:
tests:
if: github.ref_type == 'tag' # only build for mac when tags
name: "py-${{ matrix.python-version }}_${{ matrix.test_type }}_${{ matrix.os }}"
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.12']
os: ['macos-13', 'macos-14', 'macos-14-large']
# https://github.com/actions/runner-images/tree/main?tab=readme-ov-file#available-images
exclude:
- os: 'macos-14'
python-version: '3.8'
- os: 'macos-14-large'
python-version: '3.8'
- os: 'macos-13'
python-version: '3.12'

test_type: ['doc', 'test', 'integration-test', 'everest-models-test']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
pyproject.toml
- name: Install HDF5 source files
run: brew install hdf5

- name: Install Everest and dependencies
run: |
pip install .[dev, everest]
- name: Run Tests
if: matrix.test_type == 'test'
run: |
python -m pytest tests/everest -n 4 -m "not ui_test and not integration_test and not fails_on_macos_github_workflow" --dist loadgroup
- name: Run Integration Tests
if: matrix.test_type == 'integration-test'
run: |
python -m pytest tests/everest -n 4 -m "integration_test and not fails_on_macos_github_workflow" --dist loadgroup
- name: Build Documentation
if: matrix.test_type == 'doc'
run: |
pip install git+https://github.com/equinor/everest-models.git
mkdir tmp
sphinx-build -n -v -E -W ./docs/everest/source ./tmp/everest_docs
- name: Run tests requiring everest-models
if: matrix.test_type == 'everest-models-test'
run: |
pip install git+https://github.com/equinor/everest-models.git
python -m pytest tests/everest -n 4 -m everest_models_test --dist loadgroup
71 changes: 71 additions & 0 deletions .github/workflows/run-tests-build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: run-tests-build-docs

on:
pull_request:
workflow_dispatch:
push:
branches:
- main
tags: "*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

env:
NO_PROJECT_RES: 1

jobs:
tests:
name: "py_${{ matrix.python-version }}_${{ matrix.test_type }}"
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.11', '3.12']
os: [ubuntu-22.04]
test_type: ['doc', 'ui-test', 'test', 'integration-test', 'everest-models-test']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install Everest and dependencies
run: |
pip install ".[dev,everest]"
- name: Run Tests
if: matrix.test_type == 'test'
run: |
pytest tests/everest -n 4 -m "not ui_test and not integration_test" --dist loadgroup -sv
- name: Run Integration Tests
if: matrix.test_type == 'integration-test'
run: |
pytest tests -n 4 -m "integration_test" --dist loadgroup
- name: Run UI Tests
if: matrix.test_type == 'ui-test'
env:
QT_QPA_PLATFORM: 'minimal'
run: |
python -m pytest tests/everest -m "ui_test"
- name: Build Documentation
if: matrix.test_type == 'doc'
run: |
pip install git+https://github.com/equinor/everest-models.git
mkdir tmp
sphinx-build -n -v -E -W ./docs/everest/source ./tmp/everest_docs
- name: Run tests requiring everest-models
if: matrix.test_type == 'everest-models-test'
run: |
pip install git+https://github.com/equinor/everest-models.git
python -m pytest tests -n 4 -m everest_models_test --dist loadgroup
42 changes: 7 additions & 35 deletions .github/workflows/test_ert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,55 +42,27 @@ jobs:
run: |
uv pip install ".[dev]"
- name: GUI Test
if: inputs.test-type == 'gui-tests'
- name: Test GUI
if: inputs.test-type == 'gui-test'
run: |
pytest --cov=ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -v --mpl --benchmark-disable tests/ui_tests/gui
- name: CLI Test
if: inputs.test-type == 'cli-tests'
run: |
pytest --cov=ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -n logical -v --benchmark-disable --dist loadgroup tests/ui_tests/cli
pytest tests --junit-xml=junit.xml -v --mpl -m "requires_window_manager" --benchmark-disable --ignore=tests/everest
- name: Unit Test
if: inputs.test-type == 'unit-tests'
run: |
pytest --cov=ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -n logical --show-capture=stderr -v --benchmark-disable --dist loadgroup tests/unit_tests
pytest --doctest-modules --cov=ert --cov-report=xml:cov2.xml src/ --ignore src/ert/dark_storage
pytest tests --junit-xml=junit.xml -n logical --show-capture=stderr -v -m "not integration_test and not requires_window_manager" --benchmark-disable --dist loadgroup --ignore=tests/everest
- name: Performance Test
if: inputs.test-type == 'performance-tests'
- name: Integration Test
if: inputs.test-type == 'integration-tests'
run: |
pytest --cov=ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -n logical --show-capture=stderr -v --benchmark-disable --dist loadgroup tests/performance_tests
pytest tests --junit-xml=junit.xml -n logical --show-capture=stderr -v -m "integration_test and not requires_window_manager" --benchmark-disable --ignore=tests/everest
- name: Test for a clean repository
run: |
# Run this before the 'Test CLI' entry below, which produces a few files that are accepted for now. Exclude the wheel.
git status --porcelain | sed '/ert.*.whl$\|\/block_storage$/d'
test -z "$(git status --porcelain | sed '/ert.*.whl$\\|\\/block_storage$/d')"
- name: Upload coverage to Codecov
id: codecov1
uses: codecov/codecov-action@v4
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: cov1.xml,cov2.xml
flags: ${{ inputs.test-type }}
- name: codecov retry sleep
if: steps.codecov1.outcome == 'failure'
run: |
sleep 30
- name: Codecov retry
uses: codecov/codecov-action@v4
if: steps.codecov1.outcome == 'failure'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: cov1.xml,cov2.xml
flags: ${{ inputs.test-type }}
fail_ci_if_error: ${{ github.ref == 'refs/heads/main' }}

- uses: test-summary/action@v2
continue-on-error: true
with:
Expand Down
4 changes: 2 additions & 2 deletions tests/everest/utils/test_pydantic_doc_generation.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import sys

import pytest
from everest.docs.generate_docs_from_config_spec import generate_docs_pydantic_to_rst

from everest.docs.generate_docs_from_config_spec import generate_docs_pydantic_to_rst
from tests.everest.utils import relpath


Expand All @@ -17,7 +17,7 @@ def test_generated_doc():
out of date. Run `python -m everest.docs` to re-generate.
"""

committed_file = relpath("..", "..", "docs", "source", "config_generated.rst")
committed_file = relpath("..", "..", "docs", "everest", "config_generated.rst")
with open(committed_file, "r", encoding="utf-8") as fp:
committed_text = fp.read()

Expand Down

0 comments on commit 7556552

Please sign in to comment.