diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 2b1b15e84..b997a4e55 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -6,7 +6,7 @@ on: concurrency: # Make sure that new pushes cancel running jobs - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true env: @@ -59,61 +59,61 @@ jobs: fail-fast: false matrix: include: - - target: aarch64-apple-darwin - os: macos-26 - - target: aarch64-unknown-linux-gnu - os: ubuntu-26.04-arm - - target: aarch64-pc-windows-msvc - os: windows-11-vs2026-arm - - target: arm-unknown-linux-gnueabi - os: ubuntu-26.04 - - target: arm-unknown-linux-gnueabihf - os: ubuntu-26.04 - - target: armv7-unknown-linux-gnueabihf - os: ubuntu-26.04 - - target: i586-unknown-linux-gnu - os: ubuntu-26.04 - - target: i686-unknown-linux-gnu - os: ubuntu-26.04 - - target: loongarch64-unknown-linux-gnu - os: ubuntu-26.04 - - target: powerpc-unknown-linux-gnu - os: ubuntu-26.04 - - target: powerpc64-unknown-linux-gnu - os: ubuntu-26.04 - - target: powerpc64-unknown-linux-musl - os: ["self-hosted", "linux", "powerpc64", "musl"] - - target: powerpc64le-unknown-linux-gnu - os: ubuntu-26.04 - - target: powerpc64le-unknown-linux-gnu - os: ubuntu-24.04-ppc64le - # FIXME(ci): re-enable these once more capacity is avialable + # - target: aarch64-apple-darwin + # os: macos-26 + # - target: aarch64-unknown-linux-gnu + # os: ubuntu-26.04-arm + # - target: aarch64-pc-windows-msvc + # os: windows-11-vs2026-arm + # - target: arm-unknown-linux-gnueabi + # os: ubuntu-26.04 + # - target: arm-unknown-linux-gnueabihf + # os: ubuntu-26.04 + # - target: armv7-unknown-linux-gnueabihf + # os: ubuntu-26.04 + # - target: i586-unknown-linux-gnu + # os: ubuntu-26.04 + # - target: i686-unknown-linux-gnu + # os: ubuntu-26.04 + # - target: loongarch64-unknown-linux-gnu + # os: ubuntu-26.04 + # - target: powerpc-unknown-linux-gnu + # os: ubuntu-26.04 + # - target: powerpc64-unknown-linux-gnu + # os: ubuntu-26.04 + # - target: powerpc64-unknown-linux-musl + # os: ["self-hosted", "linux", "powerpc64", "musl"] + # - target: powerpc64le-unknown-linux-gnu + # os: ubuntu-26.04 + # - target: powerpc64le-unknown-linux-gnu + # os: ubuntu-24.04-ppc64le + # # FIXME(ci): re-enable these once more capacity is avialable + # # - target: riscv64gc-unknown-linux-gnu + # # os: ["self-hosted", "linux", "riscv64"] # - target: riscv64gc-unknown-linux-gnu - # os: ["self-hosted", "linux", "riscv64"] - - target: riscv64gc-unknown-linux-gnu - os: ubuntu-26.04 - - target: s390x-unknown-linux-gnu - os: self-hosted-linux-s390x-resolute-large-rust # resolute == ubuntu-26.04 - - target: s390x-unknown-linux-gnu - os: ubuntu-24.04-s390x - - target: thumbv6m-none-eabi - os: ubuntu-26.04 - - target: thumbv7em-none-eabi - os: ubuntu-26.04 - - target: thumbv7em-none-eabihf - os: ubuntu-26.04 - - target: thumbv7m-none-eabi - os: ubuntu-26.04 - - target: wasm32-unknown-unknown - os: ubuntu-26.04 - - target: x86_64-unknown-linux-gnu - os: ubuntu-26.04 - - target: x86_64-apple-darwin - os: macos-26-intel - - target: i686-pc-windows-msvc - os: windows-2025-vs2026 - - target: x86_64-pc-windows-msvc - os: windows-2025-vs2026 + # os: ubuntu-26.04 + # - target: s390x-unknown-linux-gnu + # os: self-hosted-linux-s390x-resolute-large-rust # resolute == ubuntu-26.04 + # - target: s390x-unknown-linux-gnu + # os: ubuntu-24.04-s390x + # - target: thumbv6m-none-eabi + # os: ubuntu-26.04 + # - target: thumbv7em-none-eabi + # os: ubuntu-26.04 + # - target: thumbv7em-none-eabihf + # os: ubuntu-26.04 + # - target: thumbv7m-none-eabi + # os: ubuntu-26.04 + # - target: wasm32-unknown-unknown + # os: ubuntu-26.04 + # - target: x86_64-unknown-linux-gnu + # os: ubuntu-26.04 + # - target: x86_64-apple-darwin + # os: macos-26-intel + # - target: i686-pc-windows-msvc + # os: windows-2025-vs2026 + # - target: x86_64-pc-windows-msvc + # os: windows-2025-vs2026 - target: i686-pc-windows-gnu os: windows-2025-vs2026 host_toolchain: nightly-x86_64-gnu @@ -128,6 +128,7 @@ jobs: JOB_HOST_TOOLCHAIN: ${{ matrix.host_toolchain }} MAY_SKIP_LIBM_CI: ${{ needs.calculate_vars.outputs.may_skip_libm_ci }} RUN_IN_DOCKER: ${{ matrix.os == 'ubuntu-26.04' }} + CFLAGS: --std=c17 steps: - name: Print runner information run: | @@ -191,6 +192,27 @@ jobs: python3 etc/update-api-list.py --check cargo test -p update-api-list + # - uses: msys2/setup-msys2@v2 + # if: matrix.os == 'windows-2025' + # with: + # msystem: UCRT64 + # update: true + # install: diffutils m4 make # mingw-w64-rustup + + # - name: Setup windows + # if: matrix.os == 'windows-2025' + # # shell: msys2 {0} + # run: | + # ./ci/run-windows.sh ${{ matrix.target }} + + # - name: Run on Windows + # if: matrix.os == 'windows-2025' + # # shell: msys2 {0} + # run: | + # rustc -vV + # rustup show + # ./ci/run.sh ${{ matrix.target }} + # Non-linux tests just use our raw script - name: Run locally if: ${{ env.RUN_IN_DOCKER != 'true' }} @@ -203,7 +225,9 @@ jobs: - name: Print test logs if available if: always() - run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi + run: | + if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi + find . -name 'config.log' -exec cat {} ';' # Workaround to keep Docker cache smaller # https://github.com/docker/build-push-action/issues/252 @@ -215,6 +239,7 @@ jobs: mv /tmp/.buildx-cache-new /tmp/.buildx-cache clippy: + if: false # TODO name: Clippy runs-on: ubuntu-26.04 timeout-minutes: 10 @@ -233,6 +258,7 @@ jobs: - run: cargo clippy --workspace --all-targets zizmor: + if: false # TODO name: Zizmor (Static analysis for GitHub Actions) runs-on: ubuntu-26.04 permissions: @@ -244,6 +270,7 @@ jobs: - uses: zizmorcore/zizmor-action@3dc1ecc9bcb9e94e9b2c709687979e1298497054 # v0.6.2 build-custom: + if: false # TODO name: Build custom target runs-on: ubuntu-26.04 timeout-minutes: 10 @@ -266,6 +293,7 @@ jobs: # FIXME: move this target to test job once https://github.com/rust-lang/rust/pull/150138 merged. build-thumbv6k: + if: false # TODO name: Build thumbv6k runs-on: ubuntu-26.04 timeout-minutes: 10 @@ -285,6 +313,7 @@ jobs: -Zjson-target-spec benchmarks: + if: false # TODO name: Benchmarks timeout-minutes: 30 strategy: @@ -332,6 +361,7 @@ jobs: run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi miri: + if: false # TODO name: Miri runs-on: ubuntu-26.04 timeout-minutes: 10 @@ -346,6 +376,7 @@ jobs: - run: ./ci/miri.sh msrv: + if: false # TODO name: Check libm MSRV runs-on: ubuntu-26.04 timeout-minutes: 20 @@ -367,6 +398,7 @@ jobs: cargo build --manifest-path libm/Cargo.toml rustfmt: + if: false # TODO name: Rustfmt runs-on: ubuntu-26.04 timeout-minutes: 10 @@ -378,6 +410,7 @@ jobs: - run: cargo fmt -- --check extensive: + if: false # TODO name: Extensive tests for ${{ matrix.ty }} needs: # Wait on `clippy` so we have some confidence that the crate will build diff --git a/ci/install-test-deps.sh b/ci/install-test-deps.sh index b64bcf654..65b5fed23 100755 --- a/ci/install-test-deps.sh +++ b/ci/install-test-deps.sh @@ -15,6 +15,8 @@ if [ "$target" = "i686-pc-windows-gnu" ]; then echo "PATH=$PATH" >> "$GITHUB_ENV" fi + + # Some runners (native ppc and s390x, self-hosted) don't have all the dependencies # we need, so we need to install them. @@ -46,3 +48,6 @@ fi rustup update "$channel" --no-self-update rustup default "$channel" rustup target add "$target" + +# TODO +rustup component add llvm-tools-preview diff --git a/ci/run-windows.sh b/ci/run-windows.sh new file mode 100755 index 000000000..cc8e076d7 --- /dev/null +++ b/ci/run-windows.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -eux + +target="$1" + +m4 --help +make --help + +echo "$PATH" + +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ + --default-toolchain nightly-x86_64-gnu \ + --target "$target" \ + --profile minimal -y + +# Wrapper to ease managerment of environments +pacman --noconfirm -S pactoys +# Install C toolchain according to `MSYSTEM` +pacboy --noconfirm -S toolchain + +pacman --noconfirm -S mingw-w64-x86_64-toolchain + +# maybe only need mingw-w64-x86_64-gcc? + +ls ~/ +echo 'export PATH="/c/Users/$USERNAME/.cargo/bin:$PATH"' >> ~/.bash_profile + +echo "$PATH" diff --git a/ci/run.sh b/ci/run.sh index 22c136e2d..73f829120 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -54,86 +54,86 @@ else profile_flag="--profile" fi -# Test our implementation -if [ "${BUILD_ONLY:-}" = "1" ]; then - echo "no tests to run for build-only targets" -else - test_builtins=( - "${test_runner[@]}" - --package builtins-test - --target "$target" - ) - - asgroup "${test_builtins[@]}" - asgroup "${test_builtins[@]}" --release - asgroup "${test_builtins[@]}" --features c - asgroup "${test_builtins[@]}" --features c --release - asgroup "${test_builtins[@]}" --benches --release - asgroup "${test_builtins[@]}" --no-default-features - asgroup "${test_builtins[@]}" --no-default-features --release - - # Validate that having a verbatim path for the target directory works - # (trivial to regress using `/` in paths to build artifacts rather than - # `Path::join`). MinGW does not currently support these paths. - if [[ "$target" = *"windows"* ]] && [[ "$target" != *"gnu"* ]]; then - verb_path=$(cmd.exe //C echo \\\\?\\%cd%\\builtins-test\\target2) - "${test_builtins[@]}" --target-dir "$verb_path" --features c - fi -fi - - -echo "::group::Run symcheck" - -# Ensure there are no duplicate symbols or references to `core` when -# `compiler-builtins` is built with various features. Symcheck invokes Cargo to -# build with the arguments we provide it, then validates the built artifacts. -SYMCHECK_TEST_TARGET="$target" cargo test -p symcheck --release -symcheck=(cargo run -p symcheck --release) -symcheck+=(-- --build-and-check --target "$target") - -# Executable section checks are meaningless on no-std targets -[[ "$target" == *"-none"* ]] && symcheck+=(--no-os) - -# We only need to check the configurations std may use -symcheck_cb_args=(-- --package compiler_builtins --features compiler-builtins) -"${symcheck[@]}" "${symcheck_cb_args[@]}" -"${symcheck[@]}" "${symcheck_cb_args[@]}" --release -"${symcheck[@]}" "${symcheck_cb_args[@]}" --features c -"${symcheck[@]}" "${symcheck_cb_args[@]}" --features c --release -"${symcheck[@]}" "${symcheck_cb_args[@]}" --no-default-features -"${symcheck[@]}" "${symcheck_cb_args[@]}" --no-default-features --release - -echo "::endgroup" - - -echo "::group::Run intrinsics tests" - -run_intrinsics_test() { - build_args=(--verbose --manifest-path builtins-test-intrinsics/Cargo.toml) - build_args+=("$@") - - # symcheck also checks the results of builtins-test-intrinsics - "${symcheck[@]}" -- "${build_args[@]}" - - # FIXME: we get access violations on Windows, our entrypoint may need to - # be tweaked. - if [ "${BUILD_ONLY:-}" != "1" ] && ! [[ "$target" = *"windows"* ]]; then - cargo run --target "$target" "${build_args[@]}" - fi -} - -# Verify that we haven't dropped any intrinsics/symbols -run_intrinsics_test -run_intrinsics_test --release -run_intrinsics_test --features c -run_intrinsics_test --features c --release - -# Verify that there are no undefined symbols to `panic` within our -# implementations -CARGO_PROFILE_DEV_LTO=true run_intrinsics_test -CARGO_PROFILE_RELEASE_LTO=true run_intrinsics_test --release - -echo "::endgroup" +# # Test our implementation +# if [ "${BUILD_ONLY:-}" = "1" ]; then +# echo "no tests to run for build-only targets" +# else +# test_builtins=( +# "${test_runner[@]}" +# --package builtins-test +# --target "$target" +# ) + +# asgroup "${test_builtins[@]}" +# asgroup "${test_builtins[@]}" --release +# asgroup "${test_builtins[@]}" --features c +# asgroup "${test_builtins[@]}" --features c --release +# asgroup "${test_builtins[@]}" --benches --release +# asgroup "${test_builtins[@]}" --no-default-features +# asgroup "${test_builtins[@]}" --no-default-features --release + +# # Validate that having a verbatim path for the target directory works +# # (trivial to regress using `/` in paths to build artifacts rather than +# # `Path::join`). MinGW does not currently support these paths. +# if [[ "$target" = *"windows"* ]] && [[ "$target" != *"gnu"* ]]; then +# verb_path=$(cmd.exe //C echo \\\\?\\%cd%\\builtins-test\\target2) +# "${test_builtins[@]}" --target-dir "$verb_path" --features c +# fi +# fi + + +# echo "::group::Run symcheck" + +# # Ensure there are no duplicate symbols or references to `core` when +# # `compiler-builtins` is built with various features. Symcheck invokes Cargo to +# # build with the arguments we provide it, then validates the built artifacts. +# SYMCHECK_TEST_TARGET="$target" cargo test -p symcheck --release +# symcheck=(cargo run -p symcheck --release) +# symcheck+=(-- --build-and-check --target "$target") + +# # Executable section checks are meaningless on no-std targets +# [[ "$target" == *"-none"* ]] && symcheck+=(--no-os) + +# # We only need to check the configurations std may use +# symcheck_cb_args=(-- --package compiler_builtins --features compiler-builtins) +# "${symcheck[@]}" "${symcheck_cb_args[@]}" +# "${symcheck[@]}" "${symcheck_cb_args[@]}" --release +# "${symcheck[@]}" "${symcheck_cb_args[@]}" --features c +# "${symcheck[@]}" "${symcheck_cb_args[@]}" --features c --release +# "${symcheck[@]}" "${symcheck_cb_args[@]}" --no-default-features +# "${symcheck[@]}" "${symcheck_cb_args[@]}" --no-default-features --release + +# echo "::endgroup" + + +# echo "::group::Run intrinsics tests" + +# run_intrinsics_test() { +# build_args=(--verbose --manifest-path builtins-test-intrinsics/Cargo.toml) +# build_args+=("$@") + +# # symcheck also checks the results of builtins-test-intrinsics +# "${symcheck[@]}" -- "${build_args[@]}" + +# # FIXME: we get access violations on Windows, our entrypoint may need to +# # be tweaked. +# if [ "${BUILD_ONLY:-}" != "1" ] && ! [[ "$target" = *"windows"* ]]; then +# cargo run --target "$target" "${build_args[@]}" +# fi +# } + +# # Verify that we haven't dropped any intrinsics/symbols +# run_intrinsics_test +# run_intrinsics_test --release +# run_intrinsics_test --features c +# run_intrinsics_test --features c --release + +# # Verify that there are no undefined symbols to `panic` within our +# # implementations +# CARGO_PROFILE_DEV_LTO=true run_intrinsics_test +# CARGO_PROFILE_RELEASE_LTO=true run_intrinsics_test --release + +# echo "::endgroup" # Test libm @@ -166,7 +166,7 @@ case "$target" in *thumb*) mflags+=(--exclude musl-math-sys) ;; # We can build musl on MinGW but running tests gets a stack overflow - *windows-gnu*) ;; + *windows-gnu*) mflags+=(--exclude musl-math-sys) ;; # Everything else gets musl enabled *) mflags+=(--features libm-test/build-musl) ;; @@ -178,8 +178,10 @@ case "$target" in # MSVC cannot link MPFR *windows-msvc*) ;; # FIXME: MinGW should be able to build MPFR, but setup in CI is nontrivial. - *windows-gnu*) ;; + # *windows-gnu*) ;; # Targets that aren't cross compiled in CI work fine + i686-pc-windows-gnu) mflags+=(--features libm-test/build-mpfr --features gmp-mpfr-sys/force-cross,gmp-mpfr-sys/c-no-tests) ;; + *windows-gnu*) mflags+=(--features libm-test/build-mpfr) ;; aarch64*apple*) mflags+=(--features libm-test/build-mpfr) ;; aarch64*linux*) mflags+=(--features libm-test/build-mpfr) ;; i586*) mflags+=(--features libm-test/build-mpfr --features gmp-mpfr-sys/force-cross) ;;