From deeaa07ab26f6a3cd368e28d334c88bd1980fa67 Mon Sep 17 00:00:00 2001 From: scivision Date: Wed, 5 Jun 2024 10:35:11 -0400 Subject: [PATCH] ci: use composite workflow --- .github/workflows/ci.yml | 45 +++---------------- .../workflows/composite-gemini3d/action.yml | 37 +++++++++++++++ .github/workflows/composite-pkg/action.yml | 21 +++++++++ 3 files changed, 63 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/composite-gemini3d/action.yml create mode 100644 .github/workflows/composite-pkg/action.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a75f658..2fb12d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ env: CMAKE_BUILD_TYPE: Release CMAKE_INSTALL_PREFIX: ~/libgem GEMINI_ROOT: ~/libgem + CMAKE_GENERATOR: Ninja HOMEBREW_NO_INSTALL_CLEANUP: 1 CMAKE_BUILD_PARALLEL_LEVEL: 4 @@ -75,50 +76,14 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Checkout GemGI (for simulation config.nml inputs) + - name: Git Checkout ${{ github.action_repository }} uses: actions/checkout@v4 - with: - repository: gemini3d/gemci - path: ${{ github.workspace }}/gemci - - - name: Install Prereqs (Linux) - if: runner.os == 'Linux' - run: | - sudo apt update - sudo apt install --no-install-recommends libopenmpi-dev openmpi-bin libhdf5-dev - - - name: Install Prereqs (Macos) - if: runner.os == 'macOS' - run: brew install open-mpi hdf5 scalapack - - - name: Cache install Gemini3D - id: cache-gemini - uses: actions/cache@v4 - with: - path: | - ${{ env.CMAKE_INSTALL_PREFIX }} - key: ${{ runner.os }}-gemini-${{ hashFiles('gemini3d/CMakeLists.txt') }} - # weak check that gemini3d has changed since last cache update - - name: Checkout Gemini3D - if: steps.cache-gemini.outputs.cache-hit != 'true' - uses: actions/checkout@v4 - with: - repository: gemini3d/gemini3d - path: gemini3d - submodules: true - - - name: non-cache Install Gemini3D - if: steps.cache-gemini.outputs.cache-hit != 'true' + - uses: ./.github/workflows/composite-pkg timeout-minutes: 15 - run: | - cmake -B build - cmake --build build - cmake --install build - working-directory: gemini3d - - name: Git Checkout ${{ github.action_repository }} - uses: actions/checkout@v4 + - uses: ./.github/workflows/composite-gemini3d + timeout-minutes: 15 - name: Install Python packages run: python -m pip install .[tests,plots] diff --git a/.github/workflows/composite-gemini3d/action.yml b/.github/workflows/composite-gemini3d/action.yml new file mode 100644 index 0000000..edad706 --- /dev/null +++ b/.github/workflows/composite-gemini3d/action.yml @@ -0,0 +1,37 @@ +runs: + + using: 'composite' + + steps: + + - name: Checkout GemGI (for simulation config.nml inputs) + uses: actions/checkout@v4 + with: + repository: gemini3d/gemci + path: ${{ github.workspace }}/gemci + + - name: Cache install Gemini3D + id: cache-gemini + uses: actions/cache@v4 + with: + path: | + ${{ env.CMAKE_INSTALL_PREFIX }} + key: ${{ runner.os }}-gemini-${{ hashFiles('gemini3d/CMakeLists.txt') }} + # weak check that gemini3d has changed since last cache update + + - name: Checkout Gemini3D + if: steps.cache-gemini.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + repository: gemini3d/gemini3d + path: gemini3d + submodules: true + + - name: non-cache Install Gemini3D + if: steps.cache-gemini.outputs.cache-hit != 'true' + shell: bash + run: | + cmake -B build + cmake --build build + cmake --install build + working-directory: gemini3d diff --git a/.github/workflows/composite-pkg/action.yml b/.github/workflows/composite-pkg/action.yml new file mode 100644 index 0000000..17753c0 --- /dev/null +++ b/.github/workflows/composite-pkg/action.yml @@ -0,0 +1,21 @@ +runs: + + using: 'composite' + + steps: + +# don't install libscalapack-openmpi-dev, it is broken CMake package + +# don't remove sudo apt update or every once in a while all the jobs will fail when the GA runner +# is out of sync with the upstream Ubuntu package repos + - name: Install packages (Linux) + shell: bash + if: runner.os == 'Linux' + run: | + sudo apt update + sudo apt install --no-install-recommends libopenmpi-dev openmpi-bin libhdf5-dev ninja-build liblapack-dev + + - name: Install packages (MacOS) + shell: bash + if: runner.os == 'macOS' + run: brew install ninja open-mpi hdf5 scalapack