Skip to content

Commit 8d187fc

Browse files
dalcinljeffhammond
authored andcommitted
Setup GitHub Actions
1 parent 8a12381 commit 8d187fc

File tree

3 files changed

+151
-0
lines changed

3 files changed

+151
-0
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly

.github/workflows/ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: ci
2+
3+
on: # yamllint disable-line rule:truthy
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
21+
22+
cmake:
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
os:
28+
- ubuntu-22.04
29+
- ubuntu-20.04
30+
- macos-14
31+
- macos-13
32+
steps:
33+
- uses: actions/checkout@v4
34+
- run: bash -x build-cmake.sh
35+
- run: bash check.sh
36+
37+
meson:
38+
runs-on: ${{ matrix.os }}
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
os:
43+
- ubuntu-22.04
44+
- ubuntu-20.04
45+
- macos-14
46+
- macos-13
47+
steps:
48+
- uses: actions/checkout@v4
49+
- uses: actions/setup-python@v5
50+
with: {python-version: '3.x'}
51+
- run: python -m pip install meson ninja
52+
- run: bash -x build-meson.sh
53+
- run: bash check.sh
54+
55+
make:
56+
runs-on: ${{ matrix.os }}
57+
strategy:
58+
fail-fast: false
59+
matrix:
60+
os:
61+
- ubuntu-22.04
62+
- ubuntu-20.04
63+
- macos-14
64+
- macos-13
65+
steps:
66+
- uses: actions/checkout@v4
67+
- run: make
68+
- run: bash check.sh

check.sh

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
prefix=${PREFIX:-$PWD}
5+
export PATH=${prefix}/bin:$PATH
6+
7+
case "$(uname)" in
8+
Linux)
9+
so=".so"
10+
;;
11+
Darwin)
12+
ldd () { otool -L "$1"; }
13+
so=".dylib"
14+
;;
15+
esac
16+
17+
tempdir="$(mktemp -d)"
18+
trap 'rm -rf $tempdir' EXIT
19+
cd "$tempdir" || exit
20+
21+
cat > helloworld.c << EOF
22+
#include <mpi.h>
23+
#include <stdio.h>
24+
int main(int argc, char *argv[])
25+
{
26+
int size, rank, len;
27+
char name[MPI_MAX_PROCESSOR_NAME];
28+
29+
MPI_Init(&argc, &argv);
30+
MPI_Comm_size(MPI_COMM_WORLD, &size);
31+
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
32+
MPI_Get_processor_name(name, &len);
33+
printf("Hello, World! I am process %d of %d on %s.\n", rank, size, name);
34+
MPI_Finalize();
35+
return 0;
36+
}
37+
EOF
38+
ln -s helloworld.c helloworld.cxx
39+
40+
command -v mpicc
41+
command -v mpicxx
42+
echo "$(mpicc -show-incdir)/mpi.h":
43+
grep -E 'MPI_(SUB)?VERSION' "$(mpicc -show-incdir)/mpi.h"
44+
echo "$(mpicc -show-libdir)/lib$(mpicc -show-libs)$so":
45+
ldd "$(mpicc -show-libdir)/lib$(mpicc -show-libs)$so"
46+
47+
set -x
48+
49+
RPATH=-Wl,-rpath,$(mpicc -show-libdir)
50+
51+
mpicc -show
52+
mpicc -show-incdir
53+
mpicc -show-libdir
54+
mpicc -show-libs
55+
for cc in gcc clang; do
56+
"$cc" -v > cc.log 2>&1
57+
mpicc -cc="$cc" -v > mpicc.log 2>&1
58+
diff cc.log mpicc.log
59+
mpicc -cc="$cc" ./helloworld.c -c
60+
test -f helloworld.o && rm helloworld.o
61+
mpicc -cc="$cc" ./helloworld.c "$RPATH"
62+
ldd a.out && rm a.out
63+
done
64+
65+
mpicxx -show
66+
mpicxx -show-incdir
67+
mpicxx -show-libdir
68+
mpicxx -show-libs
69+
for cxx in g++ clang++; do
70+
"$cxx" -v > cxx.log 2>&1
71+
mpicxx -cxx="$cxx" -v > mpicxx.log 2>&1
72+
diff cxx.log mpicxx.log
73+
mpicxx -cxx="$cxx" ./helloworld.cxx -c
74+
test -f helloworld.o && rm helloworld.o
75+
mpicxx -cxx="$cxx" ./helloworld.cxx "$RPATH"
76+
ldd a.out && rm a.out
77+
done

0 commit comments

Comments
 (0)