-
Notifications
You must be signed in to change notification settings - Fork 9
101 lines (85 loc) · 3.49 KB
/
create_base.yaml
File metadata and controls
101 lines (85 loc) · 3.49 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
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
# 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 Apptainer format
# only if requested. Docker images are used for building Kokkos FFT, while
# Apptainer images are used for test execution on the righteous hardware.
# It runs once month, on any push on `main` if Docker files are changed, and
# mannualy.
# It also runs on pull requests, but then the Apptainer image is not created,
# and no images are pushed to the registry.
name: Create base images
on:
schedule:
- cron: "0 1 2 * *" # every 2nd of the month at 1am UTC
push:
branches:
- 'main'
paths:
- 'docker/**/Dockerfile'
pull_request:
paths:
- 'docker/**/Dockerfile'
workflow_dispatch:
env:
# Force the use of BuildKit for Docker
DOCKER_BUILDKIT: 1
jobs:
create_base:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
image:
- name: gcc
use_apptainer: false
- name: clang
use_apptainer: false
- name: nvcc
use_apptainer: true
- name: rocm
use_apptainer: false
- name: intel
use_apptainer: false
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
with:
tool-cache: true
large-packages: false
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Get Apptainer
env:
APPTAINER_VERSION: 1.4.4
run: |
wget https://github.com/apptainer/apptainer/releases/download/v${{ env.APPTAINER_VERSION }}/apptainer_${{ env.APPTAINER_VERSION }}_amd64.deb
sudo apt-get install ./apptainer_${{ env.APPTAINER_VERSION }}_amd64.deb
- name: Login in GitHub Containers Repository with Docker
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login in GitHub Containers Repository with Apptainer
run: echo ${{ secrets.GITHUB_TOKEN }} | apptainer 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 }}:latest \
--cache-from ghcr.io/kokkos/kokkos-fft/base_${{ matrix.image.name }}: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 }}:latest
if: ${{ github.event != 'pull_request' }}
- name: Convert Docker image to Apptainer
run: apptainer build base.sif docker://ghcr.io/kokkos/kokkos-fft/base_${{ matrix.image.name }}:latest
if: ${{ matrix.image.use_apptainer && github.event != 'pull_request' }}
- name: Push Apptainer image
run: apptainer push base.sif oras://ghcr.io/kokkos/kokkos-fft/base_${{ matrix.image.name }}_apptainer:latest
if: ${{ matrix.image.use_apptainer && github.event != 'pull_request' }}