-
Notifications
You must be signed in to change notification settings - Fork 40
605 lines (509 loc) · 22.1 KB
/
github-build-test.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
name: Build/Test
on:
push:
pull_request:
env:
MAKE_BUILD_FLAGS: -j2
GRID_REPOSITORY_REF: feature/gpt
CC: mpicc
CXX: mpic++
OMPI_CC: cc
OMPI_CXX: c++
MPICH_CC: cc
MPICH_CXX: c++
# Note if this is changed, all caches will be not be valid anymore
CACHE_KEY: 2024-05-18
jobs:
build-grid:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
compiler: ['gcc', 'clang']
mpi: ['none', 'mpich', 'openmpi']
outputs:
c-lime-version: ${{ steps.c-lime-version.outputs.key }}
grid-version: ${{ steps.grid-version.outputs.key }}
steps:
- name: Check Hardware
run: |
cat /proc/cpuinfo | grep avx2
- name: Install Ubuntu packages
run: |
sudo apt-get update
sudo apt-get install -y clang-14 libmpfr-dev libgmp-dev libssl-dev zlib1g-dev libmpich-dev libopenmpi-dev libfftw3-dev
- name: Set compiler alternatives to clang
if: matrix.compiler == 'clang'
run: |
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang 1
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 1
sudo update-alternatives --set cc /usr/bin/clang
sudo update-alternatives --set c++ /usr/bin/clang++
- name: Set compiler to cc and c++
if: matrix.mpi == 'none'
run: |
echo 'CC=cc' >> $GITHUB_ENV
echo 'CXX=c++' >> $GITHUB_ENV
- name: Set MPI alternatives to mpich
if: matrix.mpi == 'mpich'
run: |
sudo update-alternatives --set mpi /usr/bin/mpicc.mpich
sudo update-alternatives --set mpirun /usr/bin/mpirun.mpich
sudo update-alternatives --set mpi-x86_64-linux-gnu /usr/include/x86_64-linux-gnu/mpich
- name: Clone c-lime
uses: actions/checkout@v3
with:
repository: usqcd-software/c-lime
path: c-lime
- name: Get c-lime cache key
id: c-lime-version
run: |
cd c-lime
echo "key=$(git rev-parse HEAD)-${CACHE_KEY}-PIC" >> $GITHUB_OUTPUT
- name: c-lime package cache
uses: actions/cache@v3
id: c-lime-package-cache
with:
path: c-lime-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb
key: c-lime-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ steps.c-lime-version.outputs.key }}
- name: Build and package c-lime
if: steps.c-lime-package-cache.outputs.cache-hit != 'true'
run: |
PKGDIR=$PWD/c-lime-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}
mkdir -p $PKGDIR
cd c-lime
./autogen.sh
./configure CFLAGS="-fPIC" CXXFLAGS="-fPIC" || cat config.log
make ${MAKE_BUILD_FLAGS}
DESTDIR=$PKGDIR make install
cd $PKGDIR
mkdir -p DEBIAN
wget -nv -O ./DEBIAN/control https://gist.githubusercontent.com/lehner/a0feb168a9cb2068e0345a94b2df2eb9/raw/79dd47ef34aa7166191c7d8293372bcb4b9a5533/deb.general.control
sed -e 's/%pkgname%/c-lime/g' -e 's/%version%/0.0.1/g' -e 's/%size%/1024/g' -e 's/%maintainer%/GPT Dev Team/g' -e 's/%description%/C-LIME/g' -i ./DEBIAN/control
cd -
dpkg-deb --build $PKGDIR
- name: Install c-lime
run: |
sudo dpkg -i c-lime-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb
- name: Clone Grid
uses: actions/checkout@v3
with:
repository: lehner/Grid
ref: ${{ env.GRID_REPOSITORY_REF }}
path: Grid
- name: Get Grid cache key
id: grid-version
run: |
cd Grid
./bootstrap.sh
mkdir -p build
cd build
if [ "${{ matrix.mpi }}" == "none" ]
then
../configure CXXFLAGS=-fPIC --enable-simd=AVX2 || cat config.log
else
../configure CXXFLAGS=-fPIC --enable-simd=AVX2 --enable-comms=mpi-auto || cat config.log
fi
cd Grid
make version-cache Version.h
echo "key=$(sha256sum version-cache|cut -f 1 -d " ")-${CACHE_KEY}" >> $GITHUB_OUTPUT
- name: Grid package cache
uses: actions/cache@v3
id: grid-package-cache
with:
path: grid-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb
key: grid-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ steps.grid-version.outputs.key }}
- name: Build and package Grid
if: steps.grid-package-cache.outputs.cache-hit != 'true'
run: |
PKGDIR=$PWD/grid-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}
mkdir -p $PKGDIR
cd Grid/build/Grid
make ${MAKE_BUILD_FLAGS}
DESTDIR=$PKGDIR make install
cd .. && install -D -m755 grid-config ${PKGDIR}/usr/bin/grid-config || return 1
cd $PKGDIR
mkdir -p DEBIAN
wget -nv -O ./DEBIAN/control https://gist.githubusercontent.com/lehner/a0feb168a9cb2068e0345a94b2df2eb9/raw/79dd47ef34aa7166191c7d8293372bcb4b9a5533/deb.general.control
sed -e 's/%pkgname%/grid/g' -e 's/%version%/0.0.1/g' -e 's/%size%/1024/g' -e 's/%maintainer%/GPT Dev Team/g' -e 's/%description%/Grid/g' -i ./DEBIAN/control
cd -
dpkg-deb --build $PKGDIR
build-gpt:
needs: build-grid
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: ['3.8','3.9','3.10']
compiler: ['gcc', 'clang']
mpi: ['none', 'mpich', 'openmpi']
outputs:
cgpt-version: ${{ steps.cgpt-version.outputs.key }}
gpt-version: ${{ steps.gpt-version.outputs.key }}
python-gpt-version: ${{ steps.python-gpt-version.outputs.version }}
steps:
- name: Check Hardware
run: |
cat /proc/cpuinfo | grep avx2
- name: Install Ubuntu packages
run: |
sudo apt-get update
sudo apt-get install -y clang-14 libmpfr-dev libgmp-dev libssl-dev zlib1g-dev libmpich-dev libopenmpi-dev libfftw3-dev
- name: Set compiler alternatives to clang
if: matrix.compiler == 'clang'
run: |
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang 1
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 1
sudo update-alternatives --set cc /usr/bin/clang
sudo update-alternatives --set c++ /usr/bin/clang++
- name: Set MPI alternatives to mpich
if: matrix.mpi == 'mpich'
run: |
sudo update-alternatives --set mpi /usr/bin/mpicc.mpich
sudo update-alternatives --set mpirun /usr/bin/mpirun.mpich
sudo update-alternatives --set mpi-x86_64-linux-gnu /usr/include/x86_64-linux-gnu/mpich
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Setup python dependencies
run: |
pip install numpy
- name: c-lime package cache
uses: actions/cache@v3
id: c-lime-package-cache
with:
path: c-lime-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb
key: c-lime-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ needs.build-grid.outputs.c-lime-version }}
- name: Install c-lime
run: |
sudo dpkg -i c-lime-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb
- name: Grid package cache
uses: actions/cache@v3
id: grid-package-cache
with:
path: grid-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb
key: grid-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ needs.build-grid.outputs.grid-version }}
- name: Install Grid
run: |
sudo dpkg -i grid-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb
- name: Clone gpt
uses: actions/checkout@v3
with:
path: gpt
- name: Get cgpt cache key
id: cgpt-version
# Currently it is not possible to use multiple patterns with hashFiles, therefore we use our own hashing, see:
# https://github.community/t/hashfiles-with-multiple-patterns/17168
run: |
# TODO: if the make and make.summit files are removed from ./gpt/lib/cgpt we can use the complete folder for hashing
echo ${{ hashFiles('gpt/lib/cgpt/lib/**') }} >> cgpt_cache_key_file
echo ${{ needs.build-grid.outputs.grid-version }} >> cgpt_cache_key_file
echo "key=$(sha256sum cgpt_cache_key_file|cut -f 1 -d " ")-${CACHE_KEY}" >> $GITHUB_OUTPUT
- name: Get gpt cache key
id: gpt-version
# Currently it is not possible to use multiple patterns with hashFiles, therefore we use our own hashing, see:
# https://github.community/t/hashfiles-with-multiple-patterns/17168
run: |
echo ${{ hashFiles('gpt/lib/gpt/**') }} >> gpt_cache_key_file
echo "key=$(sha256sum gpt_cache_key_file|cut -f 1 -d " ")-${CACHE_KEY}" >> $GITHUB_OUTPUT
- name: Get python-gpt version
id: python-gpt-version
run: |
gpt_version=$(printf "0.0.0r%s" "$(cd gpt && git rev-parse --short HEAD)")
echo "version=${gpt_version}" >> $GITHUB_OUTPUT
- name: cgpt package cache
uses: actions/cache@v3
id: cgpt-package-cache
with:
path: cgpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb
key: cgpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ steps.cgpt-version.outputs.key }}
- name: Build and package cgpt
if: steps.cgpt-package-cache.outputs.cache-hit != 'true'
run: |
PKGDIR=$PWD/cgpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}
mkdir -p $PKGDIR
cd gpt/lib/cgpt
./make %grid-config 2
SITEPACKAGES="/usr/local/lib/python${{ matrix.python-version}}/site-packages"
DST="${PKGDIR}/${SITEPACKAGES}"
mkdir -p ${DST}
cp build/cgpt.so ${DST}
cd $PKGDIR
mkdir -p DEBIAN
wget -nv -O ./DEBIAN/control https://gist.githubusercontent.com/lehner/a0feb168a9cb2068e0345a94b2df2eb9/raw/79dd47ef34aa7166191c7d8293372bcb4b9a5533/deb.general.control
sed -e 's/%pkgname%/cgpt/g' -e 's/%version%/0.0.1/g' -e 's/%size%/1024/g' -e 's/%maintainer%/GPT Dev Team/g' -e 's/%description%/cgpt/g' -i ./DEBIAN/control
cd -
dpkg-deb --build $PKGDIR
- name: gpt package cache
uses: actions/cache@v3
id: gpt-package-cache
with:
path: gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb
key: gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ steps.gpt-version.outputs.key }}
- name: Build and package gpt
if: steps.gpt-package-cache.outputs.cache-hit != 'true'
run: |
PKGDIR=$PWD/gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}
mkdir -p $PKGDIR
cd gpt
python3 -m compileall lib/gpt
SITEPACKAGES="/usr/local/lib/python${{ matrix.python-version}}/site-packages"
DST="${PKGDIR}/${SITEPACKAGES}"
mkdir -p ${DST}
cp -r lib/gpt ${DST}
cd $PKGDIR
mkdir -p DEBIAN
wget -nv -O ./DEBIAN/control https://gist.githubusercontent.com/lehner/a0feb168a9cb2068e0345a94b2df2eb9/raw/79dd47ef34aa7166191c7d8293372bcb4b9a5533/deb.general.control
sed -e 's/%pkgname%/gpt/g' -e 's/%version%/0.0.1/g' -e 's/%size%/1024/g' -e 's/%maintainer%/GPT Dev Team/g' -e 's/%description%/gpt/g' -i ./DEBIAN/control
cd -
dpkg-deb --build $PKGDIR
- name: Create combined package
run: |
PKGDIR=$PWD/python-gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}
dpkg-deb -X gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb ${PKGDIR}
dpkg-deb -X cgpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb ${PKGDIR}
cd ${PKGDIR}
mkdir -p DEBIAN
wget -nv -O ./DEBIAN/control https://gist.githubusercontent.com/lehner/a0feb168a9cb2068e0345a94b2df2eb9/raw/79dd47ef34aa7166191c7d8293372bcb4b9a5533/deb.general.control
sed -e 's/%pkgname%/python-gpt/g' \
-e "s/%version%/${{ steps.python-gpt-version.outputs.version }}/g" \
-e "s/%size%/$(du -sk .|grep --color=never -E '[0-9]+' -o)/g" \
-e 's/%maintainer%/GPT Dev Team/g' -e 's/%description%/gpt/g' -i ./DEBIAN/control
cd -
dpkg-deb --build $PKGDIR
- name: Create artifact for python-gpt package
uses: actions/upload-artifact@v3
with:
path: python-gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb
name: python-gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ steps.python-gpt-version.outputs.version }}
test-gpt:
needs: [build-grid, build-gpt]
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: ['3.8','3.9','3.10']
compiler: ['gcc', 'clang']
mpi: ['none', 'mpich', 'openmpi']
steps:
- name: Report Hardware
run: |
cat /proc/cpuinfo
- name: Install Ubuntu packages
run: |
sudo apt-get update
sudo apt-get install -y clang-14 libmpfr-dev libgmp-dev libssl-dev zlib1g-dev libmpich-dev libopenmpi-dev libfftw3-dev
- name: Set compiler alternatives to clang
if: matrix.compiler == 'clang'
run: |
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang 1
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 1
sudo update-alternatives --set cc /usr/bin/clang
sudo update-alternatives --set c++ /usr/bin/clang++
- name: Set MPI alternatives to mpich
if: matrix.mpi == 'mpich'
run: |
sudo update-alternatives --set mpi /usr/bin/mpicc.mpich
sudo update-alternatives --set mpirun /usr/bin/mpirun.mpich
sudo update-alternatives --set mpi-x86_64-linux-gnu /usr/include/x86_64-linux-gnu/mpich
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Setup python dependencies
run: |
pip install numpy coverage
- name: Download prebuild python-gpt
uses: actions/download-artifact@v3
with:
name: python-gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ needs.build-gpt.outputs.python-gpt-version }}
- name: Install python-gpt
run: |
sudo dpkg -i python-gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb
- name: Clone gpt
uses: actions/checkout@v3
with:
path: gpt
- name: Run tests
if: matrix.mpi == 'none'
run: |
cd gpt
export PYTHONPATH=/usr/local/lib/python${{ matrix.python-version}}/site-packages:/usr/local/lib64/python${{ matrix.python-version}}/site-packages
export WORK_DIR=$(mktemp -d)
./tests/run "coverage run" "--mpi_split 1.1.1.1"
- name: Run tests
if: matrix.mpi == 'openmpi'
env:
LD_PRELOAD: libmpi.so
run: |
cd gpt
export PYTHONPATH=/usr/local/lib/python${{ matrix.python-version}}/site-packages:/usr/local/lib64/python${{ matrix.python-version}}/site-packages
export WORK_DIR=$(mktemp -d)
mpirun -np 2 -mca btl ^openib -bind-to core python tests/core/scalar.py --mpi 1.1.1.2
./tests/run "mpirun -np 1 -mca btl ^openib coverage run" "--mpi_split 1.1.1.1"
./tests/run "mpirun -np 2 -bind-to core -mca btl ^openib coverage run" "--mpi 1.1.1.2 --mpi 1.1.2 --mpi 2 --mpi_split 1.1.1.1 --shm 256"
- name: Run tests
if: matrix.mpi == 'mpich'
run: |
export PYTHONPATH=/usr/local/lib/python${{ matrix.python-version}}/site-packages:/usr/local/lib64/python${{ matrix.python-version}}/site-packages
cd gpt
export WORK_DIR=$(mktemp -d)
./tests/run "mpirun -np 1 coverage run" "--mpi_split 1.1.1.1"
./tests/run "mpirun -np 2 -bind-to core coverage run" "--mpi 1.1.1.2 --mpi 1.1.2 --mpi 2 --mpi_split 1.1.1.1 --shm 256"
- name: Coverage report
run: |
cd gpt
coverage combine
coverage report -m # Print coverage report to screen
coverage xml # Export coverage report as XML file, for codecov.io
- name: Upload coverage to Codecov
env:
PYTHON_VERSION: python${{ matrix.python-version }}
COMPILER: ${{ matrix.compiler }}
MPI: ${{ matrix.mpi }}
CODECOV_ENV: PYTHON_VERSION,COMPILER,MPI
run: |
cd gpt
if [ "${{ secrets.CODECOV_USERNAME }}" != "" ] \
&& [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/master" ] && 0
then
bash <(curl -s https://codecov.io/bash) \
-f ./coverage.xml
else
echo "Skip uploading code coverage since we are not upstream"
fi
build-gpt-doc:
needs: [build-grid, build-gpt]
runs-on: ubuntu-22.04
steps:
- name: Install Ubuntu packages
run: |
sudo apt-get update
sudo apt-get install -y clang-14 libmpfr-dev libgmp-dev libssl-dev zlib1g-dev libmpich-dev libopenmpi-dev
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: x64
- name: Setup python dependencies
run: |
pip install numpy sphinx ipython sphinxcontrib-napoleon
- name: Download prebuild python-gpt
uses: actions/download-artifact@v3
with:
name: python-gpt-${{ runner.os }}-python-3.10-gcc-none-${{ needs.build-gpt.outputs.python-gpt-version }}
- name: Install python-gpt
run: |
sudo dpkg -i python-gpt-${{ runner.os }}-python-3.10-gcc-none.deb
- name: Clone gpt
uses: actions/checkout@v3
with:
path: gpt
- name: Build documentation
id: build-documentation
env:
PYTHONPATH: /usr/local/lib/python3.10/site-packages:/usr/local/lib64/python3.10/site-packages
run: |
cd gpt/documentation
make html
- uses: actions/upload-artifact@v3
with:
name: documentation
path: gpt/documentation/build
build-gpt-docker-base:
needs: [build-grid, build-gpt, test-gpt]
runs-on: ubuntu-22.04
steps:
- name: Check for rebuild
id: check-build
run: |
if [ "${{ secrets.DOCKER_USERNAME }}" != "" ] && [ "${{ secrets.DOCKER_PASSWORD }}" != "" ] \
&& [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/master" ]
then
echo "build=1" >> $GITHUB_OUTPUT
else
echo "Skipping docker build."
fi
- name: Clone gpt
if: ${{ steps.check-build.outputs.build }}
uses: actions/checkout@v3
- name: Build docker gpt/base image
if: ${{ steps.check-build.outputs.build }}
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ secrets.DOCKER_USERNAME }}/base
tags: latest
push: true
path: docker/base
build-gpt-docker:
needs: [build-grid, build-gpt, test-gpt, build-gpt-docker-base]
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
compiler: ['gcc', 'clang']
# TODO: add other mpi flavors: 'mpich', 'openmpi'
mpi: ['none']
steps:
- name: Check for rebuild
id: check-build
run: |
if [ "${{ secrets.DOCKER_USERNAME }}" != "" ] && [ "${{ secrets.DOCKER_PASSWORD }}" != "" ] \
&& [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/master" ]
then
echo "build=1" >> $GITHUB_OUTPUT
else
echo "Skipping docker build."
fi
- name: Clone gpt
if: ${{ steps.check-build.outputs.build }}
uses: actions/checkout@v3
- name: Download prebuild python-gpt
if: ${{ steps.check-build.outputs.build }}
uses: actions/download-artifact@v3
with:
name: python-gpt-${{ runner.os }}-python-3.10-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ needs.build-gpt.outputs.python-gpt-version }}
- name: Move python-gpt package to docker folder
if: ${{ steps.check-build.outputs.build }}
run: |
mv python-gpt-${{ runner.os }}-python-3.10-${{ matrix.compiler }}-${{ matrix.mpi }}.deb docker/shell/gpt-packages
cp -r documentation/tutorials/ docker/notebook
cp -r tests/ benchmarks/ applications/ docker/shell
- name: Get Tags
if: ${{ steps.check-build.outputs.build }}
id: get-docker-tags
run: |
tags="${{ matrix.compiler }}-${{ matrix.mpi }}"
# reset this to clang at a later time
[ "${{ matrix.compiler }}-${{ matrix.mpi }}" == "gcc-none" ] && tags="${tags},latest"
echo "Image Tags: ${tags}"
echo "tags=${tags}" >> $GITHUB_OUTPUT
- name: Build docker gpt/shell image
if: ${{ steps.check-build.outputs.build }}
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ secrets.DOCKER_USERNAME }}/shell
build_args: BASE_IMAGE=${{ secrets.DOCKER_USERNAME }}/base,COMPILER=${{ matrix.compiler }},MPI=${{ matrix.mpi }}
tags: ${{ steps.get-docker-tags.outputs.tags }}
push: true
path: docker/shell
always_pull: true
- name: Build docker gpt/notebook image
if: ${{ steps.check-build.outputs.build }}
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ secrets.DOCKER_USERNAME }}/notebook
build_args: BASE_IMAGE=${{ secrets.DOCKER_USERNAME }}/shell,COMPILER=${{ matrix.compiler }},MPI=${{ matrix.mpi }}
tags: ${{ steps.get-docker-tags.outputs.tags }}
push: true
path: docker/notebook
always_pull: true