CLI repetition patch #616
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: metapackage-tests | |
on: | |
# On push, only run if any of the metapackage files has changed | |
push: | |
paths: | |
- 'src/*meta*.f90' | |
- 'src/fpm/*meta*.f90' | |
- 'src/fpm/manifest/*meta*.f90' | |
- 'src/ci/meta_tests.sh' | |
- 'src/.github/workflows/meta.yml' | |
# Always run on PR or release | |
pull_request: | |
release: | |
types: [published] | |
# Allow manual triggering | |
workflow_dispatch: | |
env: | |
CI: "ON" # We can detect this in the build system and other vendors implement it | |
HOMEBREW_NO_ANALYTICS: 1 # Make Homebrew installation a little quicker | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 1 | |
HOMEBREW_NO_GITHUB_API: 1 | |
HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
mpi: openmpi | |
release-flags: --flag ' -Wno-external-argument-mismatch' | |
- os: ubuntu-latest | |
mpi: mpich | |
release-flags: --flag ' -Wno-external-argument-mismatch' | |
- os: macos-13 | |
mpi: openmpi | |
release-flags: --flag ' -Wno-external-argument-mismatch' | |
- os: macos-13 | |
mpi: mpich | |
release-flags: --flag ' -Wno-external-argument-mismatch' | |
- os: ubuntu-latest | |
mpi: intel | |
intel_version: "2024.1.0" | |
release-flags: "" # override: no GCC flags | |
- os: ubuntu-latest | |
mpi: intel | |
intel_version: "2025.0" | |
release-flags: "" # override: no GCC flags | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: (Ubuntu) setup gcc version | |
if: contains(matrix.os,'ubuntu') | |
run: | | |
echo "GCC_V=14" >> $GITHUB_ENV | |
- name: (macOS) setup gcc version | |
if: contains(matrix.os,'macos') | |
run: | | |
echo "GCC_V=15" >> $GITHUB_ENV | |
- name: (Windows) Install MSYS2 | |
uses: msys2/setup-msys2@v2 | |
if: contains(matrix.os,'windows') && contains(matrix.mpi,'msmpi') | |
with: | |
msystem: MINGW64 | |
update: true | |
install: >- | |
git | |
base-devel | |
wget | |
unzip | |
curl | |
hdf5 | |
netcdf | |
netcdf-fortran | |
- name: (Ubuntu) Install gfortran | |
if: contains(matrix.os,'ubuntu') | |
run: | | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \ | |
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \ | |
--slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V} | |
- name: (Ubuntu) Install OpenMPI | |
if: contains(matrix.os,'ubuntu') && contains(matrix.mpi,'openmpi') | |
run: | | |
sudo apt-get update | |
sudo apt install -y -q openmpi-bin libopenmpi-dev hwloc fabric libhdf5-dev \ | |
libhdf5-fortran-102 libnetcdf-dev libnetcdff-dev libopenblas-dev | |
- name: (Ubuntu) Install MPICH | |
if: contains(matrix.os,'ubuntu') && contains(matrix.mpi,'mpich') | |
run: | | |
sudo apt-get update | |
sudo apt install -y -q mpich hwloc fabric libhdf5-dev libhdf5-fortran-102 \ | |
libnetcdf-dev libnetcdff-dev libopenblas-dev | |
# Intel | |
- name: Setup Intel Environment | |
if: contains(matrix.mpi, 'intel') | |
uses: ./.github/actions/setup-intel | |
with: | |
os: ${{ matrix.os }} | |
version: ${{ matrix.intel_version }} | |
- name: (Ubuntu) Build and Install HDF5 from source | |
if: contains(matrix.os, 'ubuntu') && contains(matrix.mpi, 'intel') | |
# Needs checkout if source code isn't available, adjust if needed | |
# Ensure compilers are available from the previous step's environment setup | |
shell: bash | |
run: | | |
# Source again just in case shell context is lost (shouldn't be, but safer) | |
source /opt/intel/oneapi/setvars.sh --force | |
# Download HDF5 | |
curl -O -L https://github.com/HDFGroup/hdf5/archive/refs/tags/snapshot-1.14.tar.gz | |
tar zxf snapshot-1.14.tar.gz | |
cd hdf5-snapshot-1.14 | |
# Configure HDF5 with Intel compilers | |
cmake -B build -DCMAKE_Fortran_COMPILER=ifx -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DHDF5_BUILD_FORTRAN=ON -DCMAKE_INSTALL_PREFIX=/usr | |
cd build | |
make -j $(nproc) | |
sudo make install | |
cd ../.. # Go back to workspace directory | |
rm -rf hdf5-snapshot-1.14 snapshot-1.14.tar.gz # Clean up | |
- name: (Ubuntu) Build and Install NetCDF-C from source | |
if: contains(matrix.os, 'ubuntu') && contains(matrix.mpi, 'intel') | |
shell: bash | |
run: | | |
source /opt/intel/oneapi/setvars.sh --force | |
# Download NetCDF-C | |
curl -L https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.9.2.tar.gz -o - | tar xz | |
cd netcdf-c-4.9.2 | |
# Configure NetCDF-C with Intel Compilers, referencing installed HDF5 | |
# Set CC/CXX/FC explicitly in environment for configure script | |
export CC=icx CXX=icpx FC=ifx | |
./configure --prefix=/usr --enable-netcdf-4 --with-hdf5=/usr | |
make -j $(nproc) | |
sudo make install | |
cd .. # Go back to workspace directory | |
rm -rf netcdf-c-4.9.2 # Clean up | |
- name: (Ubuntu) Build and Install NetCDF-Fortran from source | |
if: contains(matrix.os, 'ubuntu') && contains(matrix.mpi, 'intel') | |
shell: bash | |
run: | | |
source /opt/intel/oneapi/setvars.sh --force | |
# Download NetCDF-Fortran | |
curl -L https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.6.1.tar.gz -o - | tar xz | |
cd netcdf-fortran-4.6.1 | |
# Configure NetCDF-Fortran with Intel Compilers using CMake | |
cmake -B build -DCMAKE_Fortran_COMPILER=ifx -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DCMAKE_INSTALL_PREFIX=/usr | |
cd build | |
make -j $(nproc) | |
sudo make install | |
cd ../.. # Go back to workspace directory | |
rm -rf netcdf-fortran-4.6.1 # Clean up | |
- name: (Windows) Put MSYS2_MinGW64 on PATH | |
if: contains(matrix.os,'windows') && (!contains(matrix.mpi,'intel')) | |
# there is not yet an environment variable for this path from msys2/setup-msys2 | |
run: echo "${{ runner.temp }}/msys64/mingw64/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: (Windows) download MS-MPI setup (SDK is from MSYS2) | |
if: contains(matrix.os,'windows') && contains(matrix.mpi,'msmpi') | |
# run: curl -L -O https://github.com/microsoft/Microsoft-MPI/releases/download/v10.1.2/msmpisetup.exe 10.1.1 | |
run: curl -L -O https://download.microsoft.com/download/a/5/2/a5207ca5-1203-491a-8fb8-906fd68ae623/msmpisetup.exe # 10.1.2 | |
- name: (Windows) Install mpiexec.exe (-force needed to bypass GUI on headless) | |
if: contains(matrix.os,'windows') && contains(matrix.mpi,'msmpi') | |
run: .\msmpisetup.exe -unattend -force | |
- name: (Windows) test that mpiexec.exe exists | |
if: contains(matrix.os,'windows') && contains(matrix.mpi,'msmpi') | |
# can't use MSMPI_BIN as Actions doesn't update PATH from msmpisetup.exe | |
run: Test-Path "C:\Program Files\Microsoft MPI\Bin\mpiexec.exe" -PathType leaf | |
- name: (Windows) put MSMPI_BIN on PATH (where mpiexec is) | |
if: contains(matrix.os,'windows') && contains(matrix.mpi,'msmpi') | |
run: | | |
echo "C:\Program Files\Microsoft MPI\Bin\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "/c/Program Files/Microsoft MPI/Bin/" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "MSMPI_BIN=C:\Program Files\Microsoft MPI\Bin\" | Out-File -FilePath $env:GITHUB_ENV -Append | |
- name: (Windows) Install MSYS2 msmpi package | |
if: contains(matrix.os,'windows') && contains(matrix.mpi,'msmpi') | |
shell: msys2 {0} | |
run: pacman --noconfirm -S mingw-w64-x86_64-msmpi | |
- name: (macOS) Set up Homebrew | |
if: contains(matrix.os,'macos') | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: (macOS) Install Homebrew gfortran | |
if: contains(matrix.os, 'macos') | |
run: | | |
# Only install gcc if not already available | |
which gfortran-${{ env.GCC_V }} || brew install gcc@${{ env.GCC_V }} | |
which gfortran-${{ env.GCC_V }} | |
which gfortran || ln -s /usr/local/bin/gfortran-${{ env.GCC_V }} /usr/local/bin/gfortran | |
- name: (macOS) Install homebrew MPICH | |
if: contains(matrix.mpi,'mpich') && contains(matrix.os,'macos') | |
run: | | |
brew install mpich | |
- name: (macOS) Install homebrew OpenMPI | |
if: contains(matrix.mpi,'openmpi') && contains(matrix.os,'macos') | |
run: | | |
brew install openmpi | |
- name: (macOS) Install homebrew HDF5 | |
if: contains(matrix.os,'macos') | |
run: | | |
brew install hdf5 | |
- name: (macOS) Install homebrew NetCDF | |
if: contains(matrix.os,'macos') | |
run: | | |
brew install netcdf | |
brew install netcdf-fortran | |
- name: (macOS) Patch gfortran paths | |
if: contains(matrix.os,'macos') | |
run: | | |
# Backport gfortran shared libraries to version 10 folder. This is necessary because all macOS releases of fpm | |
# have these paths hardcoded in the executable (no PIC?). Current bootstrap version 0.8.0 has gcc-10 | |
mkdir /usr/local/opt/gcc@10 | |
mkdir /usr/local/opt/gcc@10/lib | |
mkdir /usr/local/opt/gcc@10/lib/gcc | |
mkdir /usr/local/opt/gcc@10/lib/gcc/10 | |
mkdir /usr/local/lib/gcc/10 | |
ln -fs /usr/local/opt/gcc@${{ env.GCC_V }}/lib/gcc/${{ env.GCC_V }}/libquadmath.0.dylib /usr/local/opt/gcc@10/lib/gcc/10/libquadmath.0.dylib | |
ln -fs /usr/local/opt/gcc@${{ env.GCC_V }}/lib/gcc/${{ env.GCC_V }}/libgfortran.5.dylib /usr/local/opt/gcc@10/lib/gcc/10/libgfortran.5.dylib | |
# Newer gcc versions use libgcc_s.1.1.dylib | |
ln -fs /usr/local/lib/gcc/${{ env.GCC_V }}/libgcc_s.1.dylib /usr/local/lib/gcc/10/libgcc_s.1.dylib || ln -fs /usr/local/lib/gcc/${{ env.GCC_V }}/libgcc_s.1.1.dylib /usr/local/lib/gcc/10/libgcc_s.1.dylib | |
# Phase 1: Bootstrap fpm with existing version | |
- name: Install fpm | |
uses: fortran-lang/setup-fpm@v7 | |
with: | |
fpm-version: 'v0.8.0' | |
- name: Remove fpm from path | |
shell: bash | |
run: | | |
mv $(which fpm) fpm-bootstrap${{ matrix.exe }} | |
echo "BOOTSTRAP=$PWD/fpm-bootstrap" >> $GITHUB_ENV | |
- name: (macOS/Ubuntu) Use gcc/g++ instead of Clang for C/C++ / ifx to build fpm | |
if: contains(matrix.os,'macOS') || contains(matrix.os,'ubuntu') | |
shell: bash | |
run: | | |
echo "FPM_FC=gfortran-${{ env.GCC_V }}" >> $GITHUB_ENV | |
echo "FPM_CC=gcc-${{ env.GCC_V }}" >> $GITHUB_ENV | |
echo "FPM_CXX=g++-${{ env.GCC_V }}" >> $GITHUB_ENV | |
- name: Build Fortran fpm (bootstrap) | |
shell: bash | |
run: | | |
${{ env.BOOTSTRAP }} build | |
- name: Run Fortran fpm (bootstrap) | |
shell: bash | |
run: | | |
${{ env.BOOTSTRAP }} run | |
${{ env.BOOTSTRAP }} run -- --version | |
${{ env.BOOTSTRAP }} run -- --help | |
- name: Test Fortran fpm (bootstrap) | |
if: (!contains(matrix.mpi,'intel')) | |
shell: bash | |
run: | | |
${{ env.BOOTSTRAP }} test ${{ matrix.release-flags }} | |
- name: Install Fortran fpm (bootstrap) | |
shell: bash | |
run: | | |
${{ env.BOOTSTRAP }} install | |
# Phase 2: Bootstrap fpm with itself | |
- name: Replace bootstrapping version | |
shell: bash | |
run: | | |
${{ env.BOOTSTRAP }} run --runner cp -- fpm-debug${{ matrix.exe }} | |
rm -v ${{ env.BOOTSTRAP }} | |
echo "FPM=$PWD/fpm-debug" >> $GITHUB_ENV | |
- name: Get version (normal) | |
if: github.event_name != 'release' | |
shell: bash | |
run: | | |
VERSION=$(git rev-parse --short HEAD) | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Get version (release) | |
if: github.event_name == 'release' | |
shell: bash | |
run: | | |
VERSION=$(echo ${{ github.ref }} | cut -dv -f2) | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
FPM_VERSION=$(${{ env.FPM }} --version | grep -o '${{ env.REGEX }}') | |
[ "$VERSION" = "$FPM_VERSION" ] | |
env: | |
REGEX: '[0-9]\{1,4\}\.[0-9]\{1,4\}\.[0-9]\{1,4\}' | |
- name: Build Fortran fpm | |
shell: bash | |
run: | | |
${{ env.FPM }} build ${{ matrix.release-flags }} | |
- name: Run Fortran fpm | |
shell: bash | |
run: | | |
${{ env.FPM }} run ${{ matrix.release-flags }} | |
${{ env.FPM }} run ${{ matrix.release-flags }} -- --version | |
${{ env.FPM }} run ${{ matrix.release-flags }} -- --help | |
- name: Install Fortran fpm | |
shell: bash | |
run: | | |
${{ env.FPM }} install ${{ matrix.release-flags }} | |
- name: Package release version | |
shell: bash | |
run: | | |
${{ env.FPM }} run ${{ matrix.release-flags }} --runner cp -- ${{ env.EXE }} | |
rm -v ${{ env.FPM }} | |
echo "FPM_RELEASE=${{ env.EXE }}" >> $GITHUB_ENV | |
env: | |
EXE: fpm-${{ env.VERSION }}-${{ matrix.os-arch }}${{ matrix.exe }} | |
- name: Use Intel compiler for the metapackage tests | |
if: contains(matrix.mpi,'intel') | |
shell: bash | |
run: | | |
echo "FPM_FC=ifx" >> $GITHUB_ENV | |
echo "FPM_CC=icx" >> $GITHUB_ENV | |
echo "FPM_CXX=icpx" >> $GITHUB_ENV | |
- name: Run metapackage tests using the release version | |
shell: bash | |
run: | | |
ci/meta_tests.sh "$PWD/${{ env.FPM_RELEASE }}" |