@@ -109,10 +109,109 @@ jobs:
109
109
COMMIT_MESSAGE : ${{ github.event.head_commit.message }}
110
110
COMMIT_AUTHOR : ${{ github.event.head_commit.author.username }}
111
111
112
+ build-base :
113
+ name : base (${{ matrix.image }})
114
+ runs-on : ubuntu-latest
115
+ needs : [shellcheck, test, check]
116
+ if : github.event_name == 'push'
117
+ strategy :
118
+ fail-fast : false
119
+ matrix :
120
+ image :
121
+ - ubuntu
122
+ - centos
123
+ - emscripten
124
+ outputs :
125
+ images : ${{ steps.build-docker-image.outputs.images && fromJSON(steps.build-docker-image.outputs.images) }}
126
+ coverage-artifact : ${{ steps.cov.outputs.artifact-name }}
127
+ steps :
128
+ - uses : actions/checkout@v3
129
+
130
+ - uses : ./.github/actions/setup-rust
131
+
132
+ - name : Set up Docker Buildx
133
+ if : runner.os == 'Linux'
134
+ uses : docker/setup-buildx-action@v1
135
+
136
+ - name : Build xtask
137
+ run : cargo build -p xtask
138
+
139
+ - name : Prepare Meta
140
+ id : prepare-meta
141
+ timeout-minutes : 60
142
+ run : cargo xtask ci-job prepare-meta "${IMAGE}"
143
+ env :
144
+ IMAGE : ${{ matrix.image }}
145
+ shell : bash
146
+
147
+ - name : LLVM instrument coverage
148
+ uses : ./.github/actions/cargo-llvm-cov
149
+ with :
150
+ name : cross-${{matrix.image}}
151
+
152
+ - name : Install cross
153
+ if : matrix.deploy
154
+ run : cargo install --path . --force --debug
155
+
156
+ - name : Docker Meta
157
+ id : docker-meta
158
+ uses : docker/metadata-action@v4
159
+ with :
160
+ images : |
161
+ name=${{ steps.prepare-meta.outputs.image }}
162
+ labels : |
163
+ ${{ fromJSON(steps.prepare-meta.outputs.labels) }}
164
+ - name : Build Docker image
165
+ id : build-docker-image
166
+ timeout-minutes : 60
167
+ run : cargo xtask build-docker-image -v "${IMAGE}"
168
+ env :
169
+ IMAGE : ${{ matrix.image }}
170
+ LABELS : ${{ steps.docker-meta.outputs.labels }}
171
+ LATEST : ${{ needs.check.outputs.is-latest || 'false' }}
172
+ shell : bash
173
+
174
+ - name : Save Docker Image
175
+ id : save-docker-image
176
+ run : docker save "${IMAGE}:${TAG}" -o "${IMAGE}-${TAG}.tar"
177
+ env :
178
+ IMAGE : ${{ matrix.image }}
179
+ TAG : ${{ env.GITHUB_REF_NAME }}
180
+
181
+ - uses : actions/upload-artifact@v2
182
+ with :
183
+ name : ${{ matrix.image }}-image-tarball
184
+ path : ${{ matrix.image }}-${{ env.GITHUB_REF_NAME }}.tar
185
+
186
+ - uses : ./.github/actions/cargo-install-upload-artifacts
187
+ if : matrix.deploy
188
+ with :
189
+ target : ${{ matrix.image }}
190
+ image : ${{ steps.build-docker-image.outputs.image }}
191
+
192
+ - name : Login to GitHub Container Registry
193
+ uses : docker/login-action@v1
194
+ with :
195
+ registry : ghcr.io
196
+ username : ${{ github.actor }}
197
+ password : ${{ secrets.GITHUB_TOKEN }}
198
+ - name : Push image to GitHub Container Registry
199
+ if : >
200
+ (
201
+ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ||
202
+ startsWith(github.ref, 'refs/tags/v')
203
+ )
204
+ run : cargo xtask build-docker-image -v --push "${IMAGE}"
205
+ env :
206
+ IMAGE : ${{ matrix.target }}
207
+ LABELS : ${{ steps.docker-meta.outputs.labels }}
208
+ LATEST : ${{ needs.check.outputs.is-latest || 'false' }}
209
+ shell : bash
210
+
112
211
build :
113
212
name : target (${{ matrix.pretty }},${{ matrix.os }})
114
213
runs-on : ${{ matrix.os }}
115
- needs : [shellcheck, test, generate-matrix, check]
214
+ needs : [shellcheck, test, generate-matrix, check, build-base ]
116
215
if : github.event_name == 'push'
117
216
strategy :
118
217
fail-fast : false
0 commit comments