Skip to content

Updated CMake build and set of Github Actions mimicking the stdlib package #57

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
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
34 changes: 34 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Override syntax highlighting
*.fypp linguist-language=fortran

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text
*.f90 text
*.F90 text
*.md text
*.txt text
*.sh text
*.cu text

# Denote all files that are truly binary and should not be modified.
*.mod binary
*.o binary
*.a binary
*.so binary
*.tar binary
*.gz binary
*.tgz binary

# Prevent dev-ops files from making it into the release archives
.gitattributes export-ignore
.gitignore export-ignore
codecov.yml export-ignore
.github export-ignore

# Perform substitutions when `git export`ing these files
.VERSION export-subst
93 changes: 93 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: CI

on: [push, pull_request]

env:
CMAKE_BUILD_PARALLEL_LEVEL: "2" # 2 cores on each GHA VM, enable parallel builds
CTEST_OUTPUT_ON_FAILURE: "ON" # This way we don't need a flag to ctest
CTEST_PARALLEL_LEVEL: "2"
CTEST_TIME_TIMEOUT: "5" # some failures hang forever
HOMEBREW_NO_ANALYTICS: "ON" # Make Homebrew installation a little quicker
HOMEBREW_NO_AUTO_UPDATE: "ON"
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
HOMEBREW_NO_GITHUB_API: "ON"
HOMEBREW_NO_INSTALL_CLEANUP: "ON"

jobs:
Build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13]
toolchain:
- {compiler: gcc, version: 10}
- {compiler: gcc, version: 11}
- {compiler: gcc, version: 12}
- {compiler: gcc, version: 13}
- {compiler: intel, version: '2024.1'}
build: [cmake]
include:
- os: ubuntu-22.04
build: cmake
toolchain: {compiler: intel-classic, version: '2021.10'}
- os: ubuntu-latest
build: cmake-inline
toolchain: {compiler: gcc, version: 10}
exclude:
- os: macos-13
toolchain: {compiler: intel, version: '2024.1'}
- os: macos-13
toolchain: {compiler: gcc, version: 13}
env:
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.x
uses: actions/setup-python@v5 # Use pip to install latest CMake, & FORD/Jin2For, etc.
with:
python-version: 3.x

- name: Install fypp
run: pip install --upgrade fypp ninja

- name: Setup Fortran compiler
uses: fortran-lang/[email protected]
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

# Build and test with built-in BLAS and LAPACK
- name: Configure with CMake
if: ${{ contains(matrix.build, 'cmake') }}
run: >-
cmake -Wdev -G Ninja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_MAXIMUM_RANK:String=4
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
-S . -B ${{ env.BUILD_DIR }}

- name: Build and compile
if: ${{ contains(matrix.build, 'cmake') }}
run: cmake --build ${{ env.BUILD_DIR }} --parallel

- name: catch build fail
if: ${{ failure() && contains(matrix.build, 'cmake') }}
run: cmake --build ${{ env.BUILD_DIR }} --verbose --parallel 1

- name: test
if: ${{ contains(matrix.build, 'cmake') }}
run: >-
ctest
--test-dir ${{ env.BUILD_DIR }}
--parallel
--output-on-failure
--no-tests=error

- name: Install project
if: ${{ contains(matrix.build, 'cmake') }}
run: cmake --install ${{ env.BUILD_DIR }}
68 changes: 68 additions & 0 deletions .github/workflows/CI_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI_windows

on: [push, pull_request]

env:
CTEST_TIME_TIMEOUT: "5" # some failures hang forever
CMAKE_GENERATOR: Ninja

jobs:
msys2-build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include: [
{ msystem: MINGW64, arch: x86_64 }
]
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2

- name: Setup MinGW native environment
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: false
install: >-
git
mingw-w64-${{ matrix.arch }}-gcc
mingw-w64-${{ matrix.arch }}-gcc-fortran
mingw-w64-${{ matrix.arch }}-python
mingw-w64-${{ matrix.arch }}-python-fypp
mingw-w64-${{ matrix.arch }}-cmake
mingw-w64-${{ matrix.arch }}-ninja

