Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor release builds, add aarch64-musl #9885

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/actions/binary-compatible-builds/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions .github/actions/binary-compatible-builds/action.yml

This file was deleted.

81 changes: 0 additions & 81 deletions .github/actions/binary-compatible-builds/main.js

This file was deleted.

6 changes: 2 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,7 @@ jobs:
strategy:
fail-fast: ${{ github.event_name != 'pull_request' }}
matrix: ${{ fromJson(needs.determine.outputs.build-matrix) }}
env: ${{ matrix.env || fromJSON('{}') }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -1089,16 +1090,13 @@ jobs:
# it everywhere
- run: ./ci/build-src-tarball.sh
if: matrix.build == 'x86_64-linux'
- uses: ./.github/actions/binary-compatible-builds
with:
name: ${{ matrix.build }}

- uses: ./.github/actions/android-ndk
if: contains(matrix.target, 'android')
with:
target: ${{ matrix.target }}

- run: $CENTOS ./ci/build-release-artifacts.sh "${{ matrix.build }}" "${{ matrix.target }}"
- run: ./ci/build-release-artifacts.sh "${{ matrix.build }}" "${{ matrix.target }}"

# Assemble release artifacts appropriate for this platform, then upload them
# unconditionally to this workflow's files so we have a copy of them.
Expand Down
19 changes: 19 additions & 0 deletions ci/build-build-matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,52 @@ const array = [
"os": ubuntu,
// The Rust target that will be used for the build.
"target": "x86_64-unknown-linux-gnu",
"env": { "DOCKER_IMAGE": "./ci/docker/x86_64-linux/Dockerfile" },
},
{
"build": "aarch64-linux",
"os": ubuntu,
"target": "aarch64-unknown-linux-gnu",
"env": { "DOCKER_IMAGE": "./ci/docker/aarch64-linux/Dockerfile" },
},
{
"build": "s390x-linux",
"os": ubuntu,
"target": "s390x-unknown-linux-gnu",
"env": { "DOCKER_IMAGE": "./ci/docker/s390x-linux/Dockerfile" },
},
{
"build": "riscv64gc-linux",
"os": ubuntu,
"target": "riscv64gc-unknown-linux-gnu",
"env": { "DOCKER_IMAGE": "./ci/docker/riscv64gc-linux/Dockerfile" },
},
{
"build": "x86_64-macos",
"os": macos,
"target": "x86_64-apple-darwin",
// On OSX all we need to do is configure our deployment target as old as
// possible. For now 10.9 is the limit.
"env": { "MACOSX_DEPLOYMENT_TARGET": "10.9" },
},
{
"build": "aarch64-macos",
"os": macos,
"target": "aarch64-apple-darwin",
"env": { "MACOSX_DEPLOYMENT_TARGET": "10.9" },
},
{
"build": "x86_64-windows",
"os": windows,
"target": "x86_64-pc-windows-msvc",
// On Windows we build against the static CRT to reduce dll dependencies
"env": { "RUSTFLAGS": "-Ctarget-feature=+crt-static" },
},
{
"build": "x86_64-mingw",
"os": windows,
"target": "x86_64-pc-windows-gnu",
"env": { "RUSTFLAGS": "-Ctarget-feature=+crt-static" },
},
{
"build": "aarch64-android",
Expand All @@ -67,11 +78,19 @@ const array = [
"build": "x86_64-musl",
"os": ubuntu,
"target": "x86_64-unknown-linux-musl",
"env": { "DOCKER_IMAGE": "./ci/docker/x86_64-musl/Dockerfile" },
},
{
"build": "aarch64-musl",
"os": ubuntu,
"target": "aarch64-unknown-linux-musl",
"env": { "DOCKER_IMAGE": "./ci/docker/aarch64-musl/Dockerfile" },
},
{
"build": "aarch64-windows",
"os": windows,
"target": "aarch64-pc-windows-msvc",
"env": { "RUSTFLAGS": "-Ctarget-feature=+crt-static" },
},
];

Expand Down
23 changes: 23 additions & 0 deletions ci/build-release-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,29 @@ set -ex

build=$1
target=$2
wrapper=""

# If `$DOCKER_IMAGE` is set then run the build inside of that docker container
# instead of on the host machine. In CI this uses `./ci/docker/*/Dockerfile` to
# have precise glibc requirements for Linux platforms for example.
if [ "$DOCKER_IMAGE" != "" ]; then
if [ -f "$DOCKER_IMAGE" ]; then
docker build --tag build-image --file $DOCKER_IMAGE ci/docker
DOCKER_IMAGE=build-image
fi

# Inherit the environment's rustc and env vars related to cargo/rust, and then
# otherwise re-execute ourselves and we'll be missing `$DOCKER_IMAGE` in the
# container so we'll continue below.
exec docker run --interactive \
--volume `pwd`:`pwd` \
--volume `rustc --print sysroot`:/rust:ro \
--workdir `pwd` \
--interactive \
--env-file <(env | grep 'CARGO\|RUST') \
$DOCKER_IMAGE \
bash -c "PATH=\$PATH:/rust/bin RUSTFLAGS=\"\$RUSTFLAGS \$EXTRA_RUSTFLAGS\" `pwd`/$0 $*"
fi

# Default build flags for release artifacts. Leave debugging for
# builds-from-source which have richer information anyway, and additionally the
Expand Down
5 changes: 5 additions & 0 deletions ci/docker/aarch64-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ghcr.io/cross-rs/aarch64-unknown-linux-musl

RUN apt-get update -y && apt-get install -y ninja-build
RUN git config --global --add safe.directory '*'
ENV EXTRA_RUSTFLAGS=-Ctarget-feature=-crt-static
Loading