Skip to content

Commit

Permalink
Try #953: --target x86_64-unknown-linux-gnu --target x86_64-unknown-l…
Browse files Browse the repository at this point in the history
…inux-gnu.centos --target wasm32-unknown-emscripten
  • Loading branch information
bors[bot] authored Oct 4, 2022
2 parents 596b223 + 270bf55 commit 96ae500
Show file tree
Hide file tree
Showing 61 changed files with 247 additions and 598 deletions.
142 changes: 137 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
- name: Run unit tests
run: cargo test --locked --all-targets --workspace --all-features
timeout-minutes: 10

check:
runs-on: ubuntu-latest
outputs:
Expand All @@ -84,6 +85,7 @@ jobs:
- uses: ./.github/actions/setup-rust
- run: cargo xtask ci-job check
id: check

generate-matrix:
runs-on: ubuntu-latest
outputs:
Expand All @@ -98,10 +100,109 @@ jobs:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
COMMIT_AUTHOR: ${{ github.event.head_commit.author.username }}

build-base:
name: ${{ matrix.image }} (${{ matrix.sub }})
runs-on: ubuntu-latest
needs: [shellcheck, test, check]
if: github.event_name == 'push'
strategy:
fail-fast: false
matrix:
image:
- base
sub:
- ubuntu
- centos
- emscripten
outputs:
coverage-artifact: ${{ steps.cov.outputs.artifact-name }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust

- name: Set up Docker Buildx
if: runner.os == 'Linux'
uses: docker/setup-buildx-action@v1

- name: Build xtask
run: cargo build -p xtask

- name: Prepare Meta
id: prepare-meta
timeout-minutes: 60
run: cargo xtask ci-job prepare-meta "${IMAGE}.${SUB}"
env:
IMAGE: ${{ matrix.image }}
SUB: ${{ matrix.sub }}
shell: bash

- name: LLVM instrument coverage
uses: ./.github/actions/cargo-llvm-cov
with:
name: cross-${{matrix.image}}-${{matrix.sub}}

- name: Install cross
if: matrix.deploy
run: cargo install --path . --force --debug

- name: Docker Meta
id: docker-meta
uses: docker/metadata-action@v4
with:
images: |
name=${{ steps.prepare-meta.outputs.image }}
labels: |
${{ fromJSON(steps.prepare-meta.outputs.labels) }}
# always use the main branch, since we need it for the base image
- name: Build Docker image
id: build-docker-image
timeout-minutes: 60
run: cargo xtask build-docker-image -v --tag main "${IMAGE}.${SUB}"
env:
IMAGE: ${{ matrix.image }}
SUB: ${{ matrix.sub }}
LABELS: ${{ steps.docker-meta.outputs.labels }}
LATEST: ${{ needs.check.outputs.is-latest || 'false' }}
shell: bash

- name: Save Docker Image
id: save-docker-image
run: docker save "${IMAGE}:main" -o "${IMAGE}-main-${SUB}.tar"
env:
IMAGE: ${{ matrix.image }}
SUB: ${{ matrix.sub }}

- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.image }}-${{ matrix.sub }}-image-tarball
path: ${{ matrix.image }}-main-${{ matrix.sub }}.tar

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push image to GitHub Container Registry
if: >
(
github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ||
startsWith(github.ref, 'refs/tags/v')
)
run: cargo xtask build-docker-image -v "${IMAGE}.${SUB}"
env:
IMAGE: ${{ matrix.image }}
SUB: ${{ matrix.sub }}
LABELS: ${{ steps.docker-meta.outputs.labels }}
LATEST: ${{ needs.check.outputs.is-latest || 'false' }}
shell: bash

