-
Notifications
You must be signed in to change notification settings - Fork 11
120 lines (110 loc) · 4.02 KB
/
containers.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
name: Containers
on:
# This Workflow can be triggered manually
workflow_dispatch:
# Build container images on a daily schedule
schedule:
- cron: '11 5 * * *'
push:
branches:
- main
pull_request:
branches:
- main
# Let's also build & tag Spack containers on releases.
release:
types: [published]
concurrency:
group: ci-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}
cancel-in-progress: true
jobs:
deploy-images:
timeout-minutes: 600
runs-on: self-hosted
permissions:
packages: write
strategy:
# Even if one container fails to build we still want the others
# to continue their builds.
fail-fast: false
# 0: image name
# 1: Dockerfile path
# 2: Platforms to build
matrix:
dockerfile: [[e4s-ubuntu-18.04, e4s-ubuntu-18.04.dockerfile, 'linux/amd64,linux/ppc64le,linux/arm64'],
[e4s-ubuntu-20.04, e4s-ubuntu-20.04.dockerfile, 'linux/amd64,linux/ppc64le,linux/arm64'],
[linux-ubuntu22.04-x86_64_v2, linux-ubuntu22.04-x86_64_v2/Dockerfile, 'linux/amd64'],
[tutorial-ubuntu-22.04, tutorial-ubuntu-22.04/Dockerfile, 'linux/amd64'],
[e4s-amazonlinux-2, e4s-amazonlinux-2.dockerfile, 'linux/amd64,linux/arm64'],
[e4s-centos-7, e4s-centos-7.dockerfile, 'linux/amd64'],
[e4s-fedora-36, e4s-fedora-36.dockerfile, 'linux/amd64,linux/ppc64le,linux/arm64'],
[pcluster-amazonlinux-2, pcluster-amazonlinux-2/Dockerfile, 'linux/amd64,linux/arm64']]
name: Build ${{ matrix.dockerfile[0] }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Container Tag
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/spack/${{ matrix.dockerfile[0] }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & Deploy ${{ matrix.dockerfile[1] }}
uses: docker/build-push-action@v4
with:
file: Dockerfiles/${{ matrix.dockerfile[1] }}
platforms: ${{ matrix.dockerfile[2] }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: |
ghcr.io/spack/${{ matrix.dockerfile[0] }}:nightly
ghcr.io/spack/${{ matrix.dockerfile[0] }}:main
ghcr.io/spack/${{ matrix.dockerfile[0] }}:latest
${{ steps.meta.outputs.tags }}
cache-to: type=inline
upload-gcc-buildcache:
timeout-minutes: 60
runs-on: self-hosted
permissions:
packages: write
needs: [ deploy-images ]
env:
CONTAINER_NAME: 'ghcr.io/spack/pcluster-amazonlinux-2'
steps:
- name: Get Container Tag
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.CONTAINER_NAME }}
- uses: actions/checkout@v4
- env:
CONTAINER_TAG: ${{ steps.meta.outputs.tags }}
run: |
id=$(docker create --platform linux/amd64 ${CONTAINER_TAG})
mkdir bootstrap-gcc-cache-x86_64
docker cp $id:/bootstrap-gcc-cache bootstrap-gcc-cache-x86_64
docker rm -v $id
id=$(docker create --platform linux/arm64 ${CONTAINER_TAG})
mkdir bootstrap-gcc-cache-aarch64
docker cp $id:/bootstrap-gcc-cache bootstrap-gcc-cache-aarch64
docker rm -v $id
- uses: actions/upload-artifact@v3
with:
name: bootstrap-gcc-cache-x86_64
path: |
bootstrap-gcc-cache-x86_64
- uses: actions/upload-artifact@v3
with:
name: bootstrap-gcc-cache-aarch64
path: |
bootstrap-gcc-cache-aarch64