-
Notifications
You must be signed in to change notification settings - Fork 3
59 lines (49 loc) · 1.92 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: CI
on: [push, pull_request]
jobs:
Build:
runs-on: [ubuntu-22.04]
env:
FC: gfortran
GCC_V: 13
OC_V: 2.10.2
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install fpm
uses: fortran-lang/setup-fpm@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup cache for opencoarrays
id: cache-opencoarrays
uses: actions/cache@v4
with:
path: "~/apps/OpenCoarrays/"
key: OC-${{ env.OC_V }}
- name: Install GFortran
run: |
sudo apt update
sudo apt install -y build-essential gfortran-${GCC_V} g++-${GCC_V} cmake mpich
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/g++ g++ /usr/bin/g++-${GCC_V}
- name: Maybe install opencoarrays
if: steps.cache-opencoarrays.outputs.cache-hit != 'true'
run: |
wget https://github.com/sourceryinstitute/OpenCoarrays/releases/download/${OC_V}/OpenCoarrays-${OC_V}.tar.gz
tar xzvf OpenCoarrays-${OC_V}.tar.gz
cd OpenCoarrays-${OC_V}
mkdir -p "~/apps/OpenCoarrays/${OC_V}"
cmake -S . -B build -DCMAKE_INSTALL_PREFIX="~/apps/OpenCoarrays/${OC_V}"
cmake --build build -t install -j
echo "${HOME}/apps/OpenCoarrays/${OC_V}/bin" >> $GITHUB_PATH
- name: Add to PATH if cache hit
if: steps.cache-opencoarrays.outputs.cache-hit == 'true'
run: echo "${HOME}/apps/OpenCoarrays/${OC_V}/bin" >> $GITHUB_PATH
- name: Build, run, and test
run: |
which caf
caf --show
# Build the example executable to test the commandline without caf first, since you cannot spawn new MPI jobs from within an MPI job
fpm run --example get-flag-value -- --input-file some_file_name
fpm test --compiler caf --runner "cafrun -n 2"