Skip to content

Commit

Permalink
ci: Use ./ with shebangs rather than sh or bash
Browse files Browse the repository at this point in the history
The scripts say how they should execute, there isn't any reason to
duplicate this wherever they are called.
  • Loading branch information
tgross35 committed Nov 20, 2024
1 parent 4c96512 commit 4707c5d
Show file tree
Hide file tree
Showing 29 changed files with 43 additions and 39 deletions.
38 changes: 21 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ env:
CARGO_TERM_VERBOSE: true
LIBC_CI: 1

defaults:
run:
shell: bash

jobs:
style_check:
name: Style check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: sh ./ci/install-rust.sh
run: ./ci/install-rust.sh
- name: Check style
run: sh ci/style.sh
run: ./ci/style.sh

build_channels_linux:
name: Build Channels Linux
Expand All @@ -37,9 +41,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/install-rust.sh
run: TOOLCHAIN=${{ matrix.toolchain }} ./ci/install-rust.sh
- name: Execute build.sh
run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh
run: TOOLCHAIN=${{ matrix.toolchain }} ./ci/build.sh

build_channels_macos:
name: Build Channels macOS
Expand All @@ -59,9 +63,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/install-rust.sh
run: TOOLCHAIN=${{ matrix.target.toolchain }} ./ci/install-rust.sh
- name: Execute build.sh
run: TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/build.sh
run: TOOLCHAIN=${{ matrix.target.toolchain }} ./ci/build.sh

build_channels_windows:
name: Build Channels Windows
Expand All @@ -80,7 +84,7 @@ jobs:
run: rustup self update
shell: bash
- name: Execute build.sh
run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh
run: TOOLCHAIN=${{ matrix.toolchain }} ./ci/build.sh
shell: bash

macos:
Expand All @@ -94,9 +98,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
run: TARGET=${{ matrix.target }} ./ci/install-rust.sh
- name: Execute run.sh
run: sh ./ci/run.sh ${{ matrix.target }}
run: ./ci/run.sh ${{ matrix.target }}

windows:
name: Windows
Expand Down Expand Up @@ -124,10 +128,10 @@ jobs:
run: rustup self update
shell: bash
- name: Setup Rust toolchain
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
run: TARGET=${{ matrix.target }} ./ci/install-rust.sh
shell: bash
- name: Execute run.sh
run: sh ./ci/run.sh ${{ matrix.target }}
run: ./ci/run.sh ${{ matrix.target }}
shell: bash


Expand All @@ -143,9 +147,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
run: TARGET=${{ matrix.target }} ./ci/install-rust.sh
- name: Execute run-docker.sh
run: sh ./ci/run-docker.sh ${{ matrix.target }}
run: ./ci/run-docker.sh ${{ matrix.target }}

docker_linux_tier2:
name: Docker Linux Tier2
Expand Down Expand Up @@ -185,9 +189,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
run: TARGET=${{ matrix.target }} ./ci/install-rust.sh
- name: Execute run-docker.sh
run: sh ./ci/run-docker.sh ${{ matrix.target }}
run: ./ci/run-docker.sh ${{ matrix.target }}

