@@ -5,27 +5,20 @@ on: [push, pull_request]
55jobs :
66 build :
77 runs-on : ${{ matrix.os }}
8+
89 strategy :
910 fail-fast : false
1011 matrix :
1112 os : [ubuntu-latest, macos-latest]
1213 fortran : [gfortran, flang]
1314 build : [cmake, make]
15+ exclude :
16+ - os : macos-latest
17+ fortran : flang
18+
1419 steps :
1520 - 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
2922
3023 - name : Print system information
3124 run : |
3427 elif [ "$RUNNER_OS" == "macOS" ]; then
3528 sysctl -a | grep machdep.cpu
3629 else
37- echo "$RUNNER_OS not supported"
30+ echo "::error:: $RUNNER_OS not supported"
3831 exit 1
3932 fi
4033
@@ -43,64 +36,106 @@ jobs:
4336 if [ "$RUNNER_OS" == "Linux" ]; then
4437 sudo apt-get install -y gfortran cmake ccache
4538 elif [ "$RUNNER_OS" == "macOS" ]; then
39+ # It looks like "gfortran" isn't working correctly unless "gcc" is re-installed.
40+ brew reinstall gcc
4641 brew install coreutils cmake ccache
4742 else
48- echo "$RUNNER_OS not supported"
43+ echo "::error:: $RUNNER_OS not supported"
4944 exit 1
5045 fi
51- ccache -M 300M # Limit the ccache size; Github's overall cache limit is 5GB
5246
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
5564 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
6375 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
6481
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
6983 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 -
7791 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
78114
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
87118
88- - name : CMake gfortran build
89- if : matrix.build == 'cmake' && matrix.fortran == 'gfortran'
119+ - name : Run tests
120+ timeout-minutes : 60
90121 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
104139
105140
106141 msys2 :
@@ -170,7 +205,7 @@ jobs:
170205 uses : actions/checkout@v3
171206
172207 - name : Compilation cache
173- uses : actions/cache@v2
208+ uses : actions/cache@v3
174209 with :
175210 # It looks like this path needs to be hard-coded.
176211 path : C:/msys64/home/runneradmin/.ccache
0 commit comments