From fa8a71d86db4762bd76e59e1ad0c8a561dad8858 Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 20 Mar 2024 22:00:07 +0100 Subject: [PATCH] Various documentation and CI updates (#325) --- .github/workflows/build-custom.yml | 31 ++++++++++--------- .github/workflows/build.yml | 13 ++++---- .github/workflows/check-links.yml | 14 --------- .github/workflows/install-openfoam.sh | 6 ++-- .../{check-style.yml => pre-commit.yml} | 2 +- .github/workflows/system-tests.yaml | 2 +- .pre-commit-config.yaml | 5 +++ README.md | 10 ++---- docs/get.md | 3 +- docs/openfoam-support.md | 8 ++--- 10 files changed, 42 insertions(+), 52 deletions(-) delete mode 100644 .github/workflows/check-links.yml rename .github/workflows/{check-style.yml => pre-commit.yml} (95%) diff --git a/.github/workflows/build-custom.yml b/.github/workflows/build-custom.yml index 28f406cf..eec2d4ed 100644 --- a/.github/workflows/build-custom.yml +++ b/.github/workflows/build-custom.yml @@ -20,6 +20,7 @@ on: required: true type: choice options: + - OpenFOAMv2312 - OpenFOAMv2306 - OpenFOAMv2212 - OpenFOAMv2206 @@ -36,7 +37,7 @@ on: - OpenFOAM5 versionpreCICE: description: 'Version of preCICE to build with' - default: '2.5.0' + default: 'v3.0.0' required: true runTutorialHeatedPlate: description: Run tutorial flow-over-heated-plate @@ -77,10 +78,18 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.refAdapter }} + - name: Install preCICE (no cache) + uses: precice/setup-precice-action@main + with: + precice-version: ${{ github.event.inputs.versionpreCICE }} - name: Install OpenFOAM (no cache) id: installOpenFOAM run: | case "${{ github.event.inputs.versionOpenFOAM }}" in + OpenFOAMv2312) + wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash + sudo apt-get install openfoam2312-dev + echo "{openfoam_exec}={/usr/bin/openfoam2312}" >> $GITHUB_OUTPUT;; OpenFOAMv2306) wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash sudo apt-get install openfoam2306-dev @@ -155,23 +164,15 @@ jobs: echo "I cannot find ${{ github.event.inputs.refAdapter }} in my known options." exit 1;; esac - - name: Install preCICE (no cache) + - name: Sanity check run: | - if [ "${{ github.event.inputs.virtualEnvironment }}" == "ubuntu-22.04" ] - then - wget "https://github.com/precice/precice/releases/download/v${{ github.event.inputs.versionpreCICE }}/libprecice2_${{ github.event.inputs.versionpreCICE }}_jammy.deb" - sudo apt install "./libprecice2_${{ github.event.inputs.versionpreCICE }}_jammy.deb" - elif [ "${{ github.event.inputs.virtualEnvironment }}" == "ubuntu-20.04" ] - then - wget "https://github.com/precice/precice/releases/download/v${{ github.event.inputs.versionpreCICE }}/libprecice2_${{ github.event.inputs.versionpreCICE }}_focal.deb" - sudo apt install "./libprecice2_${{ github.event.inputs.versionpreCICE }}_focal.deb" - elif [ "${{ github.event.inputs.virtualEnvironment }}" == "ubuntu-18.04" ] - then - wget "https://github.com/precice/precice/releases/download/v${{ github.event.inputs.versionpreCICE }}/libprecice2_${{ github.event.inputs.versionpreCICE }}_bionic.deb" - sudo apt install "./libprecice2_${{ github.event.inputs.versionpreCICE }}_bionic.deb" - fi + ls /usr/bin/openfoam* || echo "No /usr/bin/openfoam* directories." + ls /opt/openfoam* || echo "No /opt/openfoam* directories." + echo "GitHub Actions step output openfoam_exec:" + echo ${{steps.installOpenFOAM.outputs.openfoam_exec}} - name: Build OpenFOAM-preCICE adapter run: | + echo "OpenFOAM environment: ${{steps.installOpenFOAM.outputs.openfoam_exec}}" ${{steps.installOpenFOAM.outputs.openfoam_exec}} ./Allwmake - name: Get tutorials run: | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac7c2cce..5b6b5927 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build with OpenFOAM v2306 +name: Build with OpenFOAM v2312 on: push: branches-ignore: @@ -21,9 +21,14 @@ on: jobs: build: runs-on: ubuntu-22.04 + container: precice/precice:nightly steps: - name: Check out repository uses: actions/checkout@v4 + - name: Install action dependencies + run: | + apt-get update -qq + apt-get install -qq sudo wget - name: Setup caches uses: actions/cache@v4 id: cache-id @@ -38,9 +43,5 @@ jobs: cache: ${{ runner.temp }}/cache-directory snapshot: '/' exclude: '/boot /data /dev /mnt /proc /run /sys' - - name: Install preCICE - uses: precice/setup-precice-action@main - with: - precice-version: develop - name: Build OpenFOAM-preCICE adapter - run: /usr/bin/openfoam2306 ./Allwmake + run: /usr/bin/openfoam2312 ./Allwmake diff --git a/.github/workflows/check-links.yml b/.github/workflows/check-links.yml deleted file mode 100644 index 86870258..00000000 --- a/.github/workflows/check-links.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Check links (manual) -on: workflow_dispatch -jobs: - check_links: - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v4 - - name: Check links in markdown files (markdown-link-check) - uses: gaurav-nelson/github-action-markdown-link-check@v1 - with: - use-quiet-mode: 'yes' - use-verbose-mode: 'no' - config-file: '.markdown-link-check-config.json' diff --git a/.github/workflows/install-openfoam.sh b/.github/workflows/install-openfoam.sh index 99788a3f..3b132427 100755 --- a/.github/workflows/install-openfoam.sh +++ b/.github/workflows/install-openfoam.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -# Install OpenFOAM v2306 +# Install OpenFOAM v2312 wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash -sudo apt-get update -sudo apt-get install openfoam2306-dev +sudo apt-get update -y +sudo apt-get install -y openfoam2312-dev diff --git a/.github/workflows/check-style.yml b/.github/workflows/pre-commit.yml similarity index 95% rename from .github/workflows/check-style.yml rename to .github/workflows/pre-commit.yml index c7476502..f87390de 100644 --- a/.github/workflows/check-style.yml +++ b/.github/workflows/pre-commit.yml @@ -1,4 +1,4 @@ -name: Check code style +name: Pre-commit hook checks on: push: branches: diff --git a/.github/workflows/system-tests.yaml b/.github/workflows/system-tests.yaml index d72794aa..e6e6145f 100644 --- a/.github/workflows/system-tests.yaml +++ b/.github/workflows/system-tests.yaml @@ -24,6 +24,6 @@ jobs: uses: precice/tutorials/.github/workflows/run_testsuite_workflow.yml@develop with: suites: openfoam_adapter_pr - build_args: TUTORIALS_REF:${{ needs.gather-refs.outputs.reftutorials }},PRECICE_REF:v3.0.0,OPENFOAM_EXECUTABLE:openfoam2306,OPENFOAM_ADAPTER_REF:${{ github.event.pull_request.head.sha }} + build_args: TUTORIALS_REF:${{ needs.gather-refs.outputs.reftutorials }},PRECICE_REF:v3.0.0,OPENFOAM_EXECUTABLE:openfoam2312,OPENFOAM_ADAPTER_REF:${{ github.event.pull_request.head.sha }} systests_branch: develop loglevel: "DEBUG" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 51cd7ebc..f3554f66 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,3 +13,8 @@ repos: files: "^docs/.*.md" - id: markdownlint-fix files: "^docs/.*.md" +- repo: https://github.com/koalaman/shellcheck-precommit + rev: v0.10.0 + hooks: + - id: shellcheck + args: [ --external-sources, --exclude=SC1091 ] diff --git a/README.md b/README.md index d31a4de9..9d6c465e 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,9 @@ # OpenFOAM-preCICE adapter -[![Build with OpenFOAM v2306](https://github.com/precice/openfoam-adapter/actions/workflows/build.yml/badge.svg?branch=develop)](https://github.com/precice/openfoam-adapter/actions/workflows/build.yml) +[![Ask questions in the forum](https://img.shields.io/badge/community-discourse_forum-orange?link=https%3A%2F%2Fprecice.discourse.group%2F)](https://precice.discourse.group/) +[![Build with OpenFOAM v2312](https://github.com/precice/openfoam-adapter/actions/workflows/build.yml/badge.svg?branch=develop)](https://github.com/precice/openfoam-adapter/actions/workflows/build.yml) [![Changelog](https://img.shields.io/badge/Keep%20a%20Changelog--555.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmMTVkMzAiIHZpZXdCb3g9IjAgMCAxODcgMTg1Ij48cG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2IDUtMTAgOC0xNiAyMC0xOSAzN2E1NCA1NCAwIDAwNSAzNGM3IDE1IDIwIDIzIDM3IDIyIDIyLTEgMzgtOSA0OC0yNGE0MSA0MSAwIDAwOC0yNCA0MyA0MyAwIDAwLTEtMTJjLTYtMTgtMTYtMzEtMzItMzh6bS0yMyA5MWgtMWMtNyAwLTE0LTItMjEtN2EyNyAyNyAwIDAxLTEwLTEzIDU3IDU3IDAgMDEtNC0yMCA2MyA2MyAwIDAxNi0yNWM1LTEyIDEyLTE5IDI0LTIxIDktMyAxOC0yIDI3IDIgMTQgNiAyMyAxOCAyNyAzM3MtMiAzMS0xNiA0MGMtMTEgOC0yMSAxMS0zMiAxMXptMS0zNHYxNGgtOFY2OGg4djI4bDEwLTEwaDExbC0xNCAxNSAxNyAxOEg5NnoiLz48L3N2Zz4K)](https://github.com/precice/openfoam-adapter/blob/develop/CHANGELOG.md) - - GNU GPL license - - +[![License](https://img.shields.io/github/license/precice/openfoam-adapter.svg)](https://github.com/precice/openfoam-adapter/blob/master/LICENSE) ## Start here diff --git a/docs/get.md b/docs/get.md index b2fb53f9..5460106d 100644 --- a/docs/get.md +++ b/docs/get.md @@ -8,7 +8,8 @@ summary: "Get the code from GitHub and run ./Allwmake. If this fails, look into To build the adapter, you need to install a few dependencies and then execute the `Allwmake` script. 1. Install [a compatible OpenFOAM distribution](https://precice.org/adapter-openfoam-support.html). -2. Install [preCICE v3](https://precice.org/installation-overview.html). In case you need preCICE v2, please install an older version of the adapter (v1.2.3 is the latest release to support preCICE v2). +2. Install [preCICE v3](https://precice.org/installation-overview.html). + * In case you need preCICE v2, please install an older version of the adapter ([v1.2.3](https://github.com/precice/openfoam-adapter/releases/tag/v1.2.3) was the last release to support preCICE v2). 3. [Download the latest release](https://github.com/precice/openfoam-adapter/releases/latest) for your OpenFOAM version. 4. Execute the build script: `./Allwmake`. * See and adjust the configuration in the beginning of the script first, if needed. diff --git a/docs/openfoam-support.md b/docs/openfoam-support.md index 72868ff1..fb8fc0df 100644 --- a/docs/openfoam-support.md +++ b/docs/openfoam-support.md @@ -7,14 +7,14 @@ summary: Recent OpenFOAM.com versions work out-of-the-box. Recent OpenFOAM.org v ## How to get OpenFOAM -The easiest way to start is to get binary packages for your Linux distribution. For example, to [get OpenFOAM v2306 on Ubuntu](https://develop.openfoam.com/Development/openfoam/-/wikis/precompiled/debian#precompiled-packages-debianubuntu): +The easiest way to start is to get binary packages for your Linux distribution. For example, to [get OpenFOAM v2312 on Ubuntu](https://develop.openfoam.com/Development/openfoam/-/wikis/precompiled/debian#precompiled-packages-debianubuntu): ```bash # Add the signing key, add the repository, update: wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash -# Install OpenFOAM v2306: -sudo apt-get install openfoam2306-dev +# Install OpenFOAM v2312: +sudo apt-get install openfoam2312-dev ``` As these steps change your `.profile`, you need to log out and in again to make OpenFOAM fully discoverable. @@ -26,7 +26,7 @@ OpenFOAM is a project with long history and many forks, of which we try to suppo We provide version-specific [release archives](https://github.com/precice/openfoam-adapter/releases/latest) and respective Git branches for: - OpenCFD / ESI (openfoam.com) - main focus: - - [OpenFOAM v1812-v2306](https://github.com/precice/openfoam-adapter) or newer + - [OpenFOAM v1812-v2312](https://github.com/precice/openfoam-adapter) or newer - OpenFOAM v2212 and newer is only supported since v1.2.2 of the adapter. - [OpenFOAM v1612-v1806](https://github.com/precice/openfoam-adapter/tree/OpenFOAMv1806) (not tested) - OpenFOAM Foundation (openfoam.org) - secondary, consider experimental: