From e0b87da019c9934c2faebb710eb55a2f6b729030 Mon Sep 17 00:00:00 2001 From: David Landa Marban Date: Thu, 11 Jun 2026 08:53:20 +0200 Subject: [PATCH] Ubuntu, macOS, and Docker CI --- .github/workflows/ci_pycopm_docker.yml | 65 ++++++++++++++++++++++++++ .github/workflows/ci_pycopm_macos.yml | 59 +++++++++++++++++++++++ .github/workflows/ci_pycopm_ubuntu.yml | 10 ++-- CONTRIBUTING.md | 2 +- README.md | 3 +- docs/_sources/contributing.rst.txt | 2 +- docs/contributing.html | 2 +- docs/text/contributing.rst | 2 +- 8 files changed, 135 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/ci_pycopm_docker.yml create mode 100644 .github/workflows/ci_pycopm_macos.yml diff --git a/.github/workflows/ci_pycopm_docker.yml b/.github/workflows/ci_pycopm_docker.yml new file mode 100644 index 0000000..0ae29f7 --- /dev/null +++ b/.github/workflows/ci_pycopm_docker.yml @@ -0,0 +1,65 @@ +name: Docker + +on: + push: + branches: + - main + +jobs: + run-pycopm-docker: + permissions: + contents: read + pull-requests: write + timeout-minutes: 30 + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build Docker image + run: docker build -t test-image . + + - name: Run the hello world example in pycopm + run: | + docker run --rm \ + -u root \ + -v ${{ github.workspace }}:/workspace \ + -w /workspace \ + test-image \ + bash -c " + pycopm -i examples/decks/HELLO_WORLD.DATA \ + -c 5,5,1 -m all -o output + " + + - name: Check if the example run + run: | + file="${{ github.workspace }}/output/HELLO_WORLD_PYCOPM.EGRID" + if [ -f "$file" ]; then + echo "pycopm succeeded" + else + echo "pycopm failed" + exit 1 + fi + + - name: Run input.toml which uses ERT + run: | + docker run --rm \ + -u root \ + -v ${{ github.workspace }}:/workspace \ + -w /workspace \ + test-image \ + bash -c " + pycopm -i examples/configurations/drogon/input.toml \ + -o ert + " + + - name: Check if input.toml using ERT run + run: | + file="${{ github.workspace }}/ert/postprocessing/hm_missmatch.png" + if [ -f "$file" ]; then + echo "pycopm using ERT succeeded" + else + echo "pycopm using ERT failed" + exit 1 + fi diff --git a/.github/workflows/ci_pycopm_macos.yml b/.github/workflows/ci_pycopm_macos.yml new file mode 100644 index 0000000..5e7de65 --- /dev/null +++ b/.github/workflows/ci_pycopm_macos.yml @@ -0,0 +1,59 @@ +name: macOS + +on: + push: + branches: + - main + +jobs: + run-pycopm-macos: + permissions: + contents: read + pull-requests: write + timeout-minutes: 60 + runs-on: macos-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install OPM Flow + run: | + brew install cssr-tools/opm/opm-simulators + + - name: Install python requirements + run: | + python3 -m venv vpycopm + . vpycopm/bin/activate + echo "$PWD/vpycopm/bin" >> $GITHUB_PATH + pip install --upgrade pip setuptools wheel + pip install -e . + pip install -r dev-requirements.txt + + - name: Run the hello world example in pycopm + run: | + pycopm -i examples/decks/HELLO_WORLD.DATA -c 5,5,1 -m all -o output + + - name: Check if the example run + run: | + file="${{ github.workspace }}/output/HELLO_WORLD_PYCOPM.EGRID" + if [ -f "$file" ]; then + echo "pycopm succeeded" + else + echo "pycopm failed" + exit 1 + fi + + - name: Run input.toml which uses ERT + run: | + pycopm -i examples/configurations/drogon/input.toml -o ert + + - name: Check if input.toml using ERT run + run: | + file="${{ github.workspace }}/ert/postprocessing/hm_missmatch.png" + if [ -f "$file" ]; then + echo "pycopm using ERT succeeded" + else + echo "pycopm using ERT failed" + exit 1 + fi diff --git a/.github/workflows/ci_pycopm_ubuntu.yml b/.github/workflows/ci_pycopm_ubuntu.yml index 2fb29f5..d6e5e17 100644 --- a/.github/workflows/ci_pycopm_ubuntu.yml +++ b/.github/workflows/ci_pycopm_ubuntu.yml @@ -1,13 +1,13 @@ -name: Run pycopm in Ubuntu +name: Ubuntu on: - push: - branches: - - main pull_request: jobs: - run-pycopm-local: + run-pycopm-ubuntu: + permissions: + contents: read + pull-requests: write timeout-minutes: 30 runs-on: ubuntu-24.04 container: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3724b4e..32b4db8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,7 @@ Contributions are more than welcome using the fork and pull request approach 1. **pytest --cov=pycopm --cov-report term-missing --basetemp=test_outputs tests/ -n auto** (this runs locally the tests, and might rise issues that need to be fixed before the pull request) 1. **pycopm -i examples/decks/HELLO_WORLD.DATA -c 5,5,1 -m all -o output** (this runs the hello world example, which succeeds if the file output/HELLO_WORLD_PYCOPM.EGRID is created) 1. **pushd docs & make html** (this generates the documentation, and might rise issues that need to be fixed before the pull request; if the build succeeds and if the contribution changes the documentation, then copy all content from the docs/_build/html/ folder and replace the files in the [_docs_](https://github.com/cssr-tools/pycopm/tree/main/docs) folder) - * Tip for Linux users: See the [_ci_pycopm_ubuntu.yml_](https://github.com/cssr-tools/pycopm/blob/main/.github/workflows/ci_pycopm_ubuntu.yml) script and the [_Actions_](https://github.com/cssr-tools/pycopm/actions) for installation of pycopm, OPM Flow (binary packages), and dependencies, as well as the execution of the seven previous steps in Ubuntu 24.04 using Python 3.12. + * Tip for Linux users: See the [_ci_pycopm_ubuntu.yml_](https://github.com/cssr-tools/pycopm/blob/main/.github/workflows/ci_pycopm_ubuntu.yml) script and the [_Actions_](https://github.com/cssr-tools/pycopm/actions) for installation of pycopm, OPM Flow (binary packages), and dependencies, as well as the execution of the seven previous steps in Ubuntu 26.04 using Python 3.14. * Tip for macOS users: See the [_ci_pycopm_macos_.yml_](https://github.com/daavid00/OPM-Flow_macOS/blob/main/.github/workflows/ci_pycopm_macos.yml) script and the [_OPM-Flow_macOS Actions_](https://github.com/cssr-tools/pycopm/actions) for installation of pycopm, OPM Flow (source build), and dependencies, as well as running the tests and the hello world example in macOS 26 using Python3.14. Note that if you do not add the directory containing the OPM Flow executable to your system's PATH environment variable (e.g., export PATH=$PATH:/Users/yourname/pycopm/build/opm-simulators/bin), then you can pass this in the execution of the tests and pycopm using the flags **-f/--flow** (see [_ci_pycopm_macos.yml_](https://github.com/daavid00/OPM-Flow_macOS/blob/main/.github/workflows/ci_pycopm_macos.yml#L76)). 1. Squash your commits into a single commit (see this [_nice tutorial_](https://gist.github.com/lpranam/4ae996b0a4bc37448dc80356efbca7fa) if you are not familiar with this) 1. Push your commit and make a pull request diff --git a/README.md b/README.md index 12a39db..8cd53cd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Build Status](https://github.com/cssr-tools/pycopm/actions/workflows/ci_pycopm_ubuntu.yml/badge.svg)](https://github.com/cssr-tools/pycopm/actions/workflows/ci_pycopm_ubuntu.yml) -[![Build Status](https://github.com/daavid00/OPM-Flow_macOS/actions/workflows/ci_pycopm_macos.yml/badge.svg)](https://github.com/daavid00/OPM-Flow_macOS/actions/workflows/ci_pycopm_macos.yml) +[![Build Status](https://github.com/cssr-tools/pycopm/actions/workflows/ci_pycopm_macos.yml/badge.svg)](https://github.com/cssr-tools/pycopm/actions/workflows/ci_pycopm_macos.yml) +[![Build Status](https://github.com/cssr-tools/pycopm/actions/workflows/ci_pycopm_docker.yml/badge.svg)](https://github.com/cssr-tools/pycopm/actions/workflows/ci_pycopm_docker.yml) [![Code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) diff --git a/docs/_sources/contributing.rst.txt b/docs/_sources/contributing.rst.txt index 480e8bc..eb99da3 100644 --- a/docs/_sources/contributing.rst.txt +++ b/docs/_sources/contributing.rst.txt @@ -30,7 +30,7 @@ Contribute to the software #. **pushd docs & make html** (this generates the documentation, and might rise issues that need to be fixed before the pull request; if the build succeeds and if the contribution changes the documentation, then copy all content from the docs/_build/html/ folder and replace the files in the `docs `_ folder) .. tip:: - See the `ci_pycopm_ubuntu.yml `_ script and the `Actions `_ for installation of pycopm, OPM Flow (binary packages), and dependencies, as well as the execution of the seven previous steps in Ubuntu 24.04 using Python 3.12. + See the `ci_pycopm_ubuntu.yml `_ script and the `Actions `_ for installation of pycopm, OPM Flow (binary packages), and dependencies, as well as the execution of the seven previous steps in Ubuntu 26.04 using Python 3.14. For macOS users, see the `ci_pycopm_macos.yml `_ script and the `OPM-Flow_macOS Actions `_ for installation of pycopm, OPM Flow (source build), and dependencies, as well as running the tests and the hello world example in macOS 26 using Python3.14. Note that if you do not add the directory containing the OPM Flow executable to your system's PATH environment variable (e.g., export PATH=$PATH:/Users/yourname/pycopm/build/opm-simulators/bin), then you can pass this in the execution of the tests and pycopm using the flags **-f/--flow** (see `this script `_). diff --git a/docs/contributing.html b/docs/contributing.html index e16edd4..dd01102 100644 --- a/docs/contributing.html +++ b/docs/contributing.html @@ -117,7 +117,7 @@

Contribute to the software

Tip

-

See the ci_pycopm_ubuntu.yml script and the Actions for installation of pycopm, OPM Flow (binary packages), and dependencies, as well as the execution of the seven previous steps in Ubuntu 24.04 using Python 3.12. +

See the ci_pycopm_ubuntu.yml script and the Actions for installation of pycopm, OPM Flow (binary packages), and dependencies, as well as the execution of the seven previous steps in Ubuntu 26.04 using Python 3.14. For macOS users, see the ci_pycopm_macos.yml script and the OPM-Flow_macOS Actions for installation of pycopm, OPM Flow (source build), and dependencies, as well as running the tests and the hello world example in macOS 26 using Python3.14. Note that if you do not add the directory containing the OPM Flow executable to your system’s PATH environment variable (e.g., export PATH=$PATH:/Users/yourname/pycopm/build/opm-simulators/bin), then you can pass this in the execution of the tests and pycopm using the flags -f/--flow (see this script).

diff --git a/docs/text/contributing.rst b/docs/text/contributing.rst index 6430ec5..28628ef 100644 --- a/docs/text/contributing.rst +++ b/docs/text/contributing.rst @@ -30,7 +30,7 @@ Contribute to the software #. **pushd docs & make html** (this generates the documentation, and might rise issues that need to be fixed before the pull request; if the build succeeds and if the contribution changes the documentation, then copy all content from the docs/_build/html/ folder and replace the files in the `docs `_ folder) .. tip:: - See the `ci_pycopm_ubuntu.yml `_ script and the `Actions `_ for installation of pycopm, OPM Flow (binary packages), and dependencies, as well as the execution of the seven previous steps in Ubuntu 24.04 using Python 3.12. + See the `ci_pycopm_ubuntu.yml `_ script and the `Actions `_ for installation of pycopm, OPM Flow (binary packages), and dependencies, as well as the execution of the seven previous steps in Ubuntu 26.04 using Python 3.14. For macOS users, see the `ci_pycopm_macos.yml `_ script and the `OPM-Flow_macOS Actions `_ for installation of pycopm, OPM Flow (source build), and dependencies, as well as running the tests and the hello world example in macOS 26 using Python3.14. Note that if you do not add the directory containing the OPM Flow executable to your system's PATH environment variable (e.g., export PATH=$PATH:/Users/yourname/pycopm/build/opm-simulators/bin), then you can pass this in the execution of the tests and pycopm using the flags **-f/\-\-flow** (see `this script `_).