Skip to content

Commit c000257

Browse files
committed
ci(gha): test w/ multiple GFortrans & macOS too
1 parent ae5591f commit c000257

File tree

1 file changed

+54
-10
lines changed

1 file changed

+54
-10
lines changed

.github/workflows/main.yml

+54-10
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,60 @@ name: CI
22

33
on: [push, pull_request]
44

5+
env:
6+
CI: "ON" # We can detect this in the build system and other vendors implement it
7+
CMAKE_BUILD_PARALLEL_LEVEL: "2" # 2 cores on each GHA VM, enable parallel builds
8+
CTEST_OUTPUT_ON_FAILURE: "ON" # This way we don't need a flag to ctest
9+
CTEST_PARALLEL_LEVEL: "2"
10+
HOMEBREW_NO_ANALYTICS: "ON" # Make Homebrew installation a little quicker
11+
HOMEBREW_NO_AUTO_UPDATE: "ON"
12+
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
13+
HOMEBREW_NO_GITHUB_API: "ON"
14+
HOMEBREW_NO_INSTALL_CLEANUP: "ON"
15+
516
jobs:
6-
Linux:
7-
runs-on: ubuntu-latest
17+
Build:
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [ubuntu-latest, macos-latest]
23+
gcc_v: [7, 8, 9] # Version of GFortran we want to use.
24+
env:
25+
FC: gfortran-${{ matrix.gcc_v }}
26+
GCC_V: ${{ matrix.gcc_v }}
27+
828
steps:
9-
- uses: actions/checkout@v1
10-
- name: Install GFortran
11-
run: sudo apt-get install gfortran
12-
- name: cmake
13-
run: cmake .
14-
- name: make
15-
run: make
29+
- name: Checkout code
30+
uses: actions/checkout@v1
31+
32+
- name: Set up Python 3.x
33+
uses: actions/setup-python@v1 # Use pip to install latest CMake, & FORD/Jin2For, etc.
34+
with:
35+
python-version: 3.x
36+
37+
- name: Set up common
38+
run: pip install --upgrade cmake
39+
40+
- name: Install GFortran Linux
41+
if: contains( matrix.os, 'ubuntu')
42+
run: |
43+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
44+
sudo apt-get update
45+
sudo apt-get install -y gcc-${GCC_V} gfortran-${GCC_V}
46+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
47+
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
48+
--slave /usr/bingcov gcov /usr/bin/gcov-${GCC_V}
49+
50+
- name: Install GFortran macOS
51+
if: contains( matrix.os, 'macos')
52+
run: brew install gcc@${GCC_V} || brew upgrade gcc@${GCC_V} || true
53+
54+
- name: Configure with CMake
55+
run: cmake -Wdev -S . -B . # We should build out of source but loadtxt needs fixing
56+
57+
- name: Build and compile
58+
run: cmake --build . || cmake --build . --verbose --parallel 1
59+
1660
- name: test
17-
run: ctest --output-on-failure
61+
run: cmake --build . --target test

0 commit comments

Comments
 (0)