-
Notifications
You must be signed in to change notification settings - Fork 85
128 lines (110 loc) · 4.31 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: CI
on: [push, pull_request]
jobs:
Build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
gcc_v: [7,8,9,10] # Version of GFortran we want to use.
python-version: [3.9]
env:
FC: gfortran-${{matrix.gcc_v}}
GCC_V: ${{matrix.gcc_v}}
steps:
- name: Set vars
id: vars
# run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} # this is depreciated: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
run: echo "name=tag::${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@v4.1.6
with:
submodules: recursive
- name: Setup cmake
if: contains( matrix.gcc_v, 9 )
uses: jwlawson/actions-setup-cmake@v2.0.2
with:
cmake-version: '3.28.x'
- name: Install Python
uses: actions/setup-python@v5.1.0 # Use pip to install latest CMake, & FORD/Jin2For, etc.
with:
python-version: ${{ matrix.python-version }}
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2.0.2
- name: Install Python dependencies
if: contains( matrix.os, 'ubuntu')
run: |
python -m pip install --upgrade pip
pip install ford FoBiS.py pygooglechart
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install GFortran Linux
if: contains( matrix.os, 'ubuntu')
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-${GCC_V} gfortran-${GCC_V}
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/gcov gcov /usr/bin/gcov-${GCC_V}
- name: Compile_with_build
if: matrix.gcc_v != 7
run: |
GFORTRAN=gfortran-${{matrix.gcc_v}}
GCOV=gcov-${{matrix.gcc_v}}
# build with build.sh, run unit tests
./build.sh --skip-documentation
./build.sh --skip-documentation --enable-unicode
- name: Compile_with_cmake
# CMake build with unit tests, no documentation, with coverage analysis
# No unicode so that coverage combined with the build script will cover unicode
# and non-unicode code paths
if: matrix.gcc_v == 9
run: |
GFORTRAN=gfortran-${{matrix.gcc_v}}
GCOV=gcov-${{matrix.gcc_v}}
mkdir cmake-build
cd cmake-build
cmake -D ENABLE_TESTS=ON ..
make -j 4 check
- name: Compile_with_build_mkdocs
# build with build.sh, make documentation, run unit tests
# and perform coverage analysis - used for doc deployment
if: matrix.gcc_v == 7
run: |
GFORTRAN=gfortran-${{matrix.gcc_v}}
GCOV=gcov-${{matrix.gcc_v}}
./build.sh --coverage --skip-documentation
./build.sh --coverage --enable-unicode
- name: Deploy Documentation for master
if: matrix.gcc_v == 7 && github.ref == 'refs/heads/master'
uses: JamesIves/github-pages-deploy-action@4.1.3
with:
branch: gh-pages # The branch the action should deploy to.
folder: doc # The folder the action should deploy.
clean: true
clean-exclude: |
prev
- name: Rebuild documentation for tagged release
env:
TAGNAME: ${{ steps.vars.outputs.tag }}
if: matrix.gcc_v == 7 && startsWith(github.ref, 'refs/tags/')
run: |
echo ${TAGNAME}
rm -rf doc
sed "2 s/^/version: ${TAGNAME}\n/" json-fortran.md > json-fortran.tagged.md
ford --debug json-fortran.tagged.md
- name: Deploy documentation for tagged release
if: matrix.gcc_v == 7 && startsWith(github.ref, 'refs/tags/')
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
branch: gh-pages # The branch the action should deploy to.
folder: doc # The folder the action should deploy.
target-folder: prev/${{ steps.vars.outputs.tag }} # deploy to a version-specific folder
- name: Upload coverage
if: matrix.gcc_v == 7
run: |
rm json_*.F90-*unicode.gcov || true
mv json_*.F90.gcov src/
mv jf_test*.[fF]90.gcov src/tests/
bash <(curl -s https://codecov.io/bash) -v -X $GCOV