solaris:
name: Solaris
Expand All @@ -214,15 +218,15 @@ jobs:
uname -a
run: |
export PATH=$HOME/.rust_solaris/bin:$PATH
bash ./ci/run.sh ${{ matrix.target }}
./ci/run.sh ${{ matrix.target }}
check_cfg:
name: "Check #[cfg]s"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: TOOLCHAIN=nightly sh ./ci/install-rust.sh
run: TOOLCHAIN=nightly ./ci/install-rust.sh
- name: Build with check-cfg
run: LIBC_CHECK_CFG=1 cargo build -Z unstable-options -Z check-cfg

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ We have two automated tests running on
- `cd libc-test && cargo test`
- Use the `skip_*()` functions in `build.rs` if you really need a workaround.
2. Style checker
- [`sh ci/style.sh`](https://github.com/rust-lang/libc/blob/main/ci/style.sh)
- [`./ci/style.sh`](https://github.com/rust-lang/libc/blob/main/ci/style.sh)

## Breaking change policy

Expand Down
Empty file modified ci/android-install-ndk.sh
100644 → 100755
Empty file.
Empty file modified ci/android-install-sdk.sh
100644 → 100755
Empty file.
Empty file modified ci/android-sysimage.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion ci/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ esac
for target in $targets; do
if echo "$target" | grep -q "$filter"; then
if [ "${OS}" = "windows" ]; then
TARGET="$target" sh ./ci/install-rust.sh
TARGET="$target" ./ci/install-rust.sh
test_target build "$target"
else
test_target build "$target"
Expand Down
4 changes: 2 additions & 2 deletions ci/docker/aarch64-linux-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ COPY android* /android/
ENV ANDROID_ARCH=aarch64
ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools

RUN sh /android/android-install-ndk.sh
RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
RUN /android/android-install-ndk.sh
RUN /android/android-install-sdk.sh $ANDROID_ARCH
RUN mv /root/.android /tmp
RUN chmod 777 -R /tmp/.android
RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/*
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/aarch64-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gcc-aarch64-linux-gnu qemu-user

COPY install-musl.sh /
RUN sh /install-musl.sh aarch64
RUN /install-musl.sh aarch64

# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in std?
ENV PATH=$PATH:/musl-aarch64/bin:/rust/bin \
Expand Down
4 changes: 2 additions & 2 deletions ci/docker/arm-linux-androideabi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ COPY android* /android/
ENV ANDROID_ARCH=arm
ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools

RUN sh /android/android-install-ndk.sh
RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
RUN /android/android-install-ndk.sh
RUN /android/android-install-sdk.sh $ANDROID_ARCH
RUN mv /root/.android /tmp
RUN chmod 777 -R /tmp/.android
RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/*
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/arm-unknown-linux-musleabihf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
gcc-arm-linux-gnueabihf qemu-user

COPY install-musl.sh /
RUN sh /install-musl.sh arm
RUN /install-musl.sh arm

ENV PATH=$PATH:/musl-arm/bin:/rust/bin \
CC_arm_unknown_linux_musleabihf=musl-gcc \
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/asmjs-unknown-emscripten/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apt-get install -y --no-install-recommends \
bzip2

COPY emscripten.sh /
RUN bash /emscripten.sh
RUN /emscripten.sh

ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_ASMJS_UNKNOWN_EMSCRIPTEN_RUNNER=node
Expand Down
4 changes: 2 additions & 2 deletions ci/docker/i686-linux-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ COPY android* /android/
ENV ANDROID_ARCH=i686
ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools

RUN sh /android/android-install-ndk.sh
RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
RUN /android/android-install-ndk.sh
RUN /android/android-install-sdk.sh $ANDROID_ARCH
RUN mv /root/.android /tmp
RUN chmod 777 -R /tmp/.android
RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/*
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/i686-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
gcc-multilib make libc6-dev git curl ca-certificates libc6-i386

COPY install-musl.sh /
RUN sh /install-musl.sh i686
RUN /install-musl.sh i686

ENV PATH=$PATH:/musl-i686/bin:/rust/bin \
CC_i686_unknown_linux_musl=musl-gcc \
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/loongarch64-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl gcc git libc6-dev make qemu-user xz-utils

COPY install-musl-cross.sh /
RUN sh /install-musl-cross.sh loongarch64-unknown-linux-musl
RUN /install-musl-cross.sh loongarch64-unknown-linux-musl

ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=loongarch64-unknown-linux-musl-gcc \
CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_RUNNER="qemu-loongarch64" \
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/s390x-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
cpio

COPY linux-s390x.sh /
RUN bash /linux-s390x.sh
RUN /linux-s390x.sh

COPY test-runner-linux /

Expand Down
2 changes: 1 addition & 1 deletion ci/docker/s390x-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
qemu-user

COPY install-musl.sh /
RUN sh /install-musl.sh s390x
RUN /install-musl.sh s390x

# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in std?
ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/sparc64-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
p7zip-full cpio linux-libc-dev-sparc64-cross

COPY linux-sparc64.sh /
RUN bash /linux-sparc64.sh
RUN /linux-sparc64.sh

COPY test-runner-linux /

Expand Down
2 changes: 1 addition & 1 deletion ci/docker/wasm32-unknown-emscripten/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RUN apt-get install -y --no-install-recommends \
RUN ln -s /usr/bin/python3 /usr/bin/python & \
ln -s /usr/bin/pip3 /usr/bin/pip
COPY emscripten.sh /
RUN bash /emscripten.sh
RUN /emscripten.sh

ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node-wrapper.sh
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/wasm32-wasip1/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:24.10

COPY wasi.sh /
RUN bash /wasi.sh
RUN /wasi.sh

# Note that `-D_WASI_EMULATED_PROCESS_CLOCKS` is used to enable access to
# clock-related defines even though they're emulated. Also note that the usage
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/wasm32-wasip2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:24.10

COPY wasi.sh /
RUN bash /wasi.sh
RUN /wasi.sh

# Note that most of these are copied from `wasm32-wasip1/Dockerfile`
#
Expand Down
4 changes: 2 additions & 2 deletions ci/docker/x86_64-linux-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ RUN apt-get update && \
WORKDIR /android/
ENV ANDROID_ARCH=x86_64
COPY android-install-ndk.sh /android/
RUN sh /android/android-install-ndk.sh
RUN /android/android-install-ndk.sh

# We do not run x86_64-linux-android tests on an android emulator.
# See ci/android-sysimage.sh for information about how tests are run.
COPY android-sysimage.sh /android/
RUN bash /android/android-sysimage.sh x86_64 x86_64-24_r07.zip
RUN /android/android-sysimage.sh x86_64 x86_64-24_r07.zip

ENV PATH=$PATH:/rust/bin:/android/linux-x86_64/bin \
CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android28-clang \
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/x86_64-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates

COPY install-musl.sh /
RUN sh /install-musl.sh x86_64
RUN /install-musl.sh x86_64

ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin \
RUSTFLAGS="-L /musl-x86_64/lib"
Empty file modified ci/emscripten.sh
100644 → 100755
Empty file.
Empty file modified ci/install-musl-cross.sh
100644 → 100755
Empty file.
Empty file modified ci/install-musl.sh
100644 → 100755
Empty file.
Empty file modified ci/install-rust.sh
100644 → 100755
Empty file.
Empty file modified ci/linux-s390x.sh
100644 → 100755
Empty file.
Empty file modified ci/linux-sparc64.sh
100644 → 100755
Empty file.
Empty file modified ci/wasi.sh
100644 → 100755
Empty file.

0 comments on commit 4707c5d

Please sign in to comment.