Skip to content

Commit 4049059

Browse files
authored
Add GitHub Actions CI (#23)
* Update run.py * Add Github Actions CI
1 parent 924bde5 commit 4049059

File tree

2 files changed

+153
-2
lines changed

2 files changed

+153
-2
lines changed

.github/workflows/main.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Build application
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ubuntu-gcc-build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v1
10+
- name: Setup environment
11+
run: |
12+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
13+
sudo apt-get update
14+
sudo apt-get install g++-9
15+
sudo apt-get install mpich libmpich-dev
16+
sudo apt-get install libomp-9-dev libtbb-dev
17+
sudo apt-get install texlive*
18+
- name: Update submodules
19+
run: git submodule update --init --recursive
20+
- name: Run linter
21+
run: python scripts/lint.py
22+
- name: Build
23+
run: |
24+
mkdir build
25+
cd build
26+
cmake -D USE_SEQ=ON -D USE_MPI=ON -D USE_OMP=ON -D USE_TBB=ON -D USE_STD=ON -D USE_LATEX=ON -D CMAKE_BUILD_TYPE=RELEASE ..
27+
cmake --build . --config -j4
28+
cd ..
29+
env:
30+
CC: gcc-9
31+
CXX: g++-9
32+
- name: Run tests
33+
run: |
34+
export OMP_NUM_THREADS=4
35+
source scripts/run.sh
36+
ubuntu-clang-build:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v1
40+
- name: Setup environment
41+
run: |
42+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
43+
sudo apt-get update
44+
sudo apt-get install clang-8 mpich libmpich-dev libomp-9-dev libtbb-dev texlive*
45+
- name: Update submodules
46+
run: git submodule update --init --recursive
47+
- name: Run linter
48+
run: python scripts/lint.py
49+
- name: Build
50+
run: |
51+
mkdir build
52+
cd build
53+
cmake -D USE_SEQ=ON -D USE_MPI=ON -D USE_OMP=ON -D USE_TBB=ON -D USE_STD=ON -D USE_LATEX=ON -D CMAKE_BUILD_TYPE=RELEASE ..
54+
cmake --build . --config -j4
55+
cd ..
56+
env:
57+
CC: clang-8
58+
CXX: clang++-8
59+
- name: Run tests
60+
run: |
61+
export OMP_NUM_THREADS=4
62+
source scripts/run.sh
63+
macos-clang-build:
64+
runs-on: macOS-latest
65+
steps:
66+
- uses: actions/checkout@v1
67+
- name: Setup environment
68+
run: |
69+
brew update-reset
70+
brew unlink python@2
71+
brew install open-mpi libomp tbb
72+
- name: Update submodules
73+
run: git submodule update --init --recursive
74+
- name: Run linter
75+
run: python scripts/lint.py
76+
- name: Build
77+
run: |
78+
export LDFLAGS="$LDFLAGS -L$(brew --prefix libomp)/lib"
79+
export CFLAGS="$CFLAGS -I$(brew --prefix libomp)/include -I$(brew --prefix tbb)/include"
80+
export CXXFLAGS="$CXXFLAGS -I$(brew --prefix libomp)/include -I$(brew --prefix tbb)/include"
81+
mkdir build
82+
cd build
83+
cmake -D USE_SEQ=ON -D USE_MPI=ON -D USE_OMP=ON -D USE_TBB=ON -D USE_STD=ON -D USE_LATEX=ON -D CMAKE_BUILD_TYPE=RELEASE ..
84+
cmake --build . --config -j4
85+
cd ..
86+
- name: Run tests
87+
run: |
88+
export OMP_NUM_THREADS=4
89+
source scripts/run.sh
90+
windows-msvc-build:
91+
runs-on: windows-latest
92+
strategy:
93+
fail-fast: false
94+
matrix:
95+
cmake_generator:
96+
- Visual Studio 14 2015
97+
- Visual Studio 15 2017
98+
- Visual Studio 16 2019
99+
steps:
100+
- uses: actions/checkout@v1
101+
- name: Download dependencies
102+
run: |
103+
Invoke-WebRequest https://github.com/Microsoft/Microsoft-MPI/releases/download/v10.0/msmpisetup.exe -OutFile msmpisetup.exe
104+
Invoke-WebRequest https://github.com/Microsoft/Microsoft-MPI/releases/download/v10.0/msmpisdk.msi -OutFile msmpisdk.msi
105+
shell: pwsh
106+
- name: Setup environment
107+
run: |
108+
MSMpiSetup.exe -unattend
109+
set PATH=C:\Program Files\Microsoft MPI\Bin;%PATH%
110+
msmpisdk.msi /passive
111+
powershell -file "scripts\appveyor_install_miktex-latest-minimal.ps1"
112+
refreshenv
113+
pdflatex -version
114+
shell: cmd
115+
- name: Update submodules
116+
run: git submodule update --init --recursive
117+
- name: Build
118+
run: |
119+
mkdir build
120+
cd build
121+
cmake -G "%CMAKE_GENERATOR%" -D USE_SEQ=ON -D USE_MPI=ON -D USE_OMP=ON -D USE_TBB=ON -D USE_STD=ON -D USE_LATEX=ON -D MPI_C_INCLUDE_PATH:PATH="%MPI_HOME%/Include" -D MPI_C_LIBRARIES:PATH="%MPI_HOME%/Lib/x86/msmpi.lib" -D MPI_CXX_INCLUDE_PATH:PATH="%MPI_HOME%/Include" -D MPI_CXX_LIBRARIES:PATH="%MPI_HOME%/Lib/x86/msmpi.lib" .. -A Win32
122+
cmake --build .
123+
cd ..
124+
set OMP_NUM_THREADS=4
125+
scripts/run.bat
126+
env:
127+
CMAKE_GENERATOR: ${{ matrix.cmake_generator }}
128+
- name: Run tests
129+
run: |
130+
set OMP_NUM_THREADS=4
131+
scripts/run.bat

scripts/run.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
FILES_SEQ="build/bin/*_seq"
44
for file in $FILES_SEQ; do
5+
if [ "$file" = "build/bin/*_seq" ]
6+
then
7+
continue
8+
fi
59
start_seq=`date +%s`
610
echo "--------------------------------"
711
echo $(basename $file)
@@ -19,6 +23,10 @@ done
1923

2024
FILES_OMP="build/bin/*_omp"
2125
for file in $FILES_OMP; do
26+
if [ "$file" = "build/bin/*_omp" ]
27+
then
28+
continue
29+
fi
2230
start_omp=`date +%s`
2331
echo "--------------------------------"
2432
echo $(basename $file)
@@ -36,6 +44,10 @@ done
3644

3745
FILES_TBB="build/bin/*_tbb"
3846
for file in $FILES_TBB; do
47+
if [ "$file" = "build/bin/*_tbb" ]
48+
then
49+
continue
50+
fi
3951
start_tbb=`date +%s`
4052
echo "--------------------------------"
4153
echo $(basename $file)
@@ -53,6 +65,10 @@ done
5365

5466
FILES_STD="build/bin/*_std"
5567
for file in $FILES_STD; do
68+
if [ "$file" = "build/bin/*_std" ]
69+
then
70+
continue
71+
fi
5672
start_std=`date +%s`
5773
echo "--------------------------------"
5874
echo $(basename $file)
@@ -69,13 +85,17 @@ done
6985

7086
FILES_MPI="build/bin/*_mpi"
7187
for file in $FILES_MPI; do
88+
if [ "$file" = "build/bin/*_mpi" ]
89+
then
90+
continue
91+
fi
7292
start_mpi=`date +%s`
7393
echo "--------------------------------"
7494
echo $(basename $file)
7595
echo "--------------------------------"
76-
if [[ $TRAVIS_OS_NAME == 'linux' ]]; then
96+
if [[ $OSTYPE == 'linux' ]]; then
7797
NUM_PROC=$(cat /proc/cpuinfo|grep processor|wc -l)
78-
elif [[ $TRAVIS_OS_NAME == 'osx' ]]; then
98+
elif [[ $OSTYPE == 'osx' ]]; then
7999
NUM_PROC=$(sysctl -a | grep machdep.cpu | grep thread_count | cut -d ' ' -f 2)
80100
else
81101
echo "Unknown OS"

0 commit comments

Comments
 (0)