diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75ed0d1..4ccd371 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 \ No newline at end of file diff --git a/README.md b/README.md index cc4c1a0..5a46e65 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/action.yml b/action.yml index b554512..42c9322 100644 --- a/action.yml +++ b/action.yml @@ -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/apt-deb-cache@v0.2.5 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