@@ -109,10 +109,97 @@ 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
+ - uses : ./.github/actions/cargo-install-upload-artifacts
175
+ if : matrix.deploy
176
+ with :
177
+ target : ${{ matrix.image }}
178
+ image : ${{ steps.build-docker-image.outputs.image }}
179
+
180
+ - name : Login to GitHub Container Registry
181
+ uses : docker/login-action@v1
182
+ with :
183
+ registry : ghcr.io
184
+ username : ${{ github.actor }}
185
+ password : ${{ secrets.GITHUB_TOKEN }}
186
+ - name : Push image to GitHub Container Registry
187
+ if : >
188
+ (
189
+ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ||
190
+ startsWith(github.ref, 'refs/tags/v')
191
+ )
192
+ run : cargo xtask build-docker-image -v --push "${IMAGE}"
193
+ env :
194
+ IMAGE : ${{ matrix.target }}
195
+ LABELS : ${{ steps.docker-meta.outputs.labels }}
196
+ LATEST : ${{ needs.check.outputs.is-latest || 'false' }}
197
+ shell : bash
198
+
112
199
build :
113
200
name : target (${{ matrix.pretty }},${{ matrix.os }})
114
201
runs-on : ${{ matrix.os }}
115
- needs : [shellcheck, test, generate-matrix, check]
202
+ needs : [shellcheck, test, generate-matrix, check, build-base ]
116
203
if : github.event_name == 'push'
117
204
strategy :
118
205
fail-fast : false
0 commit comments