@@ -98,10 +98,97 @@ jobs:
9898 COMMIT_MESSAGE : ${{ github.event.head_commit.message }}
9999 COMMIT_AUTHOR : ${{ github.event.head_commit.author.username }}
100100
101+ build-base :
102+ name : base (${{ matrix.image }})
103+ runs-on : ubuntu-latest
104+ needs : [shellcheck, test, check]
105+ if : github.event_name == 'push'
106+ strategy :
107+ fail-fast : false
108+ matrix :
109+ image :
110+ - ubuntu
111+ - centos
112+ - emscripten
113+ outputs :
114+ images : ${{ steps.build-docker-image.outputs.images && fromJSON(steps.build-docker-image.outputs.images) }}
115+ coverage-artifact : ${{ steps.cov.outputs.artifact-name }}
116+ steps :
117+ - uses : actions/checkout@v3
118+
119+ - uses : ./.github/actions/setup-rust
120+
121+ - name : Set up Docker Buildx
122+ if : runner.os == 'Linux'
123+ uses : docker/setup-buildx-action@v1
124+
125+ - name : Build xtask
126+ run : cargo build -p xtask
127+
128+ - name : Prepare Meta
129+ id : prepare-meta
130+ timeout-minutes : 60
131+ run : cargo xtask ci-job prepare-meta "${IMAGE}"
132+ env :
133+ IMAGE : ${{ matrix.image }}
134+ shell : bash
135+
136+ - name : LLVM instrument coverage
137+ uses : ./.github/actions/cargo-llvm-cov
138+ with :
139+ name : cross-${{matrix.image}}
140+
141+ - name : Install cross
142+ if : matrix.deploy
143+ run : cargo install --path . --force --debug
144+
145+ - name : Docker Meta
146+ id : docker-meta
147+ uses : docker/metadata-action@v4
148+ with :
149+ images : |
150+ name=${{ steps.prepare-meta.outputs.image }}
151+ labels : |
152+ ${{ fromJSON(steps.prepare-meta.outputs.labels) }}
153+ - name : Build Docker image
154+ id : build-docker-image
155+ timeout-minutes : 60
156+ run : cargo xtask build-docker-image -v "${IMAGE}"
157+ env :
158+ IMAGE : ${{ matrix.image }}
159+ LABELS : ${{ steps.docker-meta.outputs.labels }}
160+ LATEST : ${{ needs.check.outputs.is-latest || 'false' }}
161+ shell : bash
162+
163+ - uses : ./.github/actions/cargo-install-upload-artifacts
164+ if : matrix.deploy
165+ with :
166+ target : ${{ matrix.image }}
167+ image : ${{ steps.build-docker-image.outputs.image }}
168+
169+ - name : Login to GitHub Container Registry
170+ uses : docker/login-action@v1
171+ with :
172+ registry : ghcr.io
173+ username : ${{ github.actor }}
174+ password : ${{ secrets.GITHUB_TOKEN }}
175+ - name : Push image to GitHub Container Registry
176+ if : >
177+ (
178+ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ||
179+ startsWith(github.ref, 'refs/tags/v')
180+ )
181+ run : cargo xtask build-docker-image -v --push "${IMAGE}"
182+ env :
183+ IMAGE : ${{ matrix.target }}
184+ LABELS : ${{ steps.docker-meta.outputs.labels }}
185+ LATEST : ${{ needs.check.outputs.is-latest || 'false' }}
186+ shell : bash
187+
101188 build :
102189 name : target (${{ matrix.pretty }},${{ matrix.os }})
103190 runs-on : ${{ matrix.os }}
104- needs : [shellcheck, test, generate-matrix, check]
191+ needs : [shellcheck, test, generate-matrix, check, build-base ]
105192 if : github.event_name == 'push'
106193 strategy :
107194 fail-fast : false
0 commit comments