Skip to content

Commit e0b031f

Browse files
authored
Try #953: --target x86_64-unknown-linux-gnu
2 parents 4facf8f + 187b654 commit e0b031f

File tree

63 files changed

+260
-599
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+260
-599
lines changed

.github/workflows/ci.yml

Lines changed: 139 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
- name: Run unit tests
7676
run: cargo test --locked --all-targets --workspace --all-features
7777
timeout-minutes: 10
78+
7879
check:
7980
runs-on: ubuntu-latest
8081
outputs:
@@ -84,6 +85,7 @@ jobs:
8485
- uses: ./.github/actions/setup-rust
8586
- run: cargo xtask ci-job check
8687
id: check
88+
8789
generate-matrix:
8890
runs-on: ubuntu-latest
8991
outputs:
@@ -99,10 +101,109 @@ jobs:
99101
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
100102
COMMIT_AUTHOR: ${{ github.event.head_commit.author.username }}
101103

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

120220
- name: Set up Docker Buildx
@@ -153,6 +253,33 @@ jobs:
153253
name=${{ steps.prepare-meta.outputs.image }}
154254
labels: |
155255
${{ fromJSON(steps.prepare-meta.outputs.labels) }}
256+
257+
- name: Set env Base Image
258+
if: steps.prepare-meta.outputs.has-image
259+
run: |
260+
if [[ "${SUB}" == "centos" ]]; then
261+
echo "BASE=centos" >> "${GITHUB_ENV}"
262+
elif [[ "${TARGET}" == *emscripten ]]; then
263+
echo "BASE=emscripten" >> "${GITHUB_ENV}"
264+
else
265+
echo "BASE=ubuntu" >> "${GITHUB_ENV}"
266+
fi
267+
env:
268+
TARGET: ${{ matrix.target }}
269+
SUB: ${{ matrix.sub }}
270+
271+
- uses: actions/download-artifact@v3
272+
if: steps.prepare-meta.outputs.has-image
273+
with:
274+
name: base-${{ env.BASE }}-image-tarball
275+
276+
- name: Load Base Image
277+
id: load-docker-image
278+
if: steps.prepare-meta.outputs.has-image
279+
run: docker load --input "base-main-${BASE}.tar"
280+
env:
281+
SUB: ${{ matrix.sub }}
282+
156283
- name: Build Docker image
157284
id: build-docker-image
158285
if: steps.prepare-meta.outputs.has-image
@@ -163,7 +290,9 @@ jobs:
163290
SUB: ${{ matrix.sub }}
164291
LABELS: ${{ steps.docker-meta.outputs.labels }}
165292
LATEST: ${{ needs.check.outputs.is-latest || 'false' }}
293+
CROSS_CONTAINER_ENGINE_NO_PULL: true
166294
shell: bash
295+
167296
- name: Set Docker image for test
168297
if: steps.prepare-meta.outputs.has-image
169298
run: |
@@ -173,6 +302,7 @@ jobs:
173302
TARGET: ${{ matrix.target }}
174303
IMAGE: ${{ steps.build-docker-image.outputs.image }}
175304
shell: bash
305+
176306
- name: Test Image
177307
if: steps.prepare-meta.outputs.has-image && steps.prepare-meta.outputs.test-variant == 'default'
178308
run: ./ci/test.sh
@@ -185,6 +315,7 @@ jobs:
185315
RUN: ${{ matrix.run }}
186316
RUNNERS: ${{ matrix.runners }}
187317
shell: bash
318+
188319
- uses: ./.github/actions/cargo-install-upload-artifacts
189320
if: matrix.deploy
190321
with:
@@ -210,6 +341,7 @@ jobs:
210341
registry: ghcr.io
211342
username: ${{ github.actor }}
212343
password: ${{ secrets.GITHUB_TOKEN }}
344+
213345
- name: Push image to GitHub Container Registry
214346
if: >
215347
steps.prepare-meta.outputs.has-image && (
@@ -275,15 +407,18 @@ jobs:
275407
uses: ./.github/actions/cargo-llvm-cov
276408
with:
277409
name: integration-bisect
410+
278411
- name: Set up QEMU
279412
uses: docker/setup-qemu-action@v2
280413
with:
281414
platforms: arm64
415+
282416
- name: Set up docker buildx
283417
uses: docker/setup-buildx-action@v2
284418
id: buildx
285419
with:
286420
install: true
421+
287422
- name: Run Foreign toolchain test
288423
run: ./ci/test-foreign-toolchain.sh
289424
shell: bash
@@ -321,7 +456,6 @@ jobs:
321456
coverage-artifact: ${{ steps.cov.outputs.artifact-name }}
322457
steps:
323458
- uses: actions/checkout@v3
324-
325459
- uses: ./.github/actions/setup-rust
326460

327461
- name: Install Podman
@@ -348,7 +482,7 @@ jobs:
348482
shell: bash
349483

350484
publish:
351-
needs: [build, check, fmt, clippy, cargo-deny]
485+
needs: [build-base, build, check, fmt, clippy, cargo-deny]
352486
runs-on: ubuntu-latest
353487
steps:
354488
- uses: actions/checkout@v3
@@ -359,7 +493,7 @@ jobs:
359493
github-token: ${{ secrets.GITHUB_TOKEN }}
360494

361495
conclusion:
362-
needs: [shellcheck, fmt, clippy, test, generate-matrix, build, publish, check, remote, bisect, docker-in-docker, foreign, podman]
496+
needs: [shellcheck, fmt, clippy, test, generate-matrix, build-base, build, publish, check, remote, bisect, docker-in-docker, foreign, podman]
363497
if: always()
364498
runs-on: ubuntu-latest
365499
steps:

docker/Dockerfile.aarch64-linux-android

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ghcr.io/cross-rs/base:main-ubuntu
22
ARG DEBIAN_FRONTEND=noninteractive
33

4-
COPY common.sh lib.sh /
5-
RUN /common.sh
6-
7-
COPY cmake.sh /
8-
RUN /cmake.sh
9-
10-
COPY xargo.sh /
11-
RUN /xargo.sh
12-
134
COPY android-ndk.sh /
145
RUN /android-ndk.sh arm64 28
156
ENV PATH=$PATH:/android-ndk/bin

docker/Dockerfile.aarch64-unknown-linux-gnu

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ghcr.io/cross-rs/base:main-ubuntu
22
ARG DEBIAN_FRONTEND=noninteractive
33

4-
COPY common.sh lib.sh /
5-
RUN /common.sh
6-
7-
COPY cmake.sh /
8-
RUN /cmake.sh
9-
10-
COPY xargo.sh /
11-
RUN /xargo.sh
12-
134
RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
145
g++-aarch64-linux-gnu \
156
libc6-dev-arm64-cross

docker/Dockerfile.aarch64-unknown-linux-gnu.centos

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,7 @@ COPY lib.sh /
66
COPY linux-image.sh /
77
RUN /linux-image.sh aarch64
88

9-
FROM centos:7
10-
11-
COPY common.sh lib.sh /
12-
RUN /common.sh
13-
14-
COPY cmake.sh /
15-
RUN /cmake.sh
16-
17-
COPY xargo.sh /
18-
RUN /xargo.sh
9+
FROM ghcr.io/cross-rs/base:main-centos
1910

2011
COPY qemu.sh /
2112
RUN /qemu.sh aarch64 softmmu

docker/Dockerfile.aarch64-unknown-linux-musl

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ghcr.io/cross-rs/base:main-ubuntu
22
ARG DEBIAN_FRONTEND=noninteractive
33

4-
COPY common.sh lib.sh /
5-
RUN /common.sh
6-
7-
COPY cmake.sh /
8-
RUN /cmake.sh
9-
10-
COPY xargo.sh /
11-
RUN /xargo.sh
12-
134
COPY qemu.sh /
145
RUN /qemu.sh aarch64
156

docker/Dockerfile.arm-linux-androideabi

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ghcr.io/cross-rs/base:main-ubuntu
22
ARG DEBIAN_FRONTEND=noninteractive
33

4-
COPY common.sh lib.sh /
5-
RUN /common.sh
6-
7-
COPY cmake.sh /
8-
RUN /cmake.sh
9-
10-
COPY xargo.sh /
11-
RUN /xargo.sh
12-
134
COPY android-ndk.sh /
145
RUN /android-ndk.sh arm 28
156
ENV PATH=$PATH:/android-ndk/bin

docker/Dockerfile.arm-unknown-linux-gnueabi

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ghcr.io/cross-rs/base:main-ubuntu
22
ARG DEBIAN_FRONTEND=noninteractive
33

4-
COPY common.sh lib.sh /
5-
RUN /common.sh
6-
7-
COPY cmake.sh /
8-
RUN /cmake.sh
9-
10-
COPY xargo.sh /
11-
RUN /xargo.sh
12-
134
RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
145
g++-arm-linux-gnueabi \
156
libc6-dev-armel-cross

docker/Dockerfile.arm-unknown-linux-gnueabihf

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ghcr.io/cross-rs/base:main-ubuntu
22
ARG DEBIAN_FRONTEND=noninteractive
33

4-
COPY common.sh lib.sh /
5-
RUN /common.sh
6-
7-
COPY cmake.sh /
8-
RUN /cmake.sh
9-
10-
COPY xargo.sh /
11-
RUN /xargo.sh
12-
134
ARG VERBOSE
145
COPY crosstool-ng.sh /
156
COPY crosstool-config/arm-unknown-linux-gnueabihf.config /

docker/Dockerfile.arm-unknown-linux-musleabi

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ghcr.io/cross-rs/base:main-ubuntu
22
ARG DEBIAN_FRONTEND=noninteractive
33

4-
COPY common.sh lib.sh /
5-
RUN /common.sh
6-
7-
COPY cmake.sh /
8-
RUN /cmake.sh
9-
10-
COPY xargo.sh /
11-
RUN /xargo.sh
12-
134
COPY qemu.sh /
145
RUN /qemu.sh arm
156

0 commit comments

Comments
 (0)