build:
name: target (${{ matrix.pretty }},${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: [shellcheck, test, generate-matrix, check]
needs: [shellcheck, test, generate-matrix, check, build-base]
if: github.event_name == 'push'
strategy:
fail-fast: false
Expand All @@ -113,7 +214,6 @@ jobs:
coverage-artifact: ${{ steps.cov.outputs.artifact-name }}
steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/setup-rust

- name: Set up Docker Buildx
Expand Down Expand Up @@ -152,6 +252,32 @@ jobs:
name=${{ steps.prepare-meta.outputs.image }}
labels: |
${{ fromJSON(steps.prepare-meta.outputs.labels) }}
- name: Set env Base Image
if: steps.prepare-meta.outputs.has-image
run: |
if [[ "${SUB}" == "centos" ]]; then
echo "BASE=centos" >> "${GITHUB_ENV}"
elif [[ "${TARGET}" == *emscripten ]]; then
echo "BASE=emscripten" >> "${GITHUB_ENV}"
else
echo "BASE=ubuntu" >> "${GITHUB_ENV}"
fi
env:
TARGET: ${{ matrix.target }}
SUB: ${{ matrix.sub }}

- uses: actions/download-artifact@v3
if: steps.prepare-meta.outputs.has-image
with:
name: base-${{ env.BASE }}-image-tarball
path: base.tar

- name: Load Base Image
id: load-docker-image
if: steps.prepare-meta.outputs.has-image
run: docker load "base.tar"

- name: Build Docker image
id: build-docker-image
if: steps.prepare-meta.outputs.has-image
Expand All @@ -163,6 +289,7 @@ jobs:
LABELS: ${{ steps.docker-meta.outputs.labels }}
LATEST: ${{ needs.check.outputs.is-latest || 'false' }}
shell: bash

- name: Set Docker image for test
if: steps.prepare-meta.outputs.has-image
run: |
Expand All @@ -172,6 +299,7 @@ jobs:
TARGET: ${{ matrix.target }}
IMAGE: ${{ steps.build-docker-image.outputs.image }}
shell: bash

- name: Test Image
if: steps.prepare-meta.outputs.has-image && steps.prepare-meta.outputs.test-variant == 'default'
run: ./ci/test.sh
Expand All @@ -184,6 +312,7 @@ jobs:
RUN: ${{ matrix.run }}
RUNNERS: ${{ matrix.runners }}
shell: bash

- uses: ./.github/actions/cargo-install-upload-artifacts
if: matrix.deploy
with:
Expand All @@ -209,6 +338,7 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push image to GitHub Container Registry
if: >
steps.prepare-meta.outputs.has-image && (
Expand Down Expand Up @@ -274,15 +404,18 @@ jobs:
uses: ./.github/actions/cargo-llvm-cov
with:
name: integration-bisect

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Set up docker buildx
uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true

- name: Run Foreign toolchain test
run: ./ci/test-foreign-toolchain.sh
shell: bash
Expand Down Expand Up @@ -320,7 +453,6 @@ jobs:
coverage-artifact: ${{ steps.cov.outputs.artifact-name }}
steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/setup-rust

- name: Install Podman
Expand All @@ -347,7 +479,7 @@ jobs:
shell: bash

publish:
needs: [build, check, fmt, clippy, cargo-deny]
needs: [build-base, build, check, fmt, clippy, cargo-deny]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -358,7 +490,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}

conclusion:
needs: [shellcheck, fmt, clippy, test, generate-matrix, build, publish, check, remote, bisect, docker-in-docker, foreign, podman]
needs: [shellcheck, fmt, clippy, test, generate-matrix, build-base, build, publish, check, remote, bisect, docker-in-docker, foreign, podman]
if: always()
runs-on: ubuntu-latest
steps:
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.aarch64-linux-android
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/base:ubuntu-main
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
RUN /common.sh

COPY cmake.sh /
RUN /cmake.sh

COPY xargo.sh /
RUN /xargo.sh

COPY android-ndk.sh /
RUN /android-ndk.sh arm64 28
ENV PATH=$PATH:/android-ndk/bin
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.aarch64-unknown-linux-gnu
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/base:ubuntu-main
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
RUN /common.sh

COPY cmake.sh /
RUN /cmake.sh

COPY xargo.sh /
RUN /xargo.sh

RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
g++-aarch64-linux-gnu \
libc6-dev-arm64-cross
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.aarch64-unknown-linux-gnu.centos
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,7 @@ COPY lib.sh /
COPY linux-image.sh /
RUN /linux-image.sh aarch64

FROM centos:7

COPY common.sh lib.sh /
RUN /common.sh

COPY cmake.sh /
RUN /cmake.sh

COPY xargo.sh /
RUN /xargo.sh
FROM ghcr.io/cross-rs/base:centos-main

COPY qemu.sh /
RUN /qemu.sh aarch64 softmmu
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.aarch64-unknown-linux-musl
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/base:ubuntu-main
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
RUN /common.sh

COPY cmake.sh /
RUN /cmake.sh

COPY xargo.sh /
RUN /xargo.sh

COPY qemu.sh /
RUN /qemu.sh aarch64

Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.arm-linux-androideabi
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/base:ubuntu-main
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
RUN /common.sh

COPY cmake.sh /
RUN /cmake.sh

COPY xargo.sh /
RUN /xargo.sh

COPY android-ndk.sh /
RUN /android-ndk.sh arm 28
ENV PATH=$PATH:/android-ndk/bin
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.arm-unknown-linux-gnueabi
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/base:ubuntu-main
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
RUN /common.sh

COPY cmake.sh /
RUN /cmake.sh

COPY xargo.sh /
RUN /xargo.sh

RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
g++-arm-linux-gnueabi \
libc6-dev-armel-cross
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.arm-unknown-linux-gnueabihf
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/base:ubuntu-main
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
RUN /common.sh

COPY cmake.sh /
RUN /cmake.sh

COPY xargo.sh /
RUN /xargo.sh

ARG VERBOSE
COPY crosstool-ng.sh /
COPY crosstool-config/arm-unknown-linux-gnueabihf.config /
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.arm-unknown-linux-musleabi
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/base:ubuntu-main
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
RUN /common.sh

COPY cmake.sh /
RUN /cmake.sh

COPY xargo.sh /
RUN /xargo.sh

COPY qemu.sh /
RUN /qemu.sh arm

Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.arm-unknown-linux-musleabihf
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/base:ubuntu-main
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
RUN /common.sh

COPY cmake.sh /
RUN /cmake.sh

COPY xargo.sh /
RUN /xargo.sh

COPY qemu.sh /
RUN /qemu.sh arm

Expand Down
Loading

0 comments on commit 96ae500

Please sign in to comment.