From f2b6b79dd05f63eb60dfb502c369033762a6355f Mon Sep 17 00:00:00 2001 From: Brad Aagaard Date: Sat, 7 Nov 2026 15:54:27 -0700 Subject: [PATCH] ci: Add conda build to PR workflow. --- .github/configs/conda-ubuntu.yaml | 40 +++++++ .github/workflows/pr-conda.yaml | 102 ++++++++++++++++++ .../{ci-stage-1.yml => pr-stage-1.yaml} | 3 +- .../{ci-stage-2.yml => pr-stage-2.yaml} | 3 +- .../workflows/{ci-main.yml => pr-stages.yaml} | 7 +- 5 files changed, 151 insertions(+), 4 deletions(-) create mode 100644 .github/configs/conda-ubuntu.yaml create mode 100644 .github/workflows/pr-conda.yaml rename .github/workflows/{ci-stage-1.yml => pr-stage-1.yaml} (91%) rename .github/workflows/{ci-stage-2.yml => pr-stage-2.yaml} (93%) rename .github/workflows/{ci-main.yml => pr-stages.yaml} (54%) diff --git a/.github/configs/conda-ubuntu.yaml b/.github/configs/conda-ubuntu.yaml new file mode 100644 index 0000000..bbc1e9d --- /dev/null +++ b/.github/configs/conda-ubuntu.yaml @@ -0,0 +1,40 @@ +# ================================================================================================= +# This code is part of PyLith, developed through the Computational Infrastructure +# for Geodynamics (https://github.com/geodynamics/pylith). +# +# Copyright (c) 2010-2026 All rights reserved. +# +# See https://mit-license.org/ and LICENSE.md and for license information. +# ================================================================================================= +# micromamba environment for Ubuntu with the pylith build dependencies +name: ci-conda + +channels: + - conda-forge + +dependencies: + - gxx + - clang-format + - python + - python-gil + - libpython + - setuptools + - cmake + - autoconf + - automake + - libtool + - make + - lcov + - zlib + - swig + - catch2 + - cpptrace + - openmpi + - hdf5=1.14.6=mpi_openmpi* + - h5py=3.16.0=mpi_openmpi* + - netcdf4 + - proj + - proj-data + - pyyaml + +# End of file diff --git a/.github/workflows/pr-conda.yaml b/.github/workflows/pr-conda.yaml new file mode 100644 index 0000000..5d987f4 --- /dev/null +++ b/.github/workflows/pr-conda.yaml @@ -0,0 +1,102 @@ +name: pr-conda + +on: + - workflow_call + # and manually + - workflow_dispatch + +jobs: + # build and test the ref that launched this action against a conda-forge toolchain + tests: + name: ${{matrix.target}}-${{matrix.os}} + runs-on: ${{matrix.os}} + # a login shell so the micromamba environment is active in every step + defaults: + run: + shell: bash -el {0} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + target: [opt] + include: + - os: ubuntu-latest + environment-file: pythia/.github/configs/conda-ubuntu.yaml + toolchain: gcc gxx + cc: mpicc + cxx: mpicxx + - target: opt + cflags: -Wall -g -O3 + cxxflags: -Wall -g -O3 + env: + PRTE_MCA_rmaps_default_mapping_policy: ":oversubscribe" + OMPI_MCA_smsc: "^cma" + OMPI_MCA_pml: "ob1" + OMPI_MCA_btl: "self,sm,tcp" + OMPI_MCA_btl_tcp_if_include: "lo" + + steps: + - name: checkout pythia + uses: actions/checkout@v7 + with: + fetch-depth: 0 + path: pythia + submodules: recursive + + - name: conda-forge environment + uses: mamba-org/setup-micromamba@v3 + with: + micromamba-version: latest + environment-file: ${{matrix.environment-file}} + # conda-forge only, with strict priority so nothing leaks in from defaults + condarc: | + channels: + - conda-forge + channel_priority: strict + create-args: >- + ${{matrix.toolchain}} + + - name: versions + run: | + echo " -- conda prefix" + echo "${CONDA_PREFIX}" + echo " -- make" + make --version + echo " -- C compiler" + ${{matrix.cc}} --version + echo " -- C++ compiler" + ${{matrix.cxx}} --version + echo " -- python" + python3 --version + echo " -- prefix" + python3-config --prefix + echo " -- includes" + python3-config --includes + echo " -- libs" + python3-config --libs + echo " -- platform tag from python" + python3 -c "import sys; print(sys.platform)" + echo " -- distribution tag from python" + python3 -c "import platform as p; v = p.mac_ver()[0]; print(f'macOS {v}' if v else p.freedesktop_os_release()['PRETTY_NAME'])" + + - name: build pythia + run: | + echo " -- switching to the pythia source directory" + cd pythia + autoreconf --install --verbose --force + echo " -- creating build directory" + mkdir ../pythia-build && cd ../pythia-build + echo " -- configure pythia" + ../pythia/configure --enable-testing --without-build-isolation --prefix=${CONDA_PREFIX} CC=${{ matrix.cc }} CXX=${{ matrix.cxx }} CFLAGS="${{matrix.cflags}}" CXXFLAGS="${{matrix.cxxflags}}" + echo " -- building pythia into the conda prefix" + make -j$(nproc) install + + - name: test pythia + run: | + echo " -- switching to the pythia build directory" + cd pythia-build + echo " -- running pythia tests" + make -j$(nproc) check + + +# end of file diff --git a/.github/workflows/ci-stage-1.yml b/.github/workflows/pr-stage-1.yaml similarity index 91% rename from .github/workflows/ci-stage-1.yml rename to .github/workflows/pr-stage-1.yaml index 99e5354..a3e1edd 100644 --- a/.github/workflows/ci-stage-1.yml +++ b/.github/workflows/pr-stage-1.yaml @@ -16,9 +16,10 @@ jobs: - debian-stable runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Checkout pythia uses: actions/checkout@v7 with: + fetch-depth: 0 submodules: recursive - name: Build Docker image diff --git a/.github/workflows/ci-stage-2.yml b/.github/workflows/pr-stage-2.yaml similarity index 93% rename from .github/workflows/ci-stage-2.yml rename to .github/workflows/pr-stage-2.yaml index 1f13761..420b938 100644 --- a/.github/workflows/ci-stage-2.yml +++ b/.github/workflows/pr-stage-2.yaml @@ -26,9 +26,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Checkout pythia uses: actions/checkout@v7 with: + fetch-depth: 0 submodules: recursive - name: Build Docker image diff --git a/.github/workflows/ci-main.yml b/.github/workflows/pr-stages.yaml similarity index 54% rename from .github/workflows/ci-main.yml rename to .github/workflows/pr-stages.yaml index 96a78d5..8602116 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/pr-stages.yaml @@ -11,7 +11,10 @@ on: jobs: stage-1: - uses: ./.github/workflows/ci-stage-1.yml + uses: ./.github/workflows/pr-stage-1.yaml stage-2: - uses: ./.github/workflows/ci-stage-2.yml + uses: ./.github/workflows/pr-stage-2.yaml + needs: [stage-1] + conda: + uses: ./.github/workflows/pr-conda.yaml needs: [stage-1]