-
Notifications
You must be signed in to change notification settings - Fork 3
116 lines (104 loc) · 3.52 KB
/
build_and_test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Build and Test
# Builds FANS inside various docker containers and runs the tests.
on:
push:
branches:
- main
- develop
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{github.event_name == 'pull_request'}}
jobs:
build:
name: ${{ format('Ubuntu {0}, {1}', matrix.UBUNTU_VERSION, matrix.ARCH) }}
runs-on: ubuntu-latest
env:
FANS_DIR: /FANS
FANS_IMG: unistuttgartdae/fans-ci
FANS_CONTAINER: fans-ci
FANS_BUILD_DIR: build
FANS_MPI_UID: 1000
strategy:
fail-fast: false
matrix:
ARCH: [amd64, arm64]
UBUNTU_VERSION: [noble, jammy, focal]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Create and start container
run: |
docker create \
--name ${{ env.FANS_CONTAINER }} \
--platform linux/${{ matrix.ARCH }} \
--interactive \
--volume .:${{ env.FANS_DIR }} \
${{ env.FANS_IMG }}:${{ matrix.UBUNTU_VERSION }}
docker start ${{ env.FANS_CONTAINER }}
- name: Generate build directory
run: |
docker exec \
-w ${{ env.FANS_DIR }} \
${{ env.FANS_CONTAINER }} \
bash -c ' \
mkdir -p ${{ env.FANS_BUILD_DIR }} \
'
- name: Configure
run: |
docker exec \
-w ${{ env.FANS_DIR }}/${{ env.FANS_BUILD_DIR }} \
${{ env.FANS_CONTAINER }} \
bash -c ' \
cmake --version && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. \
'
- uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ format('Ubuntu {0}, {1}', matrix.UBUNTU_VERSION, matrix.ARCH) }} CMakeCache
path: ${{ env.FANS_BUILD_DIR }}/CMakeCache.txt
- uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ format('Ubuntu {0}, {1}', matrix.UBUNTU_VERSION, matrix.ARCH) }} CMakeLogs
path: '${{ env.FANS_BUILD_DIR }}/CMakeFiles/*.log'
- uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ format('Ubuntu {0}, {1}', matrix.UBUNTU_VERSION, matrix.ARCH) }} CompileCommands
path: ${{ env.FANS_BUILD_DIR }}/compile_commands.json
- name: Compile
run: |
docker exec \
-w ${{ env.FANS_DIR }}/${{ env.FANS_BUILD_DIR }} \
${{ env.FANS_CONTAINER }} \
bash -c ' \
cmake --build . -j $(nproc) || cmake --build . -j1 \
'
- name: Adjust user rights
run: |
docker exec \
-w ${{ env.FANS_DIR }} \
${{ env.FANS_CONTAINER }} \
bash -c ' \
chown -R ${{ env.FANS_MPI_UID }} ${{ env.FANS_BUILD_DIR }}
'
- name: Tests
run: |
docker exec \
-w ${{ env.FANS_DIR }}/${{ env.FANS_BUILD_DIR }} \
-u ${{ env.FANS_MPI_UID }} \
-e CTEST_OUTPUT_ON_FAILURE=1 \
${{ env.FANS_CONTAINER }} \
bash -c ' \
ctest
'
- uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ format('Ubuntu {0}, {1}', matrix.UBUNTU_VERSION, matrix.ARCH) }} CTest logs
path: ${{ env.FANS_BUILD_DIR }}/Testing/Temporary/LastTest.log