Skip to content

Commit

Permalink
Merge pull request #12 from gerlero/container
Browse files Browse the repository at this point in the history
Support running inside a container
gerlero authored Aug 14, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 7ab067d + 41ffe4c commit a698338
Showing 3 changed files with 140 additions and 9 deletions.
100 changes: 99 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ on:
workflow_dispatch:

jobs:
ci:
bare:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -135,3 +135,101 @@ jobs:
openfoam${{ matrix.openfoam-version }} -help
- name: Regression test
run: source $WM_DIR/scripts/AllwmakeParseArguments

container:
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
openfoam-version:
- 2406
- 2312
- 2306
- 2212
- 2206
- 2112
- 2106
- 2012
- 2006
- 12
- 11
- 10
- 9
- 8
- 7
container:
- ubuntu:24.04
- ubuntu:22.04
- ubuntu:20.04
- debian:bookworm
- debian:bullseye
exclude:
- container: ubuntu:24.04
openfoam-version: 2306
- container: ubuntu:24.04
openfoam-version: 2212
- container: ubuntu:24.04
openfoam-version: 2206
- container: ubuntu:24.04
openfoam-version: 2112
- container: ubuntu:24.04
openfoam-version: 2106
- container: ubuntu:24.04
openfoam-version: 2012
- container: ubuntu:24.04
openfoam-version: 2006
- container: ubuntu:24.04
openfoam-version: 10
- container: ubuntu:24.04
openfoam-version: 9
- container: ubuntu:24.04
openfoam-version: 8
- container: ubuntu:24.04
openfoam-version: 7
- container: ubuntu:22.04
openfoam-version: 8
- container: ubuntu:22.04
openfoam-version: 7
- container: debian:bookworm
openfoam-version: 2012
- container: debian:bookworm
openfoam-version: 12
- container: debian:bookworm
openfoam-version: 11
- container: debian:bookworm
openfoam-version: 10
- container: debian:bookworm
openfoam-version: 9
- container: debian:bookworm
openfoam-version: 8
- container: debian:bookworm
openfoam-version: 7
- container: debian:bullseye
openfoam-version: 12
- container: debian:bullseye
openfoam-version: 11
- container: debian:bullseye
openfoam-version: 10
- container: debian:bullseye
openfoam-version: 9
- container: debian:bullseye
openfoam-version: 8
- container: debian:bullseye
openfoam-version: 7
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up OpenFOAM
uses: ./
with:
openfoam-version: ${{ matrix.openfoam-version }}
- name: Run icoFoam -help
run: icoFoam -help
- name: Test shell session
if: matrix.openfoam-version >= 1000
run: |
openfoam -help
openfoam${{ matrix.openfoam-version }} -help
- name: Regression test
run: . $WM_DIR/scripts/AllwmakeParseArguments
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -27,4 +27,16 @@ steps:

- **`macos-14`**, **`macos-13`**, **`macos-12`**: 2406, 2312, 2306, 2212, 2206, 2112 (via [OpenFOAM.app](https://github.com/gerlero/openfoam-app))

- Windows, Docker: not supported
- [Docker `container`](https://docs.github.com/en/actions/writing-workflows/choosing-where-your-workflow-runs/running-jobs-in-a-container) based on:

- `ubuntu:24.04`: 2406, 2312 (openfoam.com), 12, 11 (openfoam.org)

- `ubuntu:22.04`: 2406, 2312, 2306, 2212, 2206, 2112, 2106, 2012, 2006 (openfoam.com), 12, 11, 10, 9 (openfoam.org)

- `ubuntu:20.04`: 2406, 2312, 2306, 2212, 2206, 2112, 2106, 2012, 2006 (openfoam.com), 12, 11, 10, 9, 8, 7 (openfoam.org)

- `debian:bookworm`: 2406, 2312, 2306, 2212, 2206, 2112, 2106, 2006 (openfoam.com)

- `debian:bullseye`: 2406, 2312, 2306, 2212, 2206, 2112, 2106, 2012, 2006 (openfoam.com)

- Windows: not supported
35 changes: 28 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
@@ -19,27 +19,48 @@ runs:
echo "openfoam-bashrc=/Applications/OpenFOAM-v${{ inputs.openfoam-version }}.app/Contents/Resources/etc/bashrc" >> "$GITHUB_OUTPUT"
echo "openfoam-shell=/Applications/OpenFOAM-v${{ inputs.openfoam-version }}.app/Contents/Resources/etc/openfoam" >> "$GITHUB_OUTPUT"
elif [ ${{ inputs.openfoam-version }} -lt 1000 ]; then
sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key > /etc/apt/trusted.gpg.d/openfoam.asc"
sudo add-apt-repository http://dl.openfoam.org/ubuntu
sudo apt update
export DEBIAN_FRONTEND=noninteractive
if [ $(id -u) -eq 0 ]; then
apt-get install -y wget software-properties-common || apt update && apt-get install -y wget software-properties-common
sh -c "wget -O - https://dl.openfoam.org/gpg.key > /etc/apt/trusted.gpg.d/openfoam.asc"
add-apt-repository http://dl.openfoam.org/ubuntu
apt update
else
sudo apt-get install -y wget software-properties-common || sudo apt update && sudo apt-get install -y wget software-properties-common
sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key > /etc/apt/trusted.gpg.d/openfoam.asc"
sudo add-apt-repository http://dl.openfoam.org/ubuntu
sudo apt update
fi
echo "apt-package=openfoam${{ inputs.openfoam-version }}" >> $GITHUB_OUTPUT
echo "openfoam-bashrc=/opt/openfoam${{ inputs.openfoam-version }}/etc/bashrc" >> "$GITHUB_OUTPUT"
else
curl -s https://dl.openfoam.com/add-debian-repo.sh | sudo bash
export DEBIAN_FRONTEND=noninteractive
if [ $(id -u) -eq 0 ]; then
sudo apt-get install -y curl || apt update && apt-get install -y curl
curl -s https://dl.openfoam.com/add-debian-repo.sh | bash
else
sudo apt-get install -y curl || sudo apt update && sudo apt-get install -y curl
curl -s https://dl.openfoam.com/add-debian-repo.sh | sudo bash
fi
echo "apt-package=openfoam${{ inputs.openfoam-version }}-default" >> "$GITHUB_OUTPUT"
echo "openfoam-bashrc=/usr/lib/openfoam/openfoam${{ inputs.openfoam-version }}/etc/bashrc" >> "$GITHUB_OUTPUT"
echo "openfoam-shell=/usr/lib/openfoam/openfoam${{ inputs.openfoam-version }}/etc/openfoam" >> "$GITHUB_OUTPUT"
fi
shell: bash
- name: Install OpenFOAM on Linux (with caching)
if: steps.prep.outputs.apt-package && inputs.cache
if: steps.prep.outputs.apt-package && inputs.cache && !job.container
uses: eth-pkg/[email protected]
with:
packages: ${{ steps.prep.outputs.apt-package }}
- name: Install OpenFOAM on Linux (without caching)
if: steps.prep.outputs.apt-package && !inputs.cache
if: steps.prep.outputs.apt-package && (!inputs.cache || job.container)
run: |
sudo apt-get install -y ${{ steps.prep.outputs.apt-package }}
export DEBIAN_FRONTEND=noninteractive
if [ $(id -u) -eq 0 ]; then
apt-get install -y ${{ steps.prep.outputs.apt-package }}
else
sudo apt-get install -y ${{ steps.prep.outputs.apt-package }}
fi
shell: bash
- name: Get OS version
if: runner.os == 'macOS' && inputs.cache

0 comments on commit a698338

Please sign in to comment.