diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 31b961d364b89..de23e327a5603 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: full CI +name: CI on: merge_group: @@ -9,6 +9,10 @@ env: CARGO_TERM_VERBOSE: true LIBC_CI: 1 +defaults: + run: + shell: bash + jobs: style_check: name: Style check @@ -20,71 +24,22 @@ jobs: - name: Check style run: ./ci/style.sh - build_channels_linux: - name: Build Channels Linux - runs-on: ubuntu-22.04 + # This runs `cargo build --target ...` for all T1 and T2 targets` + verify_build: + name: Verify build strategy: - fail-fast: true - max-parallel: 5 matrix: - toolchain: - - stable - - beta - - nightly - - 1.63.0 - env: - OS: linux - TOOLCHAIN: ${{ matrix.toolchain }} - steps: - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - run: ./ci/install-rust.sh - - name: Execute build.sh - run: ./ci/build.sh - - build_channels_macos: - name: Build Channels macOS - needs: macos - strategy: - fail-fast: true - max-parallel: 4 - matrix: - target: - - { toolchain: stable, os: macos-14 } - - { toolchain: beta, os: macos-14 } - - { toolchain: nightly, os: macos-14 } - - { toolchain: 1.63.0, os: macos-14 } - runs-on: ${{ matrix.target.os }} + toolchain: [stable, nightly, 1.63.0, beta] + os: [ubuntu-22.04, macos-14, windows-2022] + runs-on: ${{ matrix.os }} env: - OS: macos TOOLCHAIN: ${{ matrix.toolchain }} steps: - uses: actions/checkout@v4 - name: Setup Rust toolchain run: ./ci/install-rust.sh - name: Execute build.sh - run: ./ci/build.sh - - build_channels_windows: - name: Build Channels Windows - runs-on: windows-2022 - strategy: - fail-fast: true - matrix: - toolchain: - - 1.63.0 - - stable - env: - OS: windows - TOOLCHAIN: ${{ matrix.toolchain }} - steps: - - uses: actions/checkout@v4 - - name: Self-update rustup - run: rustup self update - shell: bash - - name: Execute build.sh - run: ./ci/build.sh - shell: bash + run: ./ci/verify-build.sh macos: name: macOS @@ -250,9 +205,7 @@ jobs: - windows - solaris - style_check - - build_channels_linux - - build_channels_macos - - build_channels_windows + - verify_build # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency # failed" as success. So we have to do some contortions to ensure the job fails if any of its # dependencies fails. diff --git a/ci/build.sh b/ci/verify-build.sh similarity index 86% rename from ci/build.sh rename to ci/verify-build.sh index 6bbf66c1a8209..db1c2bca8f25a 100755 --- a/ci/build.sh +++ b/ci/verify-build.sh @@ -8,12 +8,21 @@ set -eux : "${TOOLCHAIN?The TOOLCHAIN environment variable must be set.}" -: "${OS?The OS environment variable must be set.}" rust="$TOOLCHAIN" filter="${FILTER:-}" -echo "Testing Rust $rust on $OS" +case "$(uname -s)" in + Linux*) os=linux ;; + Darwin*) os=macos ;; + MINGW*) os=windows ;; + *) + echo "Unknown system $(uname -s)" + exit 1 + ;; +esac + +echo "Testing Rust $rust on $os" if [ "$TOOLCHAIN" = "nightly" ] ; then rustup component add rust-src @@ -198,40 +207,30 @@ i386-apple-ios \ " # The targets are listed here alphabetically -targets="" -no_dist_targets="" - -case "${OS}" in - linux*) - targets="$rust_linux_targets" - - if [ "$rust" = "nightly" ]; then - targets="$targets $rust_nightly_linux_targets" - no_dist_targets="$rust_linux_no_dist_targets" - fi - - ;; - macos*) - targets="$rust_apple_targets" - - if [ "$rust" = "nightly" ]; then - targets="$targets $rust_nightly_apple_targets" - no_dist_targets="$rust_apple_no_dist_targets" - fi +if [ "$os" = "linux" ]; then + targets="$rust_linux_targets" + nightly_targets="$rust_nightly_linux_targets" + no_dist_targets="$rust_linux_no_dist_targets" +elif [ "$os" = "macos" ]; then + targets="$rust_apple_targets" + nightly_targets="$rust_nightly_apple_targets" + no_dist_targets="$rust_apple_no_dist_targets" +elif [ "$os" = "windows" ]; then + targets=${rust_nightly_windows_targets} +else + exit 1 +fi - ;; - windows*) - targets=${rust_nightly_windows_targets} - ;; - *) - echo "Unrecognized OS $OS" - exit 1 - ;; -esac +if [ "$rust" = "nightly" ]; then + targets="$targets $nightly_targets" +else + # build-std requires nightly + no_dist_targets="" +fi for target in $targets; do if echo "$target" | grep -q "$filter"; then - if [ "${OS}" = "windows" ]; then + if [ "$os" = "windows" ]; then TARGET="$target" ./ci/install-rust.sh test_target "$target" else @@ -242,9 +241,9 @@ for target in $targets; do fi done -for target in $no_dist_targets; do +for target in ${no_dist_targets:-}; do if echo "$target" | grep -q "$filter"; then - if [ "${OS}" = "windows" ]; then + if [ "$os" = "windows" ]; then TARGET="$target" ./ci/install-rust.sh test_target "$target" 1 else