From caad73e7794c9e0df559965a0b38187588cedc33 Mon Sep 17 00:00:00 2001 From: Marshall Ward Date: Tue, 2 Jan 2024 11:35:07 -0500 Subject: [PATCH] Enable GitHub Actions compilation testing This is a minimal GitHub Actions compilation test for MOM6-examples. It primarily only ensures that the model builds after a simple `make -j` command, without additional configuration. This can be expanded in the future to include other platforms, as well as actual model runs and parameter output testing. --- .github/actions/macos-setup/action.yml | 18 ++++++++++++++++++ .github/actions/ubuntu-setup/action.yml | 19 +++++++++++++++++++ .github/workflows/macos-compile.yml | 24 ++++++++++++++++++++++++ .github/workflows/ubuntu-compile.yml | 21 +++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 .github/actions/macos-setup/action.yml create mode 100644 .github/actions/ubuntu-setup/action.yml create mode 100644 .github/workflows/macos-compile.yml create mode 100644 .github/workflows/ubuntu-compile.yml diff --git a/.github/actions/macos-setup/action.yml b/.github/actions/macos-setup/action.yml new file mode 100644 index 000000000..fecbe787b --- /dev/null +++ b/.github/actions/macos-setup/action.yml @@ -0,0 +1,18 @@ +name: 'install-macos-prerequisites' + +description: 'Install prerequisites for Mac OS compilation' + +runs: + using: 'composite' + + steps: + - name: Install macOS packages + shell: bash + run: | + echo "::group::Install packages" + brew reinstall gcc + brew install automake + brew install netcdf + brew install netcdf-fortran + brew install mpich + echo "::endgroup::" diff --git a/.github/actions/ubuntu-setup/action.yml b/.github/actions/ubuntu-setup/action.yml new file mode 100644 index 000000000..3f3ba5f0b --- /dev/null +++ b/.github/actions/ubuntu-setup/action.yml @@ -0,0 +1,19 @@ +name: 'install-ubuntu-prerequisites' + +description: 'Install prerequisites for Ubuntu Linux compilation' + +runs: + using: 'composite' + steps: + - name: Install Ubuntu Linux packages + shell: bash + run: | + echo "::group::Install linux packages" + sudo apt-get update + sudo apt-get install netcdf-bin + sudo apt-get install libnetcdf-dev + sudo apt-get install libnetcdff-dev + sudo apt-get install openmpi-bin + sudo apt-get install libopenmpi-dev + sudo apt-get install linux-tools-common + echo "::endgroup::" diff --git a/.github/workflows/macos-compile.yml b/.github/workflows/macos-compile.yml new file mode 100644 index 000000000..16f47cfa5 --- /dev/null +++ b/.github/workflows/macos-compile.yml @@ -0,0 +1,24 @@ +name: MacOS Compilation Test + +on: [push, pull_request] + +jobs: + compile: + + runs-on: macOS-latest + + env: + CC: gcc + FC: gfortran + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - uses: ./.github/actions/macos-setup + + - name: Compile models + run: make -j + + # TODO: Run a few of the models and compare parameter.doc files? diff --git a/.github/workflows/ubuntu-compile.yml b/.github/workflows/ubuntu-compile.yml new file mode 100644 index 000000000..419a989cf --- /dev/null +++ b/.github/workflows/ubuntu-compile.yml @@ -0,0 +1,21 @@ +name: Compile test + +on: [push, pull_request] + +jobs: + compile: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - uses: ./.github/actions/ubuntu-setup + + # TODO: Split ocean-only and ice-ocean? + - name: Compile models + run: make -j + + # TODO: Run a few of the models and compare parameter.doc files?