diff --git a/.github/workflows/gnu.yml b/.github/workflows/gnu.yml index a063de01b8..706382e859 100644 --- a/.github/workflows/gnu.yml +++ b/.github/workflows/gnu.yml @@ -1,12 +1,18 @@ name: GNU Linux Build on: [push, pull_request] +# Cancel in-progress workflows when pushing to a branch +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + env: - cache_key: gnu4 + cache_key: gnu5 CC: gcc-10 FC: gfortran-10 CXX: g++-10 + # Split into a steup step, and a WW3 build step which # builds multiple switches in a matrix. The setup is run once and # the environment is cached so each build of WW3 can share the dependencies. @@ -16,6 +22,11 @@ jobs: runs-on: ubuntu-20.04 steps: + - name: checkout-ww3 + if: steps.cache-env.outputs.cache-hit != 'true' + uses: actions/checkout@v2 + with: + path: ww3 # Cache spack, OASIS, and compiler # No way to flush Action cache, so key may have # appended - name: cache-env @@ -26,13 +37,7 @@ jobs: spack ~/.spack work_oasis3-mct - key: spack-${{ runner.os }}-${{ env.cache_key }} - - - name: checkout-ww3 - if: steps.cache-env.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - path: ww3 + key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ww3/model/ci/spack.yaml') }} # Build WW3 spack environment - name: install-dependencies-with-spack @@ -83,7 +88,7 @@ jobs: spack ~/.spack work_oasis3-mct - key: spack-${{ runner.os }}-${{ env.cache_key }} + key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ww3/model/ci/spack.yaml') }} - name: build-ww3 run: | diff --git a/.github/workflows/intel.yml b/.github/workflows/intel.yml index ad944c1da6..1c63152a20 100644 --- a/.github/workflows/intel.yml +++ b/.github/workflows/intel.yml @@ -1,6 +1,11 @@ name: Intel Linux Build on: [push, pull_request] +# Cancel in-progress workflows when pushing to a branch +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + # Use custom shell with -l so .bash_profile is sourced which loads intel/oneapi/setvars.sh # without having to do it in manually every step defaults: @@ -9,7 +14,7 @@ defaults: # Set I_MPI_CC/F90 so Intel MPI wrapper uses icc/ifort instead of gcc/gfortran env: - cache_key: intel5 + cache_key: intel6 CC: icc FC: ifort CXX: icpc @@ -25,6 +30,13 @@ jobs: runs-on: ubuntu-latest steps: + + - name: checkout-ww3 + if: steps.cache-env.outputs.cache-hit != 'true' + uses: actions/checkout@v2 + with: + path: ww3 + # Cache spack, OASIS, and compiler # No way to flush Action cache, so key may have # appended - name: cache-env @@ -36,7 +48,7 @@ jobs: ~/.spack work_oasis3-mct /opt/intel - key: spack-${{ runner.os }}-${{ env.cache_key }} + key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ww3/model/ci/spack.yaml') }} - name: install-intel-compilers if: steps.cache-env.outputs.cache-hit != 'true' @@ -48,12 +60,6 @@ jobs: sudo apt-get install intel-oneapi-dev-utilities intel-oneapi-mpi-devel intel-oneapi-openmp intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bash_profile - - name: checkout-ww3 - if: steps.cache-env.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - path: ww3 - # Build WW3 spack environment - name: install-dependencies-with-spack if: steps.cache-env.outputs.cache-hit != 'true' @@ -108,7 +114,7 @@ jobs: ~/.spack work_oasis3-mct /opt/intel - key: spack-${{ runner.os }}-${{ env.cache_key }} + key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ww3/model/ci/spack.yaml') }} - name: build-ww3 run: |