@@ -15,8 +15,6 @@ concurrency:
15
15
env :
16
16
DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
17
17
DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
18
- IMAGE_NAME : ${{ github.repository_owner}}/lighthouse
19
- LCLI_IMAGE_NAME : ${{ github.repository_owner }}/lcli
20
18
# Enable self-hosted runners for the sigp repo only.
21
19
SELF_HOSTED_RUNNERS : ${{ github.repository == 'sigp/lighthouse' }}
22
20
@@ -49,27 +47,22 @@ jobs:
49
47
VERSION : ${{ env.VERSION }}
50
48
VERSION_SUFFIX : ${{ env.VERSION_SUFFIX }}
51
49
build-docker-single-arch :
52
- name : build-docker-${{ matrix.binary }}${{ matrix.features.version_suffix }}
50
+ name : build-docker-${{ matrix.binary }}-${{ matrix.cpu_arch }} ${{ matrix.features.version_suffix }}
53
51
# Use self-hosted runners only on the sigp repo.
54
52
runs-on : ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "release"]') || 'ubuntu-22.04' }}
55
53
strategy :
56
54
matrix :
57
- binary : [aarch64,
58
- aarch64-portable,
59
- x86_64,
60
- x86_64-portable]
61
- features : [
62
- {version_suffix: "", env: "gnosis,slasher-lmdb,slasher-mdbx,jemalloc"},
63
- {version_suffix: "-dev", env: "jemalloc,spec-minimal"}
64
- ]
55
+ binary : [lighthouse,
56
+ lcli]
57
+ cpu_arch : [aarch64,
58
+ x86_64]
65
59
include :
66
60
- profile : maxperf
67
61
68
62
needs : [extract-version]
69
63
env :
70
64
VERSION : ${{ needs.extract-version.outputs.VERSION }}
71
65
VERSION_SUFFIX : ${{ needs.extract-version.outputs.VERSION_SUFFIX }}
72
- FEATURE_SUFFIX : ${{ matrix.features.version_suffix }}
73
66
steps :
74
67
- uses : actions/checkout@v4
75
68
- name : Update Rust
@@ -78,27 +71,40 @@ jobs:
78
71
- name : Dockerhub login
79
72
run : |
80
73
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
81
- - name : Cross build Lighthouse binary
74
+
75
+ - name : Sets env vars for Lighthouse
76
+ if : startsWith(matrix.binary, 'lighthouse')
77
+ run : |
78
+ echo "CROSS_FEATURES=gnosis,spec-minimal,slasher-lmdb,jemalloc" >> $GITHUB_ENV
79
+
80
+ - name : Set `make` command for lighthouse
81
+ if : startsWith(matrix.binary, 'lighthouse')
82
+ run : |
83
+ echo "MAKE_CMD=build-${{ matrix.cpu_arch }}-portable" >> $GITHUB_ENV
84
+
85
+ - name : Set `make` command for lcli
86
+ if : startsWith(matrix.binary, 'lcli')
87
+ run : |
88
+ echo "MAKE_CMD=build-lcli-${{ matrix.cpu_arch }}" >> $GITHUB_ENV
89
+
90
+ - name : Cross build binaries
82
91
run : |
83
92
cargo install cross
84
- env CROSS_PROFILE=${{ matrix.profile }} CROSS_FEATURES=${{ matrix.features.env }} make build-${{ matrix.binary }}
93
+ env CROSS_PROFILE=${{ matrix.profile }} CROSS_FEATURES=${{ env.CROSS_FEATURES }} make ${{ env.MAKE_CMD }}
94
+
85
95
- name : Make bin dir
86
96
run : mkdir ./bin
87
- - name : Move cross-built binary into Docker scope (if ARM)
88
- if : startsWith(matrix.binary, 'aarch64')
89
- run : mv ./target/aarch64-unknown-linux-gnu/${{ matrix.profile }}/lighthouse ./bin
90
- - name : Move cross-built binary into Docker scope (if x86_64)
91
- if : startsWith(matrix.binary, 'x86_64')
92
- run : mv ./target/x86_64-unknown-linux-gnu/${{ matrix.profile }}/lighthouse ./bin
97
+
98
+ - name : Move cross-built binary into Docker scope
99
+ run : mv ./target/${{ matrix.cpu_arch }}-unknown-linux-gnu/${{ matrix.profile }}/${{ matrix.binary }} ./bin
100
+
93
101
- name : Map aarch64 to arm64 short arch
94
- if : startsWith(matrix.binary , 'aarch64')
102
+ if : startsWith(matrix.cpu_arch , 'aarch64')
95
103
run : echo "SHORT_ARCH=arm64" >> $GITHUB_ENV
104
+
96
105
- name : Map x86_64 to amd64 short arch
97
- if : startsWith(matrix.binary , 'x86_64')
106
+ if : startsWith(matrix.cpu_arch , 'x86_64')
98
107
run : echo "SHORT_ARCH=amd64" >> $GITHUB_ENV;
99
- - name : Set modernity suffix
100
- if : endsWith(matrix.binary, '-portable') != true
101
- run : echo "MODERNITY_SUFFIX=-modern" >> $GITHUB_ENV;
102
108
103
109
- name : Install QEMU
104
110
if : env.SELF_HOSTED_RUNNERS == 'false'
@@ -108,22 +114,41 @@ jobs:
108
114
if : env.SELF_HOSTED_RUNNERS == 'false'
109
115
uses : docker/setup-buildx-action@v3
110
116
111
- - name : Build and push
117
+ - name : Build and push (Lighthouse)
118
+ if : startsWith(matrix.binary, 'lighthouse')
112
119
uses : docker/build-push-action@v5
113
120
with :
114
121
file : ./Dockerfile.cross
115
122
context : .
116
123
platforms : linux/${{ env.SHORT_ARCH }}
117
124
push : true
118
- tags : ${{ env.IMAGE_NAME }}:${{ env.VERSION }}-${{ env.SHORT_ARCH }}${{ env.VERSION_SUFFIX }}${{ env.MODERNITY_SUFFIX }}${{ env.FEATURE_SUFFIX }}
125
+ tags : |
126
+ ${{ github.repository_owner}}/${{ matrix.binary }}:${{ env.VERSION }}-${{ env.SHORT_ARCH }}${{ env.VERSION_SUFFIX }}
127
+ ${{ github.repository_owner}}/${{ matrix.binary }}:${{ env.VERSION }}-${{ env.SHORT_ARCH }}${{ env.VERSION_SUFFIX }}-dev
128
+ ${{ github.repository_owner}}/${{ matrix.binary }}:${{ env.VERSION }}-${{ env.SHORT_ARCH }}${{ env.VERSION_SUFFIX }}-modern
129
+ ${{ github.repository_owner}}/${{ matrix.binary }}:${{ env.VERSION }}-${{ env.SHORT_ARCH }}${{ env.VERSION_SUFFIX }}-modern-dev
130
+
131
+ - name : Build and push (lcli)
132
+ if : startsWith(matrix.binary, 'lcli')
133
+ uses : docker/build-push-action@v5
134
+ with :
135
+ file : ./lcli/Dockerfile.cross
136
+ context : .
137
+ platforms : linux/${{ env.SHORT_ARCH }}
138
+ push : true
139
+
140
+ tags : |
141
+ ${{ github.repository_owner}}/${{ matrix.binary }}:${{ env.VERSION }}-${{ env.SHORT_ARCH }}${{ env.VERSION_SUFFIX }}
142
+
119
143
120
144
build-docker-multiarch :
121
- name : build-docker-multiarch ${{ matrix.modernity }}
145
+ name : build-docker-${{ matrix.binary }}-multiarch
122
146
runs-on : ubuntu-22.04
123
- needs : [build-docker-single-arch, extract-version]
124
147
strategy :
125
148
matrix :
126
- modernity : ["", "-modern"]
149
+ binary : [lighthouse,
150
+ lcli]
151
+ needs : [build-docker-single-arch, extract-version]
127
152
env :
128
153
VERSION : ${{ needs.extract-version.outputs.VERSION }}
129
154
VERSION_SUFFIX : ${{ needs.extract-version.outputs.VERSION_SUFFIX }}
@@ -135,29 +160,9 @@ jobs:
135
160
run : |
136
161
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
137
162
138
- - name : Create and push multiarch manifest
163
+ - name : Create and push multiarch manifests
139
164
run : |
140
- docker buildx imagetools create -t ${IMAGE_NAME}:${VERSION}${VERSION_SUFFIX} ${{ matrix.modernity } } \
141
- ${IMAGE_NAME}:${VERSION}-arm64${VERSION_SUFFIX} ${{ matrix.modernity } } \
142
- ${IMAGE_NAME}:${VERSION}-amd64${VERSION_SUFFIX} ${{ matrix.modernity } };
165
+ docker buildx imagetools create -t ${{ github.repository_owner}}/ ${{ matrix.binary }}:${VERSION}${VERSION_SUFFIX } \
166
+ ${{ github.repository_owner}}/ ${{ matrix.binary }}:${VERSION}-arm64${VERSION_SUFFIX } \
167
+ ${{ github.repository_owner}}/ ${{ matrix.binary }}:${VERSION}-amd64${VERSION_SUFFIX };
143
168
144
- build-docker-lcli :
145
- runs-on : ubuntu-22.04
146
- needs : [extract-version]
147
- env :
148
- VERSION : ${{ needs.extract-version.outputs.VERSION }}
149
- VERSION_SUFFIX : ${{ needs.extract-version.outputs.VERSION_SUFFIX }}
150
- steps :
151
- - uses : actions/checkout@v4
152
- - name : Dockerhub login
153
- run : |
154
- echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
155
- - name : Build lcli and push
156
- uses : docker/build-push-action@v5
157
- with :
158
- build-args : |
159
- FEATURES=portable
160
- context : .
161
- push : true
162
- file : ./lcli/Dockerfile
163
- tags : ${{ env.LCLI_IMAGE_NAME }}:${{ env.VERSION }}${{ env.VERSION_SUFFIX }}
0 commit comments