Update brioche-cc
to get sysroot from a symlink
#76
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
- push | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
env: | |
NIGHTLY_TOOLCHAIN: nightly-2024-11-28 | |
jobs: | |
check: | |
name: Run checks | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check formatting | |
run: cargo fmt -- --check | |
- name: Check Clippy | |
run: cargo clippy --all -- -Dwarnings | |
test: | |
name: Run tests | |
strategy: | |
matrix: | |
runs_on: | |
- ubuntu-22.04 | |
- macos-14 | |
runs-on: ${{ matrix.runs_on }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Run tests in release mode. Running tests in debug mode uses a lot | |
# more disk space, so much so that it can cause the run to fail | |
- name: Run tests | |
run: cargo test --all --release | |
build: | |
name: Build artifacts | |
strategy: | |
matrix: | |
platform: | |
- name: x86_64-linux | |
runs_on: ubuntu-22.04 | |
target: x86_64-unknown-linux-gnu | |
tools_target: x86_64-unknown-linux-musl | |
packed_exec: brioche-packed-userland-exec | |
- name: aarch64-linux | |
runs_on: ubuntu-22.04 | |
target: aarch64-unknown-linux-gnu | |
tools_target: aarch64-unknown-linux-musl | |
packed_exec: brioche-packed-userland-exec | |
install_deps: | | |
sudo apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu | |
echo 'CC=aarch64-linux-gnu-gcc' >> $GITHUB_ENV | |
echo 'CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc' >> $GITHUB_ENV | |
- name: x86_64-macos | |
runs_on: macos-14 | |
target: x86_64-apple-darwin | |
tools_target: x86_64-apple-darwin | |
packed_exec: brioche-packed-plain-exec | |
- name: aarch64-macos | |
runs_on: macos-14 | |
target: aarch64-apple-darwin | |
tools_target: aarch64-apple-darwin | |
packed_exec: brioche-packed-plain-exec | |
runs-on: ${{ matrix.platform.runs_on }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Rust targets | |
run: rustup target add "$TARGET" "$TOOLS_TARGET" | |
env: | |
TARGET: ${{ matrix.platform.target }} | |
TOOLS_TARGET: ${{ matrix.platform.tools_target }} | |
- name: Install Rust nightly toolchain | |
run: | | |
rustup toolchain install "$NIGHTLY_TOOLCHAIN" \ | |
--target "$TOOLS_TARGET" \ | |
--component rust-src | |
env: | |
TOOLS_TARGET: ${{ matrix.platform.tools_target }} | |
- name: Install dependencies | |
if: matrix.platform.install_deps | |
run: ${{ matrix.platform.install_deps }} | |
- name: Build Brioche runtime utils | |
run: | | |
cargo build \ | |
--all \ | |
--bin brioche-cc \ | |
--bin brioche-ld \ | |
--bin brioche-strip \ | |
--bin brioche-packer \ | |
--release \ | |
--target="$TOOLS_TARGET" | |
cargo +"$NIGHTLY_TOOLCHAIN" build \ | |
--all \ | |
--bin brioche-packed-plain-exec \ | |
--bin brioche-packed-userland-exec \ | |
--profile=release-tiny \ | |
--target="$TOOLS_TARGET" \ | |
-Z 'build-std=std,panic_abort' \ | |
-Z 'build-std-features=panic_immediate_abort' | |
env: | |
TOOLS_TARGET: ${{ matrix.platform.tools_target }} | |
- name: Prepare artifact | |
run: | | |
mkdir -p "artifacts/brioche/$PLATFORM/" | |
mkdir -p "artifacts/brioche-runtime-utils/$PLATFORM/bin/" | |
cp \ | |
"target/$TOOLS_TARGET/release/brioche-cc" \ | |
"target/$TOOLS_TARGET/release/brioche-ld" \ | |
"target/$TOOLS_TARGET/release/brioche-strip" \ | |
"target/$TOOLS_TARGET/release/brioche-packer" \ | |
"target/$TOOLS_TARGET/release-tiny/brioche-packed-plain-exec" \ | |
"target/$TOOLS_TARGET/release-tiny/brioche-packed-userland-exec" \ | |
"artifacts/brioche-runtime-utils/$PLATFORM/bin/" | |
cp "artifacts/brioche-runtime-utils/$PLATFORM/bin/$PACKED_EXEC" "artifacts/brioche-runtime-utils/$PLATFORM/bin/brioche-packed-exec" | |
(cd "artifacts/brioche-runtime-utils/$PLATFORM/" && tar --zstd -cf "../../brioche/$PLATFORM/brioche-runtime-utils.tar.zstd" .) | |
if command -v tree &> /dev/null; then | |
tree --du -h artifacts/brioche-runtime-utils | |
tree --du -h artifacts/brioche | |
fi | |
env: | |
PLATFORM: ${{ matrix.platform.name }} | |
TARGET: ${{ matrix.platform.target }} | |
TOOLS_TARGET: ${{ matrix.platform.tools_target }} | |
PACKED_EXEC: ${{ matrix.platform.packed_exec }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: brioche-runtime-utils-${{ matrix.platform.name }} | |
if-no-files-found: error | |
path: artifacts/brioche | |
push: | |
name: Push artifacts | |
if: github.repository == 'brioche-dev/brioche-runtime-utils' | |
needs: [check, test, build] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Download artifacts (x86_64-linux) | |
uses: actions/download-artifact@v4 | |
with: | |
name: brioche-runtime-utils-x86_64-linux | |
path: artifacts/brioche | |
- name: Download artifacts (aarch64-linux) | |
uses: actions/download-artifact@v4 | |
with: | |
name: brioche-runtime-utils-aarch64-linux | |
path: artifacts/brioche | |
- name: Download artifacts (x86_64-macos) | |
uses: actions/download-artifact@v4 | |
with: | |
name: brioche-runtime-utils-x86_64-macos | |
path: artifacts/brioche | |
- name: Download artifacts (aarch64-macos) | |
uses: actions/download-artifact@v4 | |
with: | |
name: brioche-runtime-utils-aarch64-macos | |
path: artifacts/brioche | |
# Prepare the upload for the current commit and branch: | |
# - The current branch will be uploaded with all artifacts | |
# - The current commit will be uploaded with all artifacts | |
# - The current files from the bucket will be downloaded first, | |
# so that existing files are not overwritten. This is so that file | |
# hashes never change under the commit e.g. if the GitHub Actions | |
# workflow is re-run | |
- name: Prepare upload | |
run: | | |
mkdir -p artifacts/uploads/commit artifacts/uploads/branch | |
cp -r artifacts/brioche/* artifacts/uploads/commit/ | |
cp -r artifacts/brioche/* artifacts/uploads/branch/ | |
if command -v tree &> /dev/null; then | |
tree --du -h artifacts/uploads/commit | |
tree --du -h artifacts/uploads/branch | |
fi | |
aws s3 sync \ | |
--endpoint "$S3_ENDPOINT" \ | |
"s3://brioche-dev-development-content/github.com/brioche-dev/brioche-runtime-utils/commits/$GITHUB_SHA/" \ | |
artifacts/uploads/commit/ | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.R2_S3_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_S3_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ${{ vars.R2_S3_REGION }} | |
S3_ENDPOINT: ${{ secrets.R2_S3_ENDPOINT }} | |
- name: Upload to S3 | |
run: | | |
aws s3 sync \ | |
--endpoint "$S3_ENDPOINT" \ | |
--delete \ | |
artifacts/uploads/branch/ \ | |
"s3://brioche-dev-development-content/github.com/brioche-dev/brioche-runtime-utils/branches/$GITHUB_REF_NAME/" | |
aws s3 sync \ | |
--endpoint "$S3_ENDPOINT" \ | |
--delete \ | |
artifacts/uploads/commit/ \ | |
"s3://brioche-dev-development-content/github.com/brioche-dev/brioche-runtime-utils/commits/$GITHUB_SHA/" | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.R2_S3_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_S3_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ${{ vars.R2_S3_REGION }} | |
S3_ENDPOINT: ${{ secrets.R2_S3_ENDPOINT }} | |