-
Notifications
You must be signed in to change notification settings - Fork 13
151 lines (139 loc) · 5.33 KB
/
catalyst.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
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
name: Docker build
on:
pull_request:
push:
branches:
- main
tags:
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
docker:
name: ${{ matrix.docker_images.label }} (${{ matrix.targets.target_suffix }}${{ matrix.targets.debug_suffix }})
runs-on: ubuntu-latest-m
permissions:
packages: write
contents: read
strategy:
fail-fast: false
matrix:
targets:
# example: livepeer/catalyst:latest
# primary multi-platform stripped build
- platforms: linux/amd64, linux/arm64
target: stripped
target_suffix: ""
debug_suffix: ""
# example: livepeer/catalyst:latest-amd64
# primarily useful so we can deploy the amd64 version prior to the slow, emulated arm64 build to succeed
- platforms: linux/amd64
target: stripped
target_suffix: "-amd64"
debug_suffix: ""
# example: livepeer/catalyst:latest-arm64
- platforms: linux/arm64
target: stripped
target_suffix: "-arm64"
debug_suffix: ""
# example: livepeer/catalyst:latest-amd64-debug
# unstripped binaries for use with gdb coredump debugging
- platforms: linux/amd64
target: full
target_suffix: "-amd64"
debug_suffix: "-debug"
# example: livepeer/catalyst:latest-arm64-debug
- platforms: linux/arm64
target: full
target_suffix: "-arm64"
debug_suffix: "-debug"
docker_images:
- target: catalyst
label: livepeer/catalyst
refs: |
livepeer/catalyst-lite
livepeerci/catalyst
- target: livepeer-in-a-box
label: livepeer/in-a-box
refs: |
livepeer/in-a-box
livepeer/catalyst
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v3
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
with:
username: ${{ secrets.CI_DOCKERHUB_USERNAME }}
password: ${{ secrets.CI_DOCKERHUB_TOKEN }}
- name: Log in to the Container registry
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
flavor: |
suffix=${{ matrix.targets.target_suffix }}${{ matrix.targets.debug_suffix }},onlatest=true
images: |
${{ matrix.docker_images.refs }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha
type=sha,format=long
type=semver,pattern={{version}},prefix=v
type=semver,pattern={{major}}.{{minor}},prefix=v
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=${{ (github.event_name == 'pull_request' && github.head_ref) || github.ref_name }}
- name: Build and push
uses: docker/build-push-action@v5
with:
platforms: ${{ matrix.targets.platforms }}
push: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
target: ${{ matrix.docker_images.target }}
build-args: |
GIT_VERSION=${{ github.ref_type == 'tag' && github.ref_name || github.event.pull_request.head.sha || github.sha }}
BUILD_TARGET=${{ matrix.targets.target }}
FROM_LOCAL_PARENT=scratch
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Notify new build upload
if: ${{ matrix.targets.target_suffix == '-amd64' && matrix.targets.target == 'stripped' }}
run: curl -X POST https://holy-bread-207a.livepeer.workers.dev
# https://brunoscheufler.com/blog/2022-04-09-the-required-github-status-check-that-wasnt
after-docker:
needs: docker # run after docker
runs-on: ubuntu-latest
if: success() # only run when all shards have passed
# store success output flag for ci job
outputs:
success: ${{ steps.setoutput.outputs.success }}
steps:
- id: setoutput
run: echo "::set-output name=success::true"
ci:
runs-on: ubuntu-latest
if: always() # always run, so we never skip the check
needs: [docker, after-docker]
steps:
- run: |
passed="${{ needs.after-docker.outputs.success }}"
if [[ $passed == "true" ]]; then
echo "Docker builds passed!"
exit 0
else
echo "Docker builds failed; check the CI tasks adjacent to this one for the actual cause of failure. Sometimes if a runner runs out of disk space it shows up as 'Skipped'."
exit 1
fi