diff --git a/.github/build-ci/data/standard.json b/.github/build-ci/data/standard.json new file mode 100644 index 000000000..3aa9594d9 --- /dev/null +++ b/.github/build-ci/data/standard.json @@ -0,0 +1,6 @@ +{ + "gcc_compiler": "gcc@13.2.0", + "intel_compiler": "intel@2021.10.0", + "oneapi_compiler": "oneapi@2025.2.0", + "target": "x86_64" +} diff --git a/.github/build-ci/manifests/gcc-no-access3.spack.yaml.j2 b/.github/build-ci/manifests/gcc-no-access3.spack.yaml.j2 new file mode 100644 index 000000000..efdb30782 --- /dev/null +++ b/.github/build-ci/manifests/gcc-no-access3.spack.yaml.j2 @@ -0,0 +1,10 @@ +spack: + specs: + - access-cice @git.{{ ref }} ~access3 io_type=PIO + packages: + all: + require: + - '%{{ gcc_compiler }} target={{ target}}' + concretizer: + unify: false + view: false diff --git a/.github/build-ci/manifests/intel-access3.spack.yaml.j2 b/.github/build-ci/manifests/intel-access3.spack.yaml.j2 new file mode 100644 index 000000000..aabde6b97 --- /dev/null +++ b/.github/build-ci/manifests/intel-access3.spack.yaml.j2 @@ -0,0 +1,13 @@ +spack: + specs: + - access-cice @git.{{ ref }} +access3 io_type=PIO + packages: + access3-share: + require: + - '@2025.03.2:' #needs https://github.com/ACCESS-NRI/access3-share/pull/9 to work on github runner + all: + require: + - '%{{ intel_compiler }} target={{ target }}' + concretizer: + unify: false + view: false diff --git a/.github/build-ci/manifests/intel-no-access3.spack.yaml.j2 b/.github/build-ci/manifests/intel-no-access3.spack.yaml.j2 new file mode 100644 index 000000000..3bb5a6f42 --- /dev/null +++ b/.github/build-ci/manifests/intel-no-access3.spack.yaml.j2 @@ -0,0 +1,12 @@ +spack: + specs: + - access-cice @git.{{ ref }} ~access3 io_type=PIO + - access-cice @git.{{ ref }} ~access3 io_type=NetCDF + - access-cice @git.{{ ref }} ~access3 io_type=Binary + packages: + all: + require: + - '%{{ intel_compiler }} target={{ target }}' + concretizer: + unify: false + view: false diff --git a/.github/build-ci/manifests/oneapi-access3.spack.yaml.j2 b/.github/build-ci/manifests/oneapi-access3.spack.yaml.j2 new file mode 100644 index 000000000..51674c80b --- /dev/null +++ b/.github/build-ci/manifests/oneapi-access3.spack.yaml.j2 @@ -0,0 +1,17 @@ +spack: + specs: + - access-cice @git.{{ ref }} +access3 io_type=PIO build_type=Debug + - access-cice @git.{{ ref }} +access3 io_type=PIO + packages: + access3-share: + require: + - '@2025.03.2:' #needs https://github.com/ACCESS-NRI/access3-share/pull/9 to work on github runner + gcc-runtime: + require: + - '%gcc target={{ target }}' + all: + require: + - '%{{ oneapi_compiler }} target={{ target }}' + concretizer: + unify: false + view: false diff --git a/.github/build-ci/manifests/oneapi-no-access3.spack.yaml.j2 b/.github/build-ci/manifests/oneapi-no-access3.spack.yaml.j2 new file mode 100644 index 000000000..dfe967b29 --- /dev/null +++ b/.github/build-ci/manifests/oneapi-no-access3.spack.yaml.j2 @@ -0,0 +1,16 @@ +spack: + specs: + - access-cice @git.{{ ref }} ~access3 io_type=PIO +openmp + - access-cice @git.{{ ref }} ~access3 io_type=PIO + - access-cice @git.{{ ref }} ~access3 io_type=NetCDF + - access-cice @git.{{ ref }} ~access3 io_type=Binary + packages: + gcc-runtime: + require: + - '%gcc target={{ target }}' + all: + require: + - '%{{ oneapi_compiler }} target={{ target }}' + concretizer: + unify: false + view: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..e9eaae839 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: Build +on: + pull_request: + push: + branches: + - main + - CICE6.* +jobs: + pre-ci: + name: Pre-CI + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v4 + + - name: Set up matrix + id: set-matrix + # Find all relevant files under .github/build-ci/manifests + # then output them as a JSON array (minus the last comma) + run: | + files=$(find .github/build-ci/manifests/ -iname '*.j2' -printf '"%p",') + echo "matrix=[${files%,}]" >> $GITHUB_OUTPUT + + ci: + name: CI + needs: pre-ci + strategy: + fail-fast: false + max-parallel: 5 + matrix: + file: ${{ fromJson(needs.pre-ci.outputs.matrix) }} + uses: access-nri/build-ci/.github/workflows/ci.yml@v2 + with: + spack-manifest-path: ${{ matrix.file }} + allow-ssh-into-spack-install: false # If true, PR author must ssh into instance to complete job + spack-manifest-data-path: .github/build-ci/data/standard.json + spack-packages-ref: 498242a86ca5db015403ef80fc0161e44d41223c + # spack-config-ref: main + # spack-ref: main diff --git a/configuration/scripts/cmake/CMakeLists.txt b/configuration/scripts/cmake/CMakeLists.txt index 0f4930678..7d5b18423 100644 --- a/configuration/scripts/cmake/CMakeLists.txt +++ b/configuration/scripts/cmake/CMakeLists.txt @@ -102,7 +102,7 @@ if(CICE_ACCESS3) message(FATAL_ERROR "ESMF interface missing from Access3Share package") endif() else() - find_package(MPI REQUIRED) + find_package(MPI REQUIRED COMPONENTS Fortran) endif() if(CICE_OPENMP) @@ -130,9 +130,11 @@ set(CICE_CORE "${CMAKE_SOURCE_DIR}/../../../cicecore") set(ICEPACK "${CMAKE_SOURCE_DIR}/../../../icepack") add_fortran_library(cicelib mod STATIC) +target_compile_definitions(cicelib PRIVATE FORTRANUNDERSCORE) +target_link_libraries(cicelib PUBLIC MPI::MPI_Fortran) if(CICE_IO MATCHES "^(NetCDF|PIO)$") - target_compile_definitions(cicelib PRIVATE FORTRANUNDERSCORE ncdf) + target_compile_definitions(cicelib PRIVATE ncdf) target_compile_definitions(cicelib PRIVATE USE_NETCDF) endif() if(CICE_ACCESS3)