-
Notifications
You must be signed in to change notification settings - Fork 6
94 lines (79 loc) · 3.37 KB
/
__build_base.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
# SPDX-FileCopyrightText: (C) The kokkos-fft development team, see COPYRIGHT.md file
#
# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
# Generate base images for each compiler environment. Images are stored on
# Github registry as Docker format inconditionnaly and as Singularity format
# only if requested. Docker images are used for building Kokkos FFT, while
# Singularity images are used for test execution on the righteous hardware.
# This workflow can only be invoked through another workflows.
name: Build base images
on:
workflow_call:
inputs:
image_suffix:
description: "Suffix of the Docker and Singularity images"
required: false
default: main
type: string
image_tag:
description: "Tag of the Docker and Singularity images"
required: false
default: latest
type: string
env:
# Force the use of BuildKit for Docker
DOCKER_BUILDKIT: 1
jobs:
build_base:
runs-on: ubuntu-latest
strategy:
matrix:
image:
- name: gcc
use_singularity: false
- name: clang
use_singularity: false
- name: nvcc
use_singularity: true
- name: rocm
use_singularity: false
- name: intel
use_singularity: false
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/[email protected]
with:
tool-cache: true
large-packages: false
- name: Checkout repository
uses: actions/checkout@v4
- name: Get Singularity
env:
SINGULARITY_VERSION: 3.11.2
run: |
wget https://github.com/sylabs/singularity/releases/download/v${{ env.SINGULARITY_VERSION }}/singularity-ce_${{ env.SINGULARITY_VERSION }}-jammy_amd64.deb
sudo apt-get install ./singularity-ce_${{ env.SINGULARITY_VERSION }}-jammy_amd64.deb
- name: Login in GitHub Containers Repository with Docker
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login in GitHub Containers Repository with Singularity
run: echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io
- name: Build Docker image
run: |
docker build \
-t ghcr.io/kokkos/kokkos-fft/base_${{ matrix.image.name }}_${{ inputs.image_suffix }}:${{ inputs.image_tag }} \
--cache-from ghcr.io/kokkos/kokkos-fft/base_${{ matrix.image.name }}_main:latest \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--progress=plain \
docker/${{ matrix.image.name }}
- name: Push Docker image
run: docker push ghcr.io/kokkos/kokkos-fft/base_${{ matrix.image.name }}_${{ inputs.image_suffix }}:${{ inputs.image_tag }}
- name: Convert Docker image to Singularity
run: singularity build base.sif docker://ghcr.io/kokkos/kokkos-fft/base_${{ matrix.image.name }}_${{ inputs.image_suffix }}:${{ inputs.image_tag }}
if: ${{ matrix.image.use_singularity }}
- name: Push Singularity image
run: singularity push base.sif oras://ghcr.io/kokkos/kokkos-fft/base_${{ matrix.image.name }}_singularity_${{ inputs.image_suffix }}:${{ inputs.image_tag }}
if: ${{ matrix.image.use_singularity }}