Skip to content

Rust Compiler Builder #306

Rust Compiler Builder

Rust Compiler Builder #306

name: Rust Compiler Builder
on:
push:
paths-ignore:
- '**/README.md'
- '**/LICENSE'
- '**/doc/**'
schedule:
# https://crontab.guru/
# At 12:00 AM
- cron: 0 0 * * *
workflow_dispatch:
inputs:
rust-backtrace:
description: Enable RUST_BACKTRACE
required: false
default: '1'
type: choice
options:
- '0'
- '1'
rust-channel:
description: Set RUST_CHANNEL
required: false
default: 'dev'
type: choice
options:
- dev
- nightly
- beta
- stable
rust-verbose:
description: Set RUST_VERBOSE
required: false
default: '0'
type: choice
options:
- '0'
- '1'
- '2'
- '3'
jobs:
build:
name: ${{ matrix.rust-targets }} [${{ matrix.xcode-version }}] [${{ matrix.os }}]
strategy:
fail-fast: false
matrix:
include:
# https://github.com/actions/runner-images?tab=readme-ov-file#available-images
# https://github.com/actions/runner-images/tree/main/images/macos
# https://developer.apple.com/support/xcode/
# https://support.apple.com/en-us/100100
# Regression: rust-host: arm64e-apple-darwin [macos-14]
- rust-targets: arm64e-apple-darwin
rust-host: x86_64-apple-darwin
os: macos-13
xcode-version: 15.2
rust-config: configure
rust-no-debug-assertions: 1
rust-use-lld: false
macosx_deployment_target: 11.0
- rust-targets: arm64e-apple-darwin
rust-host: aarch64-apple-darwin
os: macos-14
xcode-version: 15.4
rust-config: configure
rust-no-debug-assertions: 1
rust-use-lld: true
macosx_deployment_target: 11.0
- rust-targets: arm64e-apple-ios
rust-host: x86_64-apple-darwin
os: macos-13
xcode-version: 15.2
rust-config: configure
rust-no-debug-assertions: 1
rust-use-lld: false
macosx_deployment_target: 11.0
iphoneos_deployment_target: 15.0
- rust-targets: arm64e-apple-ios
rust-host: aarch64-apple-darwin
os: macos-14
xcode-version: 15.4
rust-config: configure
rust-no-debug-assertions: 1
rust-use-lld: true
macosx_deployment_target: 11.0
iphoneos_deployment_target: 15.0
- rust-targets: arm64e-apple-tvos
rust-host: x86_64-apple-darwin
os: macos-13
xcode-version: 15.2
rust-config: configure
rust-no-debug-assertions: 1
rust-use-lld: false
macosx_deployment_target: 11.0
tvos_deployment_target: 15.0
rust-configure-args: >-
--set target.arm64e-apple-tvos.profiler=false
runs-on: ${{ matrix.os }}
env:
# Tools
SCCACHE_GHA_ENABLED: 'on'
# The Rust Compiler
BOOTSTRAP_SKIP_TARGET_SANITY: 1 # TODO: disable BOOTSTRAP_SKIP_TARGET_SANITY when the 1.83 rustc is available
NO_DEBUG_ASSERTIONS: ${{ matrix.rust-no-debug-assertions}}
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }}
MACOSX_STD_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }}
IPHONEOS_DEPLOYMENT_TARGET: ${{ matrix.iphoneos_deployment_target }}
TVOS_DEPLOYMENT_TARGET: ${{ matrix.tvos_deployment_target }}
RUST_BACKTRACE: ${{ github.event.inputs.rust-backtrace || '0' }}
RUST_CHANNEL: ${{ github.event.inputs.rust-channel || 'dev' }}
RUST_HOST: ${{ matrix.rust-host }}
RUST_TARGETS: ${{ matrix.rust-targets }}
RUST_VERBOSE: ${{ github.event.inputs.rust-verbose || '0' }}
RUST_CONFIGURE_ARGS: ${{ matrix.rust-configure-args }} --set change-id=99999999
steps:
- name: Configure Cache Env
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Select Xcode ${{ matrix.xcode-version }}
run: |
sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode-version }}.app
sudo xcode-select -p
- name: Install Ninja
run: brew install ninja
- name: Install sccache
run: brew install sccache
- name: Install llvm
if: ${{ matrix.rust-use-lld }}
run: |
brew install lld
echo "PATH=$PATH:/opt/homebrew/opt/llvm/bin:/usr/local/opt/llvm/bin" >> $GITHUB_ENV
- name: Show System Info
run: |
echo "::group::uname"
uname -a
echo "::endgroup::"
echo "::group::env"
env
echo "::endgroup::"
echo "::group::disk space"
df -h .
echo "::endgroup::"
echo "::group::sccache"
sccache --version
sccache --show-stats
echo "::endgroup::"
echo "::group::cmake"
cmake --version
echo "::endgroup::"
echo "::group::ninja"
ninja --version
echo "::endgroup::"
echo "::group::xcodebuild"
xcodebuild -version
echo "::endgroup::"
echo "::group::xcrun"
xcrun --show-sdk-path
echo "::endgroup::"
echo "::group::clang"
clang -v
echo "::endgroup::"
echo "::group::ld"
ld -v
echo "::endgroup::"
echo "::group::lld"
lld -flavor ld --version || true
echo "::endgroup::"
- name: Checkout
uses: actions/checkout@v4
- name: Checkout Rust
uses: actions/checkout@v4
with:
repository: rust-lang/rust
ref: master
submodules: true
path: rust
- name: Configure Rust
run: make ${{ matrix.rust-config }}
env:
RUST_USE_LLD: ${{ matrix.rust-use-lld }}
- name: Show config.toml
run: cat config.toml
working-directory: ./rust
- name: Build Rust
run: make all
working-directory: ./rust
- name: Show Target Spec
run: make show-target-info
- name: Build Rust dist
run: make dist
working-directory: ./rust
- name: Archive Rust dist
uses: actions/upload-artifact@v4
with:
name: rust-${{ env.RUST_CHANNEL }}-${{ matrix.rust-targets }}-${{ matrix.xcode-version }}-${{ matrix.os }}
path: ./rust/build/dist/*.xz
- name: Archive target spec
uses: actions/upload-artifact@v4
with:
name: rust-${{ env.RUST_CHANNEL }}-${{ matrix.rust-targets }}-${{ matrix.xcode-version }}-spec
path: ./*.json
- name: Show Build Stats
run: |
echo "::group::sccache"
sccache --show-stats
echo "::endgroup::"