Skip to content

Commit

Permalink
[add] ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
yymmt742 committed May 30, 2024
1 parent 74c4018 commit 8171273
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
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:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolchain:
- {compiler: gcc, version: 9}
- {compiler: gcc, version: 10}
- {compiler: gcc, version: 11}
- {compiler: gcc, version: 12}
- {compiler: gcc, version: 13}
- {compiler: intel, version: '2023.2'}
- {compiler: intel-classic, version: '2021.10'}
- {compiler: nvidia-hpc, version: '23.11'}
exclude:
- os: macos-latest
toolchain: {compiler: gcc, version: 9}
- os: macos-latest
toolchain: {compiler: gcc, version: 10}
- os: macos-latest
toolchain: {compiler: intel, version: '2023.2'}
- os: macos-latest
toolchain: {compiler: nvidia-hpc, version: '23.11'}
- os: windows-latest
toolchain: {compiler: nvidia-hpc, version: '23.11'}

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

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

- 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 cmake and fypp
run: pip install --upgrade cmake fypp

- name: Configure with CMake (windows)
if: contains(matrix.os, 'windows')
run: >-
cmake -Wdev
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX=_dist
-G "MinGW Makefiles"
-S . -B build
- name: Configure with CMake (UNIX)
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
run: >-
cmake -Wdev
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX=_dist
-S . -B build
- name: Build and compile
run: cmake --build build --parallel

- name: catch build fail
if: ${{ failure() }}
run: cmake --build build --verbose --parallel 1

- name: test
run: >-
ctest
--test-dir build
--parallel
--output-on-failure
--no-tests=error
- name: Install project
run: cmake --install build

0 comments on commit 8171273

Please sign in to comment.