Skip to content

Commit

Permalink
improvements (cross-rs#1396)
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilgardis authored Dec 27, 2023
2 parents 7fb1a37 + ef93a2b commit f803025
Show file tree
Hide file tree
Showing 87 changed files with 458 additions and 673 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
on:
workflow_call:
inputs:
matrix-args:
required: false
type: string
description: Arguments to pass to `cargo xtask ci-job target-matrix`
pull_request:
merge_group:
push:
Expand Down Expand Up @@ -94,17 +100,18 @@ jobs:

- name: Generate matrix
id: generate-matrix
run: cargo xtask ci-job target-matrix ${{ github.event_name == 'merge_group' && format('--merge-group {0}', github.ref) || '' }}
run: cargo xtask ci-job target-matrix ${{ github.event_name == 'merge_group' && format('--merge-group {0}', github.ref) || '' }} ${{ inputs.matrix-args || '' }}
env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
COMMIT_AUTHOR: ${{ github.event.head_commit.author.username }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build:
name: target (${{ matrix.pretty }},${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: [shellcheck, test, generate-matrix, check]
if: (github.event_name == 'push' || github.event_name == 'merge_group') && needs.generate-matrix.outputs.matrix != '{}' && needs.generate-matrix.outputs.matrix != '[]' && needs.generate-matrix.outputs.matrix != ''
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.pretty }}
cancel-in-progress: false
strategy:
fail-fast: false
matrix:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/try.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Try
on:
issue_comment:
types: [created]

jobs:
try:
if: github.event.issue.pull_request && github.event.comment.author_association == 'MEMBER' && (contains(github.event.comment.body, '\n/ci try') || startsWith(github.event.comment.body, '/ci try'))
uses: ./.github/workflows/CI.yml
with:
matrix-args: try --comment ${{ github.event.comment.body }} --pr ${{ github.event.issue.number }}
112 changes: 3 additions & 109 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,116 +14,10 @@ env:
CARGO_HTTP_CHECK_REVOKE: false

jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust

- name: Generate matrix
id: generate-matrix
run: |
cargo xtask ci-job target-matrix --weekly
env:
TARGETS: ${{ inputs.targets }}
weekly:
name: Check target - No Cache (${{ matrix.pretty }},${{ matrix.os }})
timeout-minutes: 1440
runs-on: ${{ matrix.os }}
needs: generate-matrix
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust
- name: Set up Docker Buildx
if: runner.os == 'Linux'
uses: docker/setup-buildx-action@v2
- name: Build xtask
run: cargo build -p xtask

- name: Prepare Meta
id: prepare-meta
timeout-minutes: 60
run: cargo xtask ci-job prepare-meta "${TARGET}${SUB:+.$SUB}"
env:
TARGET: ${{ matrix.target }}
SUB: ${{ matrix.sub }}
shell: bash
- name: Docker Meta
if: steps.prepare-meta.outputs.has-image
id: docker-meta
uses: docker/metadata-action@v4
with:
images: |
name=${{ steps.prepare-meta.outputs.image }}
labels: |
${{ fromJSON(steps.prepare-meta.outputs.labels) }}
- name: Build Docker image
id: build-docker-image
if: steps.prepare-meta.outputs.has-image
timeout-minutes: 120
run: cargo xtask build-docker-image --no-cache -v "${TARGET}${SUB:+.$SUB}"
env:
TARGET: ${{ matrix.target }}
SUB: ${{ matrix.sub }}
shell: bash
- name: Set Docker image for test
if: steps.prepare-meta.outputs.has-image
run: |
TARGET_VAR="cross_target_${TARGET//-/_}_image"
echo "${TARGET_VAR^^}=${IMAGE}" | tee -a "${GITHUB_ENV}"
env:
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
env:
TARGET: ${{ matrix.target }}
CPP: ${{ matrix.cpp }}
DYLIB: ${{ matrix.dylib }}
STD: ${{ matrix.std }}
BUILD_STD: ${{ matrix.build-std }}
RUN: ${{ matrix.run }}
RUNNERS: ${{ matrix.runners }}
shell: bash

- name: Test Zig Image
if: steps.prepare-meta.outputs.has-image && steps.prepare-meta.outputs.test-variant == 'zig'
run: ./ci/test-zig-image.sh
shell: bash

- name: Test Cross Image
if: steps.prepare-meta.outputs.has-image && steps.prepare-meta.outputs.test-variant == 'cross'
run: ./ci/test-cross-image.sh
env:
TARGET: 'aarch64-unknown-linux-gnu'
IMAGE: 'ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main'
shell: bash

- name: Login to GitHub Container Registry
if: steps.prepare-meta.outputs.has-image && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
run: cargo xtask build-docker-image -v --push "${TARGET}${SUB:+.$SUB}"
env:
TARGET: ${{ matrix.target }}
SUB: ${{ matrix.sub }}
LABELS: ${{ steps.docker-meta.outputs.labels }}
shell: bash
uses: ./.github/workflows/CI.yml
with:
matrix-args: --weekly
wiki:
name: Ensure wiki is valid
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion docker/Dockerfile.aarch64-linux-android
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as cross-base
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -10,6 +10,8 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

COPY qemu.sh /
RUN /qemu.sh aarch64

Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile.aarch64-unknown-freebsd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as cross-base
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -10,6 +10,8 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

RUN echo "export ARCH=aarch64" > /freebsd-arch.sh
COPY freebsd-common.sh /
COPY freebsd.sh /
Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile.aarch64-unknown-linux-gnu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as cross-base
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -10,6 +10,8 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
g++-aarch64-linux-gnu \
libc6-dev-arm64-cross
Expand Down
4 changes: 1 addition & 3 deletions docker/Dockerfile.aarch64-unknown-linux-gnu.centos
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
FROM ubuntu:20.04

ARG DEBIAN_FRONTEND=noninteractive
FROM ubuntu:20.04 as base

COPY lib.sh /
COPY linux-image.sh /
Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile.aarch64-unknown-linux-musl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as cross-base
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -10,6 +10,8 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

COPY qemu.sh /
RUN /qemu.sh aarch64

Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile.arm-linux-androideabi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as cross-base
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -10,6 +10,8 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

COPY qemu.sh /
RUN /qemu.sh arm

Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile.arm-unknown-linux-gnueabi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as cross-base
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -10,6 +10,8 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
g++-arm-linux-gnueabi \
libc6-dev-armel-cross
Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile.arm-unknown-linux-gnueabihf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as cross-base
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -10,6 +10,8 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

ARG VERBOSE
COPY crosstool-ng.sh /
COPY crosstool-config/arm-unknown-linux-gnueabihf.config /
Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile.arm-unknown-linux-musleabi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as cross-base
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -10,6 +10,8 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

COPY qemu.sh /
RUN /qemu.sh arm

Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile.arm-unknown-linux-musleabihf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as cross-base
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -10,6 +10,8 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

COPY qemu.sh /
RUN /qemu.sh arm

Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile.armv5te-unknown-linux-gnueabi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as cross-base
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -10,6 +10,8 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
g++-arm-linux-gnueabi \
crossbuild-essential-armel \
Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile.armv5te-unknown-linux-musleabi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as cross-base
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -10,6 +10,8 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

COPY qemu.sh /
RUN /qemu.sh arm

Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile.armv7-linux-androideabi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as cross-base
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -10,6 +10,8 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

COPY qemu.sh /
RUN /qemu.sh arm

Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile.armv7-unknown-linux-gnueabi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as cross-base
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -10,6 +10,8 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

RUN apt-get install --assume-yes --no-install-recommends \
g++-arm-linux-gnueabi \
libc6-dev-armel-cross
Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile.armv7-unknown-linux-gnueabihf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as cross-base
ARG DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
Expand All @@ -10,6 +10,8 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
g++-arm-linux-gnueabihf \
libc6-dev-armhf-cross
Expand Down
Loading

0 comments on commit f803025

Please sign in to comment.