Skip to content

Commit 5479655

Browse files
authored
Merge pull request #2638 from leezu/actions
Add Github Actions test for DYNAMIC_ARCH builds on Linux and macOS
2 parents 3eda3d3 + a8f42ae commit 5479655

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

.github/workflows/dynamic_arch.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: continuous build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os: [ubuntu-latest, macos-latest]
12+
build: [cmake, make]
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v2
16+
17+
- name: Compilation cache
18+
uses: actions/cache@v2
19+
with:
20+
path: ~/.ccache
21+
# We include the commit sha in the cache key, as new cache entries are
22+
# only created if there is no existing entry for the key yet.
23+
key: ${{ runner.os }}-ccache-${{ github.sha }}
24+
# Restore any ccache cache entry, if none for
25+
# ${{ runner.os }}-ccache-${{ github.sha }} exists
26+
restore-keys: |
27+
${{ runner.os }}-ccache
28+
29+
- name: Print system information
30+
run: |
31+
if [ "$RUNNER_OS" == "Linux" ]; then
32+
cat /proc/cpuinfo
33+
elif [ "$RUNNER_OS" == "macOS" ]; then
34+
sysctl -a | grep machdep.cpu
35+
else
36+
echo "$RUNNER_OS not supported"
37+
exit 1
38+
fi
39+
40+
- name: Install Dependencies
41+
run: |
42+
if [ "$RUNNER_OS" == "Linux" ]; then
43+
sudo apt-get install -y gfortran cmake ccache
44+
elif [ "$RUNNER_OS" == "macOS" ]; then
45+
brew install coreutils cmake ccache
46+
else
47+
echo "$RUNNER_OS not supported"
48+
exit 1
49+
fi
50+
ccache -M 300M # Limit the ccache size; Github's overall cache limit is 5GB
51+
52+
- name: Build
53+
if: matrix.build == 'make'
54+
run: |
55+
if [ "$RUNNER_OS" == "Linux" ]; then
56+
export PATH="/usr/lib/ccache:${PATH}"
57+
elif [ "$RUNNER_OS" == "macOS" ]; then
58+
export PATH="$(brew --prefix)/opt/ccache/libexec:${PATH}"
59+
else
60+
echo "$RUNNER_OS not supported"
61+
exit 1
62+
fi
63+
64+
make -j$(nproc) DYNAMIC_ARCH=1 USE_OPENMP=0
65+
66+
- name: CMake build
67+
if: matrix.build == 'cmake'
68+
run: |
69+
if [ "$RUNNER_OS" == "Linux" ]; then
70+
export PATH="/usr/lib/ccache:${PATH}"
71+
elif [ "$RUNNER_OS" == "macOS" ]; then
72+
export PATH="$(brew --prefix)/opt/ccache/libexec:${PATH}"
73+
else
74+
echo "$RUNNER_OS not supported"
75+
exit 1
76+
fi
77+
78+
mkdir build
79+
cd build
80+
cmake -DDYNAMIC_ARCH=1 -DNOFORTRAN=0 -DBUILD_WITHOUT_LAPACK=0 -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Release ..
81+
make -j$(nproc)

0 commit comments

Comments
 (0)