Merge pull request #3601 from mmuetzel/ci
Consolidate actions on GitHub runners.
This commit is contained in:
commit
2edcd9b9dc
|
@ -5,27 +5,20 @@ on: [push, pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest]
|
||||||
fortran: [gfortran, flang]
|
fortran: [gfortran, flang]
|
||||||
build: [cmake, make]
|
build: [cmake, make]
|
||||||
|
exclude:
|
||||||
|
- os: macos-latest
|
||||||
|
fortran: flang
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Compilation cache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/.ccache
|
|
||||||
# We include the commit sha in the cache key, as new cache entries are
|
|
||||||
# only created if there is no existing entry for the key yet.
|
|
||||||
key: ${{ runner.os }}-ccache-${{ github.sha }}
|
|
||||||
# Restore any ccache cache entry, if none for
|
|
||||||
# ${{ runner.os }}-ccache-${{ github.sha }} exists
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-ccache-
|
|
||||||
|
|
||||||
- name: Print system information
|
- name: Print system information
|
||||||
run: |
|
run: |
|
||||||
|
@ -34,7 +27,7 @@ jobs:
|
||||||
elif [ "$RUNNER_OS" == "macOS" ]; then
|
elif [ "$RUNNER_OS" == "macOS" ]; then
|
||||||
sysctl -a | grep machdep.cpu
|
sysctl -a | grep machdep.cpu
|
||||||
else
|
else
|
||||||
echo "$RUNNER_OS not supported"
|
echo "::error::$RUNNER_OS not supported"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -43,64 +36,106 @@ jobs:
|
||||||
if [ "$RUNNER_OS" == "Linux" ]; then
|
if [ "$RUNNER_OS" == "Linux" ]; then
|
||||||
sudo apt-get install -y gfortran cmake ccache
|
sudo apt-get install -y gfortran cmake ccache
|
||||||
elif [ "$RUNNER_OS" == "macOS" ]; then
|
elif [ "$RUNNER_OS" == "macOS" ]; then
|
||||||
|
# It looks like "gfortran" isn't working correctly unless "gcc" is re-installed.
|
||||||
|
brew reinstall gcc
|
||||||
brew install coreutils cmake ccache
|
brew install coreutils cmake ccache
|
||||||
else
|
else
|
||||||
echo "$RUNNER_OS not supported"
|
echo "::error::$RUNNER_OS not supported"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
ccache -M 300M # Limit the ccache size; Github's overall cache limit is 5GB
|
|
||||||
|
|
||||||
- name: gfortran build
|
- name: Compilation cache
|
||||||
if: matrix.build == 'make' && matrix.fortran == 'gfortran'
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.ccache
|
||||||
|
# We include the commit sha in the cache key, as new cache entries are
|
||||||
|
# only created if there is no existing entry for the key yet.
|
||||||
|
# GNU make and cmake call the compilers differently. It looks like
|
||||||
|
# that causes the cache to mismatch. Keep the ccache for both build
|
||||||
|
# tools separate to avoid polluting each other.
|
||||||
|
key: ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}-${{ github.ref }}-${{ github.sha }}
|
||||||
|
# Restore a matching ccache cache entry. Prefer same branch and same Fortran compiler.
|
||||||
|
restore-keys: |
|
||||||
|
ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}-${{ github.ref }}
|
||||||
|
ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}
|
||||||
|
ccache-${{ runner.os }}-${{ matrix.build }}
|
||||||
|
|
||||||
|
- name: Configure ccache
|
||||||
run: |
|
run: |
|
||||||
if [ "$RUNNER_OS" == "Linux" ]; then
|
if [ "${{ matrix.build }}" = "make" ]; then
|
||||||
export PATH="/usr/lib/ccache:${PATH}"
|
# Add ccache to path
|
||||||
elif [ "$RUNNER_OS" == "macOS" ]; then
|
if [ "$RUNNER_OS" = "Linux" ]; then
|
||||||
export PATH="$(brew --prefix)/opt/ccache/libexec:${PATH}"
|
echo "/usr/lib/ccache" >> $GITHUB_PATH
|
||||||
|
elif [ "$RUNNER_OS" = "macOS" ]; then
|
||||||
|
echo "$(brew --prefix)/opt/ccache/libexec" >> $GITHUB_PATH
|
||||||
else
|
else
|
||||||
echo "$RUNNER_OS not supported"
|
echo "::error::$RUNNER_OS not supported"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
# Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota (5 GB).
|
||||||
|
test -d ~/.ccache || mkdir -p ~/.ccache
|
||||||
|
echo "max_size = 300M" > ~/.ccache/ccache.conf
|
||||||
|
echo "compression = true" >> ~/.ccache/ccache.conf
|
||||||
|
ccache -s
|
||||||
|
|
||||||
make -j$(nproc) DYNAMIC_ARCH=1 USE_OPENMP=0
|
- name: Build OpenBLAS
|
||||||
|
|
||||||
- name: flang build
|
|
||||||
if: matrix.build == 'make' && matrix.fortran == 'flang'
|
|
||||||
run: |
|
run: |
|
||||||
if [ "$RUNNER_OS" == "Linux" ]; then
|
if [ "${{ matrix.fortran }}" = "flang" ]; then
|
||||||
export PATH="/usr/lib/ccache:${PATH}"
|
# download and install classic flang
|
||||||
elif [ "$RUNNER_OS" == "macOS" ]; then
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "$RUNNER_OS not supported"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd /usr/
|
cd /usr/
|
||||||
sudo wget -nv https://github.com/flang-compiler/flang/releases/download/flang_20190329/flang-20190329-x86-70.tgz
|
sudo wget -nv https://github.com/flang-compiler/flang/releases/download/flang_20190329/flang-20190329-x86-70.tgz
|
||||||
sudo tar xf flang-20190329-x86-70.tgz
|
sudo tar xf flang-20190329-x86-70.tgz
|
||||||
sudo rm flang-20190329-x86-70.tgz
|
sudo rm flang-20190329-x86-70.tgz
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
make -j$(nproc) DYNAMIC_ARCH=1 USE_OPENMP=0 FC=flang
|
|
||||||
|
|
||||||
|
|
||||||
- name: CMake gfortran build
|
|
||||||
if: matrix.build == 'cmake' && matrix.fortran == 'gfortran'
|
|
||||||
run: |
|
|
||||||
if [ "$RUNNER_OS" == "Linux" ]; then
|
|
||||||
export PATH="/usr/lib/ccache:${PATH}"
|
|
||||||
elif [ "$RUNNER_OS" == "macOS" ]; then
|
|
||||||
export PATH="$(brew --prefix)/opt/ccache/libexec:${PATH}"
|
|
||||||
else
|
|
||||||
echo "$RUNNER_OS not supported"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
case "${{ matrix.build }}" in
|
||||||
|
"make")
|
||||||
|
make -j$(nproc) DYNAMIC_ARCH=1 USE_OPENMP=0 FC="ccache ${{ matrix.fortran }}"
|
||||||
|
;;
|
||||||
|
"cmake")
|
||||||
|
mkdir build && cd build
|
||||||
|
cmake -DDYNAMIC_ARCH=1 \
|
||||||
|
-DNOFORTRAN=0 \
|
||||||
|
-DBUILD_WITHOUT_LAPACK=0 \
|
||||||
|
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DCMAKE_Fortran_COMPILER=${{ matrix.fortran }} \
|
||||||
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||||
|
-DCMAKE_Fortran_COMPILER_LAUNCHER=ccache \
|
||||||
|
..
|
||||||
|
cmake --build .
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "::error::Configuration not supported"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
mkdir build
|
- name: Show ccache status
|
||||||
cd build
|
continue-on-error: true
|
||||||
cmake -DDYNAMIC_ARCH=1 -DNOFORTRAN=0 -DBUILD_WITHOUT_LAPACK=0 -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Release ..
|
run: ccache -s
|
||||||
make -j$(nproc)
|
|
||||||
|
- name: Run tests
|
||||||
|
timeout-minutes: 60
|
||||||
|
run: |
|
||||||
|
case "${{ matrix.build }}" in
|
||||||
|
"make")
|
||||||
|
echo "::group::Tests for BLAS"
|
||||||
|
make blas-test
|
||||||
|
echo "::endgroup::"
|
||||||
|
echo "::group::Tests for LAPACK"
|
||||||
|
make lapack-test
|
||||||
|
echo "::endgroup::"
|
||||||
|
;;
|
||||||
|
"cmake")
|
||||||
|
cd build && ctest
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "::error::Configuration not supported"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
msys2:
|
msys2:
|
||||||
|
@ -170,7 +205,7 @@ jobs:
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Compilation cache
|
- name: Compilation cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
# It looks like this path needs to be hard-coded.
|
# It looks like this path needs to be hard-coded.
|
||||||
path: C:/msys64/home/runneradmin/.ccache
|
path: C:/msys64/home/runneradmin/.ccache
|
||||||
|
|
Loading…
Reference in New Issue