From bba23956db88fc13063c24597cf02eb917a38cbd Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 29 Aug 2024 15:16:29 -0500 Subject: [PATCH 1/4] ci: Use YAML arrays --- .github/workflows/full_ci.yml | 95 ++++++++++++++++------------------- 1 file changed, 44 insertions(+), 51 deletions(-) diff --git a/.github/workflows/full_ci.yml b/.github/workflows/full_ci.yml index 13f26ac6fa2d5..ffb996fa8862e 100644 --- a/.github/workflows/full_ci.yml +++ b/.github/workflows/full_ci.yml @@ -15,10 +15,9 @@ jobs: strategy: fail-fast: true matrix: - target: [ - i686-unknown-linux-gnu, - x86_64-unknown-linux-gnu, - ] + target: + - i686-unknown-linux-gnu + - x86_64-unknown-linux-gnu steps: - uses: actions/checkout@v4 - name: Setup Rust toolchain @@ -35,9 +34,8 @@ jobs: strategy: fail-fast: true matrix: - target: [ - aarch64-apple-darwin, - ] + target: + - aarch64-apple-darwin steps: - uses: actions/checkout@v4 - name: Setup Rust toolchain @@ -104,32 +102,31 @@ jobs: fail-fast: true max-parallel: 12 matrix: - target: [ - aarch64-linux-android, - aarch64-unknown-linux-gnu, - aarch64-unknown-linux-musl, - arm-linux-androideabi, - arm-unknown-linux-gnueabihf, - arm-unknown-linux-musleabihf, - i686-linux-android, - i686-unknown-linux-musl, - powerpc-unknown-linux-gnu, - powerpc64-unknown-linux-gnu, - powerpc64le-unknown-linux-gnu, - s390x-unknown-linux-gnu, - riscv64gc-unknown-linux-gnu, - wasm32-wasip1, - wasm32-wasip2, - sparc64-unknown-linux-gnu, - wasm32-unknown-emscripten, - x86_64-linux-android, + target: + - aarch64-linux-android + - aarch64-unknown-linux-gnu + - aarch64-unknown-linux-musl + - arm-linux-androideabi + - arm-unknown-linux-gnueabihf + - arm-unknown-linux-musleabihf + - i686-linux-android + - i686-unknown-linux-musl + - powerpc-unknown-linux-gnu + - powerpc64-unknown-linux-gnu + - powerpc64le-unknown-linux-gnu + - s390x-unknown-linux-gnu + - riscv64gc-unknown-linux-gnu + - wasm32-wasip1 + - wasm32-wasip2 + - sparc64-unknown-linux-gnu + - wasm32-unknown-emscripten + - x86_64-linux-android # FIXME: Exec format error (os error 8) - #x86_64-unknown-linux-gnux32, - x86_64-unknown-linux-musl, + # - x86_64-unknown-linux-gnux32 + - x86_64-unknown-linux-musl # FIXME: It seems some items in `src/unix/mod.rs` # aren't defined on redox actually. - # x86_64-unknown-redox, - ] + # - x86_64-unknown-redox steps: - uses: actions/checkout@v4 - name: Setup Rust toolchain @@ -150,12 +147,11 @@ jobs: fail-fast: true max-parallel: 5 matrix: - toolchain: [ - stable, - beta, - nightly, - 1.63.0, - ] + toolchain: + - stable + - beta + - nightly + - 1.63.0 steps: - uses: actions/checkout@v4 - name: Setup Rust toolchain @@ -199,10 +195,9 @@ jobs: strategy: fail-fast: true matrix: - toolchain: [ - 1.63.0, - stable, - ] + toolchain: + - 1.63.0 + - stable steps: - uses: actions/checkout@v4 - name: Self-update rustup @@ -215,7 +210,6 @@ jobs: check_cfg: permissions: contents: read # to fetch code (actions/checkout) - name: "Check #[cfg]s" runs-on: ubuntu-22.04 steps: @@ -230,16 +224,15 @@ jobs: success: name: success runs-on: ubuntu-22.04 - needs: [ - docker_linux_tier1, - docker_linux_tier2, - macos, - windows, - style_check, - build_channels_linux, - build_channels_macos, - build_channels_windows, - ] + needs: + - docker_linux_tier1 + - docker_linux_tier2 + - macos + - windows + - style_check + - build_channels_linux + - build_channels_macos + - build_channels_windows # 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. From 4406ec22375d53cd7777d36dee1133579d191176 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 29 Aug 2024 15:22:32 -0500 Subject: [PATCH 2/4] ci: remove unneeded `permissions.contents` keys --- .github/workflows/full_ci.yml | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/.github/workflows/full_ci.yml b/.github/workflows/full_ci.yml index ffb996fa8862e..54a59d24fb591 100644 --- a/.github/workflows/full_ci.yml +++ b/.github/workflows/full_ci.yml @@ -7,9 +7,6 @@ on: jobs: docker_linux_tier1: - permissions: - contents: read # to fetch code (actions/checkout) - name: Docker Linux Tier1 runs-on: ubuntu-22.04 strategy: @@ -26,9 +23,6 @@ jobs: run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }} macos: - permissions: - contents: read # to fetch code (actions/checkout) - name: macOS runs-on: macos-14 strategy: @@ -44,9 +38,6 @@ jobs: run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }} windows: - permissions: - contents: read # to fetch code (actions/checkout) - name: Windows runs-on: windows-2022 env: @@ -79,9 +70,6 @@ jobs: shell: bash style_check: - permissions: - contents: read # to fetch code (actions/checkout) - name: Style check runs-on: ubuntu-22.04 steps: @@ -92,9 +80,6 @@ jobs: run: sh ci/style.sh docker_linux_tier2: - permissions: - contents: read # to fetch code (actions/checkout) - name: Docker Linux Tier2 needs: [docker_linux_tier1, style_check] runs-on: ubuntu-22.04 @@ -135,9 +120,6 @@ jobs: run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }} build_channels_linux: - permissions: - contents: read # to fetch code (actions/checkout) - name: Build Channels Linux needs: docker_linux_tier2 runs-on: ubuntu-22.04 @@ -160,9 +142,6 @@ jobs: run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh build_channels_macos: - permissions: - contents: read # to fetch code (actions/checkout) - name: Build Channels macOS needs: macos env: @@ -185,9 +164,6 @@ jobs: run: LIBC_CI=1 TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/build.sh build_channels_windows: - permissions: - contents: read # to fetch code (actions/checkout) - name: Build Channels Windows runs-on: windows-2022 env: @@ -208,8 +184,6 @@ jobs: shell: bash check_cfg: - permissions: - contents: read # to fetch code (actions/checkout) name: "Check #[cfg]s" runs-on: ubuntu-22.04 steps: From 2e4e0ed81f5525abba7c6cf99968df3a2e61db2b Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 29 Aug 2024 15:28:31 -0500 Subject: [PATCH 3/4] ci: reorder jobs, don't make native linux depend on tier 2 tests --- .github/workflows/full_ci.yml | 152 +++++++++++++++++----------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/.github/workflows/full_ci.yml b/.github/workflows/full_ci.yml index 54a59d24fb591..2b7a27fbdc632 100644 --- a/.github/workflows/full_ci.yml +++ b/.github/workflows/full_ci.yml @@ -6,21 +6,78 @@ on: types: [opened, synchronize, reopened] jobs: - docker_linux_tier1: - name: Docker Linux Tier1 + 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 + - name: Check style + run: sh ci/style.sh + + build_channels_linux: + name: Build Channels Linux + runs-on: ubuntu-22.04 + env: + OS: linux + strategy: + fail-fast: true + max-parallel: 5 + matrix: + toolchain: + - stable + - beta + - nightly + - 1.63.0 + steps: + - uses: actions/checkout@v4 + - name: Setup Rust toolchain + run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/install-rust.sh + - name: Execute build.sh + run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh + + build_channels_macos: + name: Build Channels macOS + needs: macos + env: + OS: macos strategy: fail-fast: true + max-parallel: 4 matrix: target: - - i686-unknown-linux-gnu - - x86_64-unknown-linux-gnu + - { 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 }} steps: - uses: actions/checkout@v4 - name: Setup Rust toolchain - run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh - - name: Execute run-docker.sh - run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }} + run: TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/install-rust.sh + - name: Execute build.sh + run: LIBC_CI=1 TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/build.sh + + build_channels_windows: + name: Build Channels Windows + runs-on: windows-2022 + env: + OS: windows + strategy: + fail-fast: true + matrix: + toolchain: + - 1.63.0 + - stable + steps: + - uses: actions/checkout@v4 + - name: Self-update rustup + run: rustup self update + shell: bash + - name: Execute build.sh + run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh + shell: bash macos: name: macOS @@ -69,15 +126,22 @@ jobs: run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }} shell: bash - style_check: - name: Style check + + docker_linux_tier1: + name: Docker Linux Tier1 runs-on: ubuntu-22.04 + strategy: + fail-fast: true + matrix: + target: + - i686-unknown-linux-gnu + - x86_64-unknown-linux-gnu steps: - uses: actions/checkout@v4 - name: Setup Rust toolchain - run: sh ./ci/install-rust.sh - - name: Check style - run: sh ci/style.sh + run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh + - name: Execute run-docker.sh + run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }} docker_linux_tier2: name: Docker Linux Tier2 @@ -119,70 +183,6 @@ jobs: - name: Execute run-docker.sh run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }} - build_channels_linux: - name: Build Channels Linux - needs: docker_linux_tier2 - runs-on: ubuntu-22.04 - env: - OS: linux - strategy: - fail-fast: true - max-parallel: 5 - matrix: - toolchain: - - stable - - beta - - nightly - - 1.63.0 - steps: - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/install-rust.sh - - name: Execute build.sh - run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh - - build_channels_macos: - name: Build Channels macOS - needs: macos - env: - OS: 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 }} - steps: - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - run: TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/install-rust.sh - - name: Execute build.sh - run: LIBC_CI=1 TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/build.sh - - build_channels_windows: - name: Build Channels Windows - runs-on: windows-2022 - env: - OS: windows - strategy: - fail-fast: true - matrix: - toolchain: - - 1.63.0 - - stable - steps: - - uses: actions/checkout@v4 - - name: Self-update rustup - run: rustup self update - shell: bash - - name: Execute build.sh - run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh - shell: bash - check_cfg: name: "Check #[cfg]s" runs-on: ubuntu-22.04 From 72940168e3d68c99062d6f849bcbe694bc03aea2 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 29 Aug 2024 15:30:04 -0500 Subject: [PATCH 4/4] ci: just set required env globally --- .github/workflows/full_ci.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/full_ci.yml b/.github/workflows/full_ci.yml index 2b7a27fbdc632..662f3921ef502 100644 --- a/.github/workflows/full_ci.yml +++ b/.github/workflows/full_ci.yml @@ -5,6 +5,9 @@ on: pull_request: types: [opened, synchronize, reopened] +env: + LIBC_CI: 1 + jobs: style_check: name: Style check @@ -35,7 +38,7 @@ jobs: - name: Setup Rust toolchain run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/install-rust.sh - name: Execute build.sh - run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh + run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh build_channels_macos: name: Build Channels macOS @@ -57,7 +60,7 @@ jobs: - name: Setup Rust toolchain run: TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/install-rust.sh - name: Execute build.sh - run: LIBC_CI=1 TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/build.sh + run: TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/build.sh build_channels_windows: name: Build Channels Windows @@ -76,7 +79,7 @@ jobs: run: rustup self update shell: bash - name: Execute build.sh - run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh + run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh shell: bash macos: @@ -92,7 +95,7 @@ jobs: - name: Setup Rust toolchain run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh - name: Execute run.sh - run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }} + run: sh ./ci/run.sh ${{ matrix.target }} windows: name: Windows @@ -123,7 +126,7 @@ jobs: run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh shell: bash - name: Execute run.sh - run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }} + run: sh ./ci/run.sh ${{ matrix.target }} shell: bash @@ -141,7 +144,7 @@ jobs: - name: Setup Rust toolchain run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh - name: Execute run-docker.sh - run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }} + run: sh ./ci/run-docker.sh ${{ matrix.target }} docker_linux_tier2: name: Docker Linux Tier2 @@ -181,7 +184,7 @@ jobs: - name: Setup Rust toolchain run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh - name: Execute run-docker.sh - run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }} + run: sh ./ci/run-docker.sh ${{ matrix.target }} check_cfg: name: "Check #[cfg]s" @@ -191,7 +194,7 @@ jobs: - name: Setup Rust toolchain run: TOOLCHAIN=nightly sh ./ci/install-rust.sh - name: Build with check-cfg - run: LIBC_CI=1 LIBC_CHECK_CFG=1 cargo build -Z unstable-options -Z check-cfg + run: LIBC_CHECK_CFG=1 cargo build -Z unstable-options -Z check-cfg # One job that "summarizes" the success state of this pipeline. This can then be added to branch # protection, rather than having to add each job separately.