@@ -5,27 +5,20 @@ on: [push, pull_request]
5
5
jobs :
6
6
build :
7
7
runs-on : ${{ matrix.os }}
8
+
8
9
strategy :
9
10
fail-fast : false
10
11
matrix :
11
12
os : [ubuntu-latest, macos-latest]
12
13
fortran : [gfortran, flang]
13
14
build : [cmake, make]
15
+ exclude :
16
+ - os : macos-latest
17
+ fortran : flang
18
+
14
19
steps :
15
20
- name : Checkout repository
16
- uses : actions/checkout@v2
17
-
18
- - name : Compilation cache
19
- uses : actions/cache@v2
20
- with :
21
- path : ~/.ccache
22
- # We include the commit sha in the cache key, as new cache entries are
23
- # only created if there is no existing entry for the key yet.
24
- key : ${{ runner.os }}-ccache-${{ github.sha }}
25
- # Restore any ccache cache entry, if none for
26
- # ${{ runner.os }}-ccache-${{ github.sha }} exists
27
- restore-keys : |
28
- ${{ runner.os }}-ccache-
21
+ uses : actions/checkout@v3
29
22
30
23
- name : Print system information
31
24
run : |
34
27
elif [ "$RUNNER_OS" == "macOS" ]; then
35
28
sysctl -a | grep machdep.cpu
36
29
else
37
- echo "$RUNNER_OS not supported"
30
+ echo "::error:: $RUNNER_OS not supported"
38
31
exit 1
39
32
fi
40
33
@@ -43,64 +36,106 @@ jobs:
43
36
if [ "$RUNNER_OS" == "Linux" ]; then
44
37
sudo apt-get install -y gfortran cmake ccache
45
38
elif [ "$RUNNER_OS" == "macOS" ]; then
39
+ # It looks like "gfortran" isn't working correctly unless "gcc" is re-installed.
40
+ brew reinstall gcc
46
41
brew install coreutils cmake ccache
47
42
else
48
- echo "$RUNNER_OS not supported"
43
+ echo "::error:: $RUNNER_OS not supported"
49
44
exit 1
50
45
fi
51
- ccache -M 300M # Limit the ccache size; Github's overall cache limit is 5GB
52
46
53
- - name : gfortran build
54
- if : matrix.build == 'make' && matrix.fortran == 'gfortran'
47
+ - name : Compilation cache
48
+ uses : actions/cache@v3
49
+ with :
50
+ path : ~/.ccache
51
+ # We include the commit sha in the cache key, as new cache entries are
52
+ # only created if there is no existing entry for the key yet.
53
+ # GNU make and cmake call the compilers differently. It looks like
54
+ # that causes the cache to mismatch. Keep the ccache for both build
55
+ # tools separate to avoid polluting each other.
56
+ key : ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}-${{ github.ref }}-${{ github.sha }}
57
+ # Restore a matching ccache cache entry. Prefer same branch and same Fortran compiler.
58
+ restore-keys : |
59
+ ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}-${{ github.ref }}
60
+ ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}
61
+ ccache-${{ runner.os }}-${{ matrix.build }}
62
+
63
+ - name : Configure ccache
55
64
run : |
56
- if [ "$RUNNER_OS" == "Linux" ]; then
57
- export PATH="/usr/lib/ccache:${PATH}"
58
- elif [ "$RUNNER_OS" == "macOS" ]; then
59
- export PATH="$(brew --prefix)/opt/ccache/libexec:${PATH}"
60
- else
61
- echo "$RUNNER_OS not supported"
62
- exit 1
65
+ if [ "${{ matrix.build }}" = "make" ]; then
66
+ # Add ccache to path
67
+ if [ "$RUNNER_OS" = "Linux" ]; then
68
+ echo "/usr/lib/ccache" >> $GITHUB_PATH
69
+ elif [ "$RUNNER_OS" = "macOS" ]; then
70
+ echo "$(brew --prefix)/opt/ccache/libexec" >> $GITHUB_PATH
71
+ else
72
+ echo "::error::$RUNNER_OS not supported"
73
+ exit 1
74
+ fi
63
75
fi
76
+ # Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota (5 GB).
77
+ test -d ~/.ccache || mkdir -p ~/.ccache
78
+ echo "max_size = 300M" > ~/.ccache/ccache.conf
79
+ echo "compression = true" >> ~/.ccache/ccache.conf
80
+ ccache -s
64
81
65
- make -j$(nproc) DYNAMIC_ARCH=1 USE_OPENMP=0
66
-
67
- - name : flang build
68
- if : matrix.build == 'make' && matrix.fortran == 'flang'
82
+ - name : Build OpenBLAS
69
83
run : |
70
- if [ "$RUNNER_OS " == "Linux " ]; then
71
- export PATH="/usr/lib/ccache:${PATH}"
72
- elif [ "$RUNNER_OS" == "macOS" ]; then
73
- exit 0
74
- else
75
- echo "$RUNNER_OS not supported"
76
- exit 1
84
+ if [ "${{ matrix.fortran }} " = "flang " ]; then
85
+ # download and install classic flang
86
+ cd /usr/
87
+ sudo wget -nv https://github.com/flang-compiler/flang/releases/download/flang_20190329/flang-20190329-x86-70.tgz
88
+ sudo tar xf flang-20190329-x86-70.tgz
89
+ sudo rm flang-20190329-x86-70.tgz
90
+ cd -
77
91
fi
92
+ case "${{ matrix.build }}" in
93
+ "make")
94
+ make -j$(nproc) DYNAMIC_ARCH=1 USE_OPENMP=0 FC="ccache ${{ matrix.fortran }}"
95
+ ;;
96
+ "cmake")
97
+ mkdir build && cd build
98
+ cmake -DDYNAMIC_ARCH=1 \
99
+ -DNOFORTRAN=0 \
100
+ -DBUILD_WITHOUT_LAPACK=0 \
101
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
102
+ -DCMAKE_BUILD_TYPE=Release \
103
+ -DCMAKE_Fortran_COMPILER=${{ matrix.fortran }} \
104
+ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
105
+ -DCMAKE_Fortran_COMPILER_LAUNCHER=ccache \
106
+ ..
107
+ cmake --build .
108
+ ;;
109
+ *)
110
+ echo "::error::Configuration not supported"
111
+ exit 1
112
+ ;;
113
+ esac
78
114
79
- cd /usr/
80
- sudo wget -nv https://github.com/flang-compiler/flang/releases/download/flang_20190329/flang-20190329-x86-70.tgz
81
- sudo tar xf flang-20190329-x86-70.tgz
82
- sudo rm flang-20190329-x86-70.tgz
83
- cd -
84
-
85
- make -j$(nproc) DYNAMIC_ARCH=1 USE_OPENMP=0 FC=flang
86
-
115
+ - name : Show ccache status
116
+ continue-on-error : true
117
+ run : ccache -s
87
118
88
- - name : CMake gfortran build
89
- if : matrix.build == 'cmake' && matrix.fortran == 'gfortran'
119
+ - name : Run tests
120
+ timeout-minutes : 60
90
121
run : |
91
- if [ "$RUNNER_OS" == "Linux" ]; then
92
- export PATH="/usr/lib/ccache:${PATH}"
93
- elif [ "$RUNNER_OS" == "macOS" ]; then
94
- export PATH="$(brew --prefix)/opt/ccache/libexec:${PATH}"
95
- else
96
- echo "$RUNNER_OS not supported"
97
- exit 1
98
- fi
99
-
100
- mkdir build
101
- cd build
102
- cmake -DDYNAMIC_ARCH=1 -DNOFORTRAN=0 -DBUILD_WITHOUT_LAPACK=0 -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Release ..
103
- make -j$(nproc)
122
+ case "${{ matrix.build }}" in
123
+ "make")
124
+ echo "::group::Tests for BLAS"
125
+ make blas-test
126
+ echo "::endgroup::"
127
+ echo "::group::Tests for LAPACK"
128
+ make lapack-test
129
+ echo "::endgroup::"
130
+ ;;
131
+ "cmake")
132
+ cd build && ctest
133
+ ;;
134
+ *)
135
+ echo "::error::Configuration not supported"
136
+ exit 1
137
+ ;;
138
+ esac
104
139
105
140
106
141
msys2 :
@@ -170,7 +205,7 @@ jobs:
170
205
uses : actions/checkout@v3
171
206
172
207
- name : Compilation cache
173
- uses : actions/cache@v2
208
+ uses : actions/cache@v3
174
209
with :
175
210
# It looks like this path needs to be hard-coded.
176
211
path : C:/msys64/home/runneradmin/.ccache
0 commit comments