- run: >-
PATH=$PATH:/mingw64/bin/ cmake
-Wdev
-B build
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_Fortran_FLAGS_DEBUG="-Wall -Wextra -Wimplicit-interface -fPIC -g -fcheck=all -fbacktrace"
-DCMAKE_MAXIMUM_RANK:String=4
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
env:
FC: gfortran
CC: gcc
CXX: g++

- name: CMake build
run: PATH=$PATH:/mingw64/bin/ cmake --build build --parallel

- name: catch build fail
run: PATH=$PATH:/mingw64/bin/ cmake --build build --verbose --parallel 1
if: failure()

- name: CTest
run: PATH=$PATH:/mingw64/bin/ ctest --test-dir build --output-on-failure --parallel -V -LE quadruple_precision

- uses: actions/upload-artifact@v4
if: failure()
with:
name: WindowsCMakeTestlog
path: build/Testing/Temporary/LastTest.log

- name: Install project
run: PATH=$PATH:/mingw64/bin/ cmake --install build
17 changes: 17 additions & 0 deletions .github/workflows/PR-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: PR-Review
on: [pull_request]
jobs:
misspell:
name: review-dog / misspell
runs-on: ubuntu-latest
steps:
- name: Check out code.
uses: actions/checkout@v2
- name: misspell
uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
locale: "US"
reporter: github-pr-review
level: warning
ignore: colour
48 changes: 0 additions & 48 deletions .github/workflows/cmake.yml

This file was deleted.

90 changes: 90 additions & 0 deletions .github/workflows/fpm-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: fpm-deployment

on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
toolchain: {compiler: gcc, version: 14}

steps:
- name: Checkout code
uses: actions/[email protected]

- name: Set up Python 3.x
uses: actions/setup-python@v1
with:
python-version: 3.x

- name: Install requirements
run: pip install --upgrade -r config/requirements.txt

- uses: fortran-lang/setup-fortran@main
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

- name: Setup Fortran Package Manager
uses: fortran-lang/setup-fpm@v5
with:
fpm-version: 'v0.10.0'

- name: Prepare for code coverage
if: contains( matrix.os, 'ubuntu')
run: |
sudo apt-get install lcov
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-14 gfortran-14
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-14 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-14 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-14

- run: | # Just for deployment: create fftpack-fpm folder
python config/fypp_deployment.py --deploy_fftpack_fpm

- run: | # Just for deployment: create fftpack-fpm-ilp64 folder
python config/fypp_deployment.py --deploy_fftpack_fpm --with_ilp64

- run: | # Use fpm gnu ci to check xdp and qp
python config/fypp_deployment.py --with_xdp --with_qp
fpm test --profile release --flag '-DWITH_XDP -DWITH_QP -coverage'

- name: Create coverage report
run: |
mkdir -p ${{ env.COV_DIR }}
mv ./build/gfortran_*/*/* ${{ env.COV_DIR }}
lcov --capture --initial --base-directory . --directory ${{ env.COV_DIR }} --output-file ${{ env.COV_DIR }}/coverage.base
lcov --capture --base-directory . --directory ${{ env.COV_DIR }} --output-file ${{ env.COV_DIR }}/coverage.capture
lcov --add-tracefile ${{ env.COV_DIR }}/coverage.base --add-tracefile ${{ env.COV_DIR }}/coverage.capture --output-file ${{ env.COV_DIR }}/coverage.info
env:
COV_DIR: build/coverage

- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: build/coverage/coverage.info

# Update and deploy the f90 files generated by github-ci to the `fftpack-fpm` branch.
- name: Deploy 🚀
uses: JamesIves/[email protected]
if: github.event_name != 'pull_request'
with:
BRANCH: fftpack-fpm
FOLDER: fftpack-fpm

# Update and deploy the f90 files generated by github-ci to the `fftpack-fpm-ilp64` branch.
- name: Deploy with 64-bit integer support 🚀
uses: JamesIves/[email protected]
if: github.event_name != 'pull_request'
with:
BRANCH: fftpack-fpm-ilp64
FOLDER: fftpack-fpm-ilp64
Loading
Loading