Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI #17

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @tclune
22 changes: 22 additions & 0 deletions .github/workflows/changelog-enforcer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Enforce Changelog"
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]

jobs:
# Enforces the update of a changelog file on every pull request
changelog:
runs-on: ubuntu-latest
steps:
- uses: dangoslen/changelog-enforcer@v3
with:
changeLogPath: 'ChangeLog.md'
skipLabels: 'skip changelog'
missingUpdateErrorMessage: >
No update to ChangeLog.md found! Please add a changelog
entry to it describing your change. Please note that the
keepachangelog (https://keepachangelog.com) format is
used. If your change is very trivial not applicable for a
changelog entry, add a 'skip changelog' label to the pull
request to skip the changelog enforcer.

246 changes: 246 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
name: CI Tests

on:
pull_request:
types: [opened, synchronize, reopened]
# Do not run if the only files changed cannot affect the build
paths-ignore:
- "**.md"
- "**.MD"
- "LICENCE"
- "COPYRIGHT"

jobs:
#GNU:
#runs-on: ${{ matrix.os }}
#strategy:
#matrix:
#os: [ubuntu-22.04, ubuntu-24.04, macos-13, macos-14]
#compiler: [gfortran-11, gfortran-12, gfortran-13]
## gfortran-10 is only on ubuntu-22.04
## gfortran-14 is available on ubuntu-24.04
#include:
#- os: ubuntu-22.04
#compiler: gfortran-10
#- os: ubuntu-24.04
#compiler: gfortran-14
#exclude:
#- os: ubuntu-24.04
#compiler: gfortran-11
#- os: ubuntu-22.04
#compiler: gfortran-13

## fail-fast if set to 'true' here is good for production, but when
## debugging, set to 'false'. fail-fast means if *any* ci test in the matrix fails
## GitHub Actions will stop any other test immediately. So good for production, bad
## when trying to figure something out. For more info see:
## https://www.edwardthomson.com/blog/github_actions_6_fail_fast_matrix_workflows.html

#fail-fast: false
#env:
#FC: ${{ matrix.compiler }}
#LANGUAGE: en_US.UTF-8
#LC_ALL: en_US.UTF-8
#LANG: en_US.UTF-8
#LC_TYPE: en_US.UTF-8
#OMPI_ALLOW_RUN_AS_ROOT: 1
#OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
#OMPI_MCA_btl_vader_single_copy_mechanism: none

#name: ${{ matrix.os }} / ${{ matrix.compiler }}
#steps:
#- name: Compiler Versions
#run: |
#${FC} --version
#cmake --version

#- name: Checkout
#uses: actions/checkout@v4
#with:
#fetch-depth: 1
#submodules: true

#- name: Set all directories as git safe
#run: |
#git config --global --add safe.directory '*'

#- name: Cache MPI
#id: cache-mpi
#uses: actions/cache@v4
#with:
#path: ~/local/openmpi
#key: mpi-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}

#- name: Build MPI
#if: steps.cache-mpi.outputs.cache-hit != 'true'
#run: |
#sh ${GITHUB_WORKSPACE}/tools/ci-install-mpi.sh openmpi 5.0.2

#- name: Set MPI Environment
#run: |
#echo "${HOME}/local/openmpi/bin" >> $GITHUB_PATH
#echo "LD_LIBRARY_PATH=${HOME}/local/openmpi/lib" >> $GITHUB_ENV
#echo "DYLD_LIBRARY_PATH=${HOME}/local/openmpi/lib" >> $GITHUB_ENV

#- name: MPI Versions
#run: |
#${FC} --version
#mpirun --version
#mpifort --show

#- name: Build pFUnit
#run: |
#bash ./tools/ci-install-pfunit.bash

#- name: Build and Install Demos
#run: |
#cmake -B build -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_PREFIX_PATH=../install
#cmake --build build --parallel 4 --target install
#cmake -B build -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_PREFIX_PATH=../install
#cmake --build build --parallel 4 --target install

#- name: Build and Run Tests target
#run: |
#cmake --build build --parallel 4 --target build-tests
#cmake --build build --parallel 4 --target tests

#- name: Run Ctest
#run: ctest --test-dir build --parallel 1 --output-on-failure --repeat until-pass:4

#- name: Archive log files on failure
#uses: actions/upload-artifact@v4
#if: failure()
#with:
#name: logfiles
#path: |
#build/**/*.log

Intel:
runs-on: ubuntu-latest

env:
FC: ifx
CC: icx

name: Intel Fortran
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true

- name: Set all directories as git safe
run: |
git config --global --add safe.directory '*'

- name: Setup Intel oneAPI repository
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
sudo apt-get update

- name: Install Intel oneAPI compilers
timeout-minutes: 5
run: sudo apt-get install intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp

# optional
- name: Install Intel MPI
timeout-minutes: 5
run: sudo apt-get install intel-oneapi-mpi intel-oneapi-mpi-devel

- name: Setup Intel oneAPI environment
run: |
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV
printenv | grep intel

- name: Versions
run: |
${FC} --version
${CC} --version
mpirun --version
cmake --version

- name: Build pFUnit
run: |
bash ./tools/ci-install-pfunit.bash

- name: Add PFUNIT_DIR to environment
run: |
echo "PFUNIT_DIR=${HOME}/Software/GFE" >> $GITHUB_ENV

- name: Run Basic Demo (GNU Make)
run: |
cd Basic
./build_with_make_and_run.x

- name: Run Basic Demo (CMake)
run: |
cd Basic
./build_with_cmake_and_run.x

- name: Archive log files on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: logfiles
path: |
build/**/*.log

#Nvidia:
#runs-on: ubuntu-20.04
#container: nvcr.io/nvidia/nvhpc:24.5-devel-cuda12.4-ubuntu22.04
#env:
#FC: nvfortran

#name: Nvidia HPC
#steps:
#- name: Versions
#run: |
#${FC} --version
#cmake --version

#- name: Checkout
#uses: actions/checkout@v4
#with:
#fetch-depth: 1
#submodules: true

#- name: Set all directories as git safe
#run: |
#git config --global --add safe.directory '*'

#- name: Add python-is-python3 package
#run: |
#apt-get update
#apt-get install -y python-is-python3

#- name: Build pFUnit
#run: |
#bash ./tools/ci-install-pfunit.bash

#- name: Build and Install Demos
#run: |
#cmake -B build -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_PREFIX_PATH=../install
#cmake --build build --parallel 4 --target install
#cmake -B build -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_PREFIX_PATH=../install
#cmake --build build --parallel 4 --target install

#- name: Build and Run Tests target
#run: |
#cmake --build build --parallel 4 --target build-tests
#cmake --build build --parallel 4 --target tests

#- name: Run Ctest
#run: ctest --test-dir build --parallel 1 --output-on-failure --repeat until-pass:4

#- name: Archive log files on failure
#uses: actions/upload-artifact@v4
#if: failure()
#with:
#name: logfiles
#path: |
#build/**/*.log

6 changes: 6 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## Unreleased

### Added

- Added CI

## [1.2.0] - 2022-06-27

### Changed
Expand Down
25 changes: 25 additions & 0 deletions tools/ci-install-mpi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh
# source: mpi4py
# https://github.com/mpi4py/mpi4py/blob/master/conf/travis/install-mpi.sh

set -e

MPI_IMPL="$1"
MPI_VER="$2"
os=`uname`

if [ ! -d "${HOME}/local/${MPI_IMPL}/bin" ]
then
mkdir -p ${HOME}/MPI/src/openmpi && cd ${HOME}/MPI/src/openmpi
wget --no-check-certificate https://download.open-mpi.org/release/open-mpi/v${MPI_VER%.*}/${MPI_IMPL}-${MPI_VER}.tar.bz2
tar xjf ${MPI_IMPL}-${MPI_VER}.tar.bz2 && rm ${MPI_IMPL}-${MPI_VER}.tar.bz2
cd ${MPI_IMPL}-${MPI_VER}
./configure --prefix=${HOME}/local/${MPI_IMPL} --disable-wrapper-rpath --disable-wrapper-runpath --with-hwloc=internal --with-libevent=internal
make -j 4
make install-strip
cd .. && rm -r ${MPI_IMPL}-${MPI_VER}
exit 0
else
echo "Using cached ${MPI_IMPL} directory";
exit 0
fi
22 changes: 22 additions & 0 deletions tools/ci-install-pfunit.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -e

GFE_DIR=${HOME}/gfe
mkdir -p ${GFE_DIR}

# First install prerequisites
GFE_INSTALL_DIR=${HOME}/Software/GFE
mkdir -p ${GFE_INSTALL_DIR}

to_build=(pFUnit)
for repo in "${to_build[@]}"
do
cd ${GFE_DIR}
git clone https://github.com/Goddard-Fortran-Ecosystem/${repo}.git
cd ${GFE_DIR}/${repo}
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=${GFE_INSTALL_DIR} -DCMAKE_PREFIX_PATH=${GFE_INSTALL_DIR}
make -j4 install
done

Loading