Repository navigation
66 lines (57 loc) · 1.87 KB
/
Copy pathdocker.yml
File metadata and controls
66 lines (57 loc) · 1.87 KB
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
name: Docker
# Builds the Dockerfile and checks that the installed AMReX is usable from a
# downstream CMake project. Runs when the image definition changes, and on
# demand.
on:
push:
branches: [development]
paths:
- 'Dockerfile'
- '.dockerignore'
- '.github/workflows/docker.yml'
pull_request:
paths:
- 'Dockerfile'
- '.dockerignore'
- '.github/workflows/docker.yml'
workflow_dispatch:
concurrency:
group: ${{ github.ref }}-${{ github.head_ref }}-docker
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
name: Build image and link against it
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Build the image
run: docker build -t amrex:ci --build-arg BUILD_JOBS=4 .
- name: Write a downstream project
run: |
mkdir -p smoke
cat > smoke/main.cpp <<'EOF'
#include <AMReX.H>
int main (int argc, char* argv[])
{
amrex::Initialize(argc, argv);
amrex::Finalize();
return 0;
}
EOF
cat > smoke/CMakeLists.txt <<'EOF'
cmake_minimum_required(VERSION 3.25)
# C as well as CXX: AMReXConfig.cmake asks for the C and CXX MPI
# components whenever AMReX was built with MPI, so a CXX-only
# project fails to find MPI_C.
project(smoke C CXX)
find_package(AMReX REQUIRED)
add_executable(smoke main.cpp)
target_link_libraries(smoke PUBLIC AMReX::amrex)
EOF
- name: Link it against the installed AMReX
run: |
docker run --rm -v "$PWD/smoke:/smoke:ro" amrex:ci \
bash -c 'cmake -S /smoke -B /tmp/build && cmake --build /tmp/build -j 4 && test -x /tmp/build/smoke'