mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Revert "chore: detect the channel a PR wants to merge into"
This commit is contained in:
parent
f7b95e3164
commit
ffbf0ec4b5
104
.github/workflows/main.yml
vendored
104
.github/workflows/main.yml
vendored
@ -16,20 +16,6 @@ env:
|
|||||||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
|
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Determine which channel will be merged into.
|
|
||||||
channel:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
CHANNEL: ${{ steps.channel.outputs.CHANNEL }}
|
|
||||||
env:
|
|
||||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0 # fetch all branches
|
|
||||||
- id: channel
|
|
||||||
run: ci/which-channel.sh
|
|
||||||
|
|
||||||
# Check Code style quickly by running `rustfmt` over all code
|
# Check Code style quickly by running `rustfmt` over all code
|
||||||
rustfmt:
|
rustfmt:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -77,42 +63,8 @@ jobs:
|
|||||||
- run: rustup update stable && rustup default stable
|
- run: rustup update stable && rustup default stable
|
||||||
- run: ci/validate-version-bump.sh
|
- run: ci/validate-version-bump.sh
|
||||||
|
|
||||||
# Generate strategy matrix for different platforms and channels
|
|
||||||
# (see ci/matrix.json)
|
|
||||||
matrix:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs:
|
|
||||||
- channel
|
|
||||||
outputs:
|
|
||||||
matrix: ${{ steps.matrix.outputs.matrix }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Generate strategy matrix
|
|
||||||
id: matrix
|
|
||||||
run: |
|
|
||||||
CHANNEL=${{ needs.channel.outputs.CHANNEL }}
|
|
||||||
|
|
||||||
# This reads ci/matrix.json and then filters the environment we want to
|
|
||||||
# build on, based on the channel this PR want to merge into.
|
|
||||||
#
|
|
||||||
# * For stable, we build only on stable toolchain.
|
|
||||||
# * For beta, we build on stable and beta.
|
|
||||||
# * For nightly, we build on stable, beta, and nightly.
|
|
||||||
MATRIX=$(
|
|
||||||
jq --arg C "$CHANNEL" 'map (. |
|
|
||||||
if ($C == "beta") then select(.rust | startswith("nightly") | not)
|
|
||||||
elif ($C == "stable") then select(.rust | startswith("stable"))
|
|
||||||
else . end)' ci/matrix.json
|
|
||||||
)
|
|
||||||
echo "$MATRIX"
|
|
||||||
|
|
||||||
# Outputs as Job's outputs for other jobs to reuse.
|
|
||||||
echo "MATRIX={\"include\":$(echo $MATRIX)}" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
needs:
|
|
||||||
- matrix
|
|
||||||
env:
|
env:
|
||||||
CARGO_PROFILE_DEV_DEBUG: 1
|
CARGO_PROFILE_DEV_DEBUG: 1
|
||||||
CARGO_PROFILE_TEST_DEBUG: 1
|
CARGO_PROFILE_TEST_DEBUG: 1
|
||||||
@ -121,7 +73,36 @@ jobs:
|
|||||||
# Deny warnings on CI to avoid warnings getting into the codebase.
|
# Deny warnings on CI to avoid warnings getting into the codebase.
|
||||||
RUSTFLAGS: -D warnings
|
RUSTFLAGS: -D warnings
|
||||||
strategy:
|
strategy:
|
||||||
matrix: ${{ fromJSON(needs.matrix.outputs.MATRIX) }}
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: Linux x86_64 stable
|
||||||
|
os: ubuntu-latest
|
||||||
|
rust: stable
|
||||||
|
other: i686-unknown-linux-gnu
|
||||||
|
- name: Linux x86_64 beta
|
||||||
|
os: ubuntu-latest
|
||||||
|
rust: beta
|
||||||
|
other: i686-unknown-linux-gnu
|
||||||
|
- name: Linux x86_64 nightly
|
||||||
|
os: ubuntu-latest
|
||||||
|
rust: nightly
|
||||||
|
other: i686-unknown-linux-gnu
|
||||||
|
- name: macOS x86_64 stable
|
||||||
|
os: macos-latest
|
||||||
|
rust: stable
|
||||||
|
other: x86_64-apple-ios
|
||||||
|
- name: macOS x86_64 nightly
|
||||||
|
os: macos-latest
|
||||||
|
rust: nightly
|
||||||
|
other: x86_64-apple-ios
|
||||||
|
- name: Windows x86_64 MSVC stable
|
||||||
|
os: windows-latest
|
||||||
|
rust: stable-msvc
|
||||||
|
other: i686-pc-windows-msvc
|
||||||
|
- name: Windows x86_64 gnu nightly # runs out of space while trying to link the test suite
|
||||||
|
os: windows-latest
|
||||||
|
rust: nightly-gnu
|
||||||
|
other: i686-pc-windows-gnu
|
||||||
name: Tests ${{ matrix.name }}
|
name: Tests ${{ matrix.name }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
@ -199,9 +180,6 @@ jobs:
|
|||||||
|
|
||||||
build_std:
|
build_std:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
|
||||||
- channel
|
|
||||||
if: needs.channel.outputs.CHANNEL == 'master'
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- run: rustup update nightly && rustup default nightly
|
- run: rustup update nightly && rustup default nightly
|
||||||
@ -212,8 +190,6 @@ jobs:
|
|||||||
CARGO_RUN_BUILD_STD_TESTS: 1
|
CARGO_RUN_BUILD_STD_TESTS: 1
|
||||||
docs:
|
docs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
|
||||||
- channel
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- run: rustup update nightly && rustup default nightly
|
- run: rustup update nightly && rustup default nightly
|
||||||
@ -235,36 +211,22 @@ jobs:
|
|||||||
- run: cd src/doc && mdbook build --dest-dir ../../target/doc
|
- run: cd src/doc && mdbook build --dest-dir ../../target/doc
|
||||||
- name: Run linkchecker.sh
|
- name: Run linkchecker.sh
|
||||||
run: |
|
run: |
|
||||||
BRANCH=${{ needs.channel.outputs.CHANNEL }}
|
|
||||||
cd target
|
cd target
|
||||||
curl -sSLO "https://raw.githubusercontent.com/rust-lang/rust/$BRANCH/src/tools/linkchecker/linkcheck.sh"
|
curl -sSLO https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
|
||||||
sh linkcheck.sh --all --path ../src/doc cargo
|
sh linkcheck.sh --all --path ../src/doc cargo
|
||||||
|
|
||||||
# Jobs that may be skipped if they aren't going to merge into master (nightly).
|
|
||||||
#
|
|
||||||
# This is needed because GitHub Actions treats success() as false if a job is
|
|
||||||
# skipped, and the bors success/failure jobs below need to ignore skipped jobs.
|
|
||||||
z-nightly-jobs:
|
|
||||||
needs:
|
|
||||||
- channel
|
|
||||||
- build_std
|
|
||||||
if: "(needs.channel.outputs.CHANNEL != 'master' && !failure()) || success()"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: exit 0
|
|
||||||
|
|
||||||
success:
|
success:
|
||||||
permissions:
|
permissions:
|
||||||
contents: none
|
contents: none
|
||||||
name: bors build finished
|
name: bors build finished
|
||||||
needs:
|
needs:
|
||||||
|
- build_std
|
||||||
- docs
|
- docs
|
||||||
- lockfile
|
- lockfile
|
||||||
- resolver
|
- resolver
|
||||||
- rustfmt
|
- rustfmt
|
||||||
- test
|
- test
|
||||||
- test_gitoxide
|
- test_gitoxide
|
||||||
- z-nightly-jobs
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto-cargo'"
|
if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto-cargo'"
|
||||||
steps:
|
steps:
|
||||||
@ -274,13 +236,13 @@ jobs:
|
|||||||
contents: none
|
contents: none
|
||||||
name: bors build finished
|
name: bors build finished
|
||||||
needs:
|
needs:
|
||||||
|
- build_std
|
||||||
- docs
|
- docs
|
||||||
- lockfile
|
- lockfile
|
||||||
- resolver
|
- resolver
|
||||||
- rustfmt
|
- rustfmt
|
||||||
- test
|
- test
|
||||||
- test_gitoxide
|
- test_gitoxide
|
||||||
- z-nightly-jobs
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto-cargo'"
|
if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto-cargo'"
|
||||||
steps:
|
steps:
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"name": "Linux x86_64 stable",
|
|
||||||
"os": "ubuntu-latest",
|
|
||||||
"rust": "stable",
|
|
||||||
"other": "i686-unknown-linux-gnu"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Linux x86_64 beta",
|
|
||||||
"os": "ubuntu-latest",
|
|
||||||
"rust": "beta",
|
|
||||||
"other": "i686-unknown-linux-gnu"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Linux x86_64 nightly",
|
|
||||||
"os": "ubuntu-latest",
|
|
||||||
"rust": "nightly",
|
|
||||||
"other": "i686-unknown-linux-gnu"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "macOS x86_64 stable",
|
|
||||||
"os": "macos-latest",
|
|
||||||
"rust": "stable",
|
|
||||||
"other": "x86_64-apple-ios"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "macOS x86_64 nightly",
|
|
||||||
"os": "macos-latest",
|
|
||||||
"rust": "nightly",
|
|
||||||
"other": "x86_64-apple-ios"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Windows x86_64 MSVC stable",
|
|
||||||
"os": "windows-latest",
|
|
||||||
"rust": "stable-msvc",
|
|
||||||
"other": "i686-pc-windows-msvc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Windows x86_64 gnu nightly",
|
|
||||||
"os": "windows-latest",
|
|
||||||
"rust": "nightly-gnu",
|
|
||||||
"other": "i686-pc-windows-gnu"
|
|
||||||
}
|
|
||||||
]
|
|
@ -1,50 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# This script outputs the channel where a CI workflow wants to merge into.
|
|
||||||
#
|
|
||||||
# Inputs:
|
|
||||||
# BASE_SHA The commit SHA of the branch where the PR wants to merge into.
|
|
||||||
#
|
|
||||||
# GitHub Action Outputs:
|
|
||||||
# CHANNEL Target channel where the PR wants to merge into.
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# When `BASE_SHA` is missing, we assume it is from bors merge commit,
|
|
||||||
# so hope `HEAD~` to find the previous commit on master branch.
|
|
||||||
base_sha=$(git rev-parse "${BASE_SHA:-HEAD~1}")
|
|
||||||
|
|
||||||
# Get symbolic names for the base_sha.
|
|
||||||
# Assumption: Cargo branches are always in the format of `rust-1.*.0`,
|
|
||||||
# otherwise `git name-rev` will return "undefined".
|
|
||||||
ref=$(git name-rev --name-only --refs='origin/rust-1.*.0' $base_sha)
|
|
||||||
|
|
||||||
# Get the latest `rust-1.*.0` branch from remote origin.
|
|
||||||
# Assumption: The latest branch is always beta branch.
|
|
||||||
beta=$(
|
|
||||||
git branch --remotes --list 'origin/rust-1.*.0' \
|
|
||||||
| sort --version-sort \
|
|
||||||
| tail -n1 \
|
|
||||||
| tr -d "[:space:]"
|
|
||||||
)
|
|
||||||
|
|
||||||
master=$(git rev-parse origin/master)
|
|
||||||
|
|
||||||
# Backport pull requests always target at a `rust-1.*.0` branch.
|
|
||||||
if [[ "$ref" = "undefined" ]] || [[ "$base_sha" = "$master" ]]
|
|
||||||
then
|
|
||||||
# Should be nightly but for convenience in CI let's call it master.
|
|
||||||
channel="master"
|
|
||||||
elif [[ "$ref" = "$beta" ]]
|
|
||||||
then
|
|
||||||
channel="beta"
|
|
||||||
else
|
|
||||||
channel="stable"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Base sha: $base_sha"
|
|
||||||
echo "Git Ref: $ref"
|
|
||||||
echo "master: $master"
|
|
||||||
echo "beta: $beta"
|
|
||||||
echo "Channel: $channel"
|
|
||||||
|
|
||||||
echo "CHANNEL=$channel" >> "$GITHUB_OUTPUT"
|
|
Loading…
x
Reference in New Issue
Block a user