Skip to content

Commit 243d080

Browse files
authored
Try #953: --target x86_64-unknown-linux-gnu
2 parents 596b223 + e5e0bf4 commit 243d080

File tree

61 files changed

+252
-598
lines changed

Some content is hidden

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

61 files changed

+252
-598
lines changed

.github/workflows/ci.yml

+142-5
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:
@@ -98,10 +100,109 @@ jobs:
98100
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
99101
COMMIT_AUTHOR: ${{ github.event.head_commit.author.username }}
100102

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

119219
- name: Set up Docker Buildx
@@ -152,6 +252,37 @@ jobs:
152252
name=${{ steps.prepare-meta.outputs.image }}
153253
labels: |
154254
${{ fromJSON(steps.prepare-meta.outputs.labels) }}
255+
256+
- name: Set env Base Image
257+
if: steps.prepare-meta.outputs.has-image
258+
run: |
259+
if [[ "${SUB}" == "centos" ]]; then
260+
echo "BASE=centos" >> "${GITHUB_ENV}"
261+
elif [[ "${TARGET}" == *emscripten ]]; then
262+
echo "BASE=emscripten" >> "${GITHUB_ENV}"
263+
else
264+
echo "BASE=ubuntu" >> "${GITHUB_ENV}"
265+
fi
266+
env:
267+
TARGET: ${{ matrix.target }}
268+
SUB: ${{ matrix.sub }}
269+
270+
- uses: actions/download-artifact@v3
271+
if: steps.prepare-meta.outputs.has-image
272+
with:
273+
name: base-${{ env.BASE }}-image-tarball
274+
path: base.tar
275+
276+
- name: Load Base Image
277+
id: load-docker-image
278+
if: steps.prepare-meta.outputs.has-image
279+
# TODO(ahuszagh) Remove the multiline
280+
run: |
281+
pwd
282+
file "base.tar"
283+
ls -la .
284+
docker load --input "base.tar"
285+
155286
- name: Build Docker image
156287
id: build-docker-image
157288
if: steps.prepare-meta.outputs.has-image
@@ -163,6 +294,7 @@ jobs:
163294
LABELS: ${{ steps.docker-meta.outputs.labels }}
164295
LATEST: ${{ needs.check.outputs.is-latest || 'false' }}
165296
shell: bash
297+
166298
- name: Set Docker image for test
167299
if: steps.prepare-meta.outputs.has-image
168300
run: |
@@ -172,6 +304,7 @@ jobs:
172304
TARGET: ${{ matrix.target }}
173305
IMAGE: ${{ steps.build-docker-image.outputs.image }}
174306
shell: bash
307+
175308
- name: Test Image
176309
if: steps.prepare-meta.outputs.has-image && steps.prepare-meta.outputs.test-variant == 'default'
177310
run: ./ci/test.sh
@@ -184,6 +317,7 @@ jobs:
184317
RUN: ${{ matrix.run }}
185318
RUNNERS: ${{ matrix.runners }}
186319
shell: bash
320+
187321
- uses: ./.github/actions/cargo-install-upload-artifacts
188322
if: matrix.deploy
189323
with:
@@ -209,6 +343,7 @@ jobs:
209343
registry: ghcr.io
210344
username: ${{ github.actor }}
211345
password: ${{ secrets.GITHUB_TOKEN }}
346+
212347
- name: Push image to GitHub Container Registry
213348
if: >
214349
steps.prepare-meta.outputs.has-image && (
@@ -274,15 +409,18 @@ jobs:
274409
uses: ./.github/actions/cargo-llvm-cov
275410
with:
276411
name: integration-bisect
412+
277413
- name: Set up QEMU
278414
uses: docker/setup-qemu-action@v2
279415
with:
280416
platforms: arm64
417+
281418
- name: Set up docker buildx
282419
uses: docker/setup-buildx-action@v2
283420
id: buildx
284421
with:
285422
install: true
423+
286424
- name: Run Foreign toolchain test
287425
run: ./ci/test-foreign-toolchain.sh
288426
shell: bash
@@ -320,7 +458,6 @@ jobs:
320458
coverage-artifact: ${{ steps.cov.outputs.artifact-name }}
321459
steps:
322460
- uses: actions/checkout@v3
323-
324461
- uses: ./.github/actions/setup-rust
325462

326463
- name: Install Podman
@@ -347,7 +484,7 @@ jobs:
347484
shell: bash
348485

349486
publish:
350-
needs: [build, check, fmt, clippy, cargo-deny]
487+
needs: [build-base, build, check, fmt, clippy, cargo-deny]
351488
runs-on: ubuntu-latest
352489
steps:
353490
- uses: actions/checkout@v3
@@ -358,7 +495,7 @@ jobs:
358495
github-token: ${{ secrets.GITHUB_TOKEN }}
359496

360497
conclusion:
361-
needs: [shellcheck, fmt, clippy, test, generate-matrix, build, publish, check, remote, bisect, docker-in-docker, foreign, podman]
498+
needs: [shellcheck, fmt, clippy, test, generate-matrix, build-base, build, publish, check, remote, bisect, docker-in-docker, foreign, podman]
362499
if: always()
363500
runs-on: ubuntu-latest
364501
steps:

docker/Dockerfile.aarch64-linux-android

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ghcr.io/cross-rs/base:ubuntu-main
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

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ghcr.io/cross-rs/base:ubuntu-main
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

+1-10
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:centos-main
1910

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

docker/Dockerfile.aarch64-unknown-linux-musl

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ghcr.io/cross-rs/base:ubuntu-main
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

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ghcr.io/cross-rs/base:ubuntu-main
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

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ghcr.io/cross-rs/base:ubuntu-main
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

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ghcr.io/cross-rs/base:ubuntu-main
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

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ghcr.io/cross-rs/base:ubuntu-main
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)