-
Notifications
You must be signed in to change notification settings - Fork 1
169 lines (147 loc) · 6.47 KB
/
build.yml
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: Build
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
schedule:
# As advised by https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule,
# let's start the scheduled action at a somewhat random time to avoid periods of high load.
- cron: '42 5 * * 3'
env:
REGISTRY: ghcr.io
jobs:
set-vars:
runs-on: [ubuntu-latest]
outputs:
CI_IMAGE : ${{ steps.common.outputs.CI_IMAGE }}
steps:
- name: Export common variables.
id : common
run : |
echo "CI_IMAGE=${{ env.REGISTRY }}/${{ github.repository }}/kokkos-utils" >> $GITHUB_OUTPUT
build-image:
needs: [set-vars]
runs-on: [ubuntu-latest]
container:
image: docker:latest
permissions:
packages: write
strategy:
fail-fast: false
matrix:
include:
- backend : Cuda
compiler_family: nvidia
base_image : nvidia/cuda:12.3.2-devel-ubuntu22.04
platforms : linux/amd64
kokkos_arch : VOLTA70
- backend : OpenMP
compiler_family: gcc
base_image : ubuntu:24.04
platforms : linux/amd64,linux/arm64
steps:
- name: Checkout code.
uses: actions/checkout@v4
- name: Prepare.
run: |
apk add jq
echo "CMAKE_VERSION=$( jq .dependencies.cmake.value version.json -j)" >> $GITHUB_ENV
echo "DOXYGEN_VERSION=$( jq .dependencies.doxygen.value version.json -j)" >> $GITHUB_ENV
echo "GOOGLETEST_VERSION=$(jq .dependencies.googletest.value version.json -j)" >> $GITHUB_ENV
echo "KOKKOS_VERSION=$( jq .dependencies.kokkos.value version.json -j)" >> $GITHUB_ENV
- name: Set up QEMU.
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx.
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry.
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push.
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.platforms }}
push: ${{ github.ref == 'refs/heads/develop' }}
file: docker/dockerfile
tags: ${{ needs.set-vars.outputs.CI_IMAGE }}:${{ matrix.compiler_family }}-${{ matrix.backend }}
cache-from: type=registry,ref=${{ needs.set-vars.outputs.CI_IMAGE }}:${{ matrix.compiler_family }}-${{ matrix.backend }}
cache-to: type=inline
target: final
build-args: |
BASE_IMAGE=${{ matrix.base_image }}
CMAKE_VERSION=${{ env.CMAKE_VERSION }}
DOXYGEN_VERSION=${{ env.DOXYGEN_VERSION }}
GOOGLETEST_VERSION=${{ env.GOOGLETEST_VERSION }}
KOKKOS_ARCH=${{ matrix.kokkos_arch }}
KOKKOS_PRESET=${{ matrix.compiler_family }}-${{ matrix.backend }}
KOKKOS_VERSION=${{ env.KOKKOS_VERSION }}
labels: "org.opencontainers.image.source=${{ github.repositoryUrl }}"
build-library-and-test:
needs: [set-vars, build-image]
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
matrix:
include:
- backend : Cuda
compiler_family: nvidia
run_tests : false
- backend : OpenMP
compiler_family: gcc
run_tests : true
container:
image: ${{ needs.set-vars.outputs.CI_IMAGE }}:${{ matrix.compiler_family }}-${{ matrix.backend }}
steps:
- name: Checkout code.
uses: actions/checkout@v4
- name: Configure and build.
run : |
cmake -S . --preset=${{ matrix.compiler_family }}-${{ matrix.backend }} --warn-uninitialized -Werror=dev
cmake --build --preset=${{ matrix.compiler_family }}-${{ matrix.backend }}
- name: Test.
if : ${{ matrix.run_tests }}
run : |
ctest --preset=${{ matrix.compiler_family }}-${{ matrix.backend }}
build-documentation:
needs: [set-vars, build-image]
runs-on: [ubuntu-latest]
container:
image: ${{ needs.set-vars.outputs.CI_IMAGE }}:gcc-OpenMP
steps:
- name: Checkout code.
uses: actions/checkout@v4
- name: Build Doxygen documentation.
run : |
cmake -S . --preset=gcc-OpenMP --warn-uninitialized -Werror=dev
cmake --build --preset=gcc-OpenMP --target=docs
- name: Upload Pages artifacts.
uses: actions/upload-pages-artifact@v3
with:
path: build-with-gcc-OpenMP/docs/html
# The deploy job is heavily inspired from https://github.com/actions/deploy-pages.
deploy:
# The deployment only happens if the library can be built and the documentation generated.
needs: [build-library-and-test, build-documentation]
runs-on: [ubuntu-latest]
# The deployment only happens for 'main' or 'develop' branch.
if: ${{ contains(fromJSON('["refs/heads/main", "refs/heads/develop"]'), github.ref) }}
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages.
id : deployment
uses: actions/deploy-pages@v4