fork/cargo
git clone https://git.julia.blue/fork/cargo
1f5feecdf
master
1name : CI 2on : 3merge_group : 4pull_request : 5branches : 6- "**" 7 8defaults : 9run : 10shell : bash 11 12permissions : 13contents : read 14 15concurrency : 16group : "${{ github.workflow }}-${{ github.ref }}" 17cancel-in-progress : true 18 19env : 20MDBOOK_VERSION : 0.5.1 21 22jobs : 23conclusion : 24needs : 25- build_std 26- clippy 27- msrv 28- docs 29- lint-docs 30- lockfile 31- resolver 32- report-timings 33- rustfmt 34- schema 35- spellcheck 36- test 37- test_gitoxide 38permissions : 39contents : none 40# We need to ensure this job does *not* get skipped if its dependencies fail, 41# because a skipped job is considered a success by GitHub. So we have to 42# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run 43# when the workflow is canceled manually. 44# 45# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! 46if : ${{ !cancelled() }} 47runs-on : ubuntu-latest 48steps : 49# Manually check the status of all dependencies. `if: failure()` does not work. 50- name : Conclusion 51run : | 52# Print the dependent jobs to see them in the CI log 53jq -C <<< '${{ toJson(needs) }}' 54# Check if all jobs that we depend on (in the needs array) were successful. 55jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' 56 57# Check Code style quickly by running `rustfmt` over all code 58rustfmt : 59runs-on : ubuntu-latest 60steps : 61- uses : actions/checkout@v5 62- run : rustup update stable && rustup default stable 63- run : rustup component add rustfmt 64- run : cargo fmt --all --check 65 66# Ensure there are no clippy warnings 67clippy : 68strategy : 69matrix : 70include : 71- name : Linux x86_64 72os : ubuntu-latest 73- name : macOS aarch64 74os : macos-14 75- name : Windows x86_64 MSVC 76os : windows-latest 77name : Clippy ${{ matrix.name }} 78runs-on : ${{ matrix.os }} 79steps : 80- uses : actions/checkout@v5 81- run : rustup update stable && rustup default stable 82- run : rustup component add clippy 83- run : cargo clippy --workspace --all-targets --no-deps -- -D warnings 84 85stale-label : 86runs-on : ubuntu-latest 87steps : 88- uses : actions/checkout@v5 89- run : rustup update stable && rustup default stable 90- run : cargo stale-label 91 92lint-docs : 93runs-on : ubuntu-latest 94steps : 95- uses : actions/checkout@v5 96- run : rustup update stable && rustup default stable 97- run : cargo lint-docs --check 98 99# Ensure Cargo.lock is up-to-date 100lockfile : 101runs-on : ubuntu-latest 102steps : 103- uses : actions/checkout@v5 104- run : rustup update stable && rustup default stable 105- run : cargo update -p cargo --locked 106 107check-version-bump : 108runs-on : ubuntu-latest 109if : github.repository_owner == 'rust-lang' 110env : 111BASE_SHA : ${{ github.event.pull_request.base.sha }} 112HEAD_SHA : ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha }} 113steps : 114- uses : actions/checkout@v5 115with : 116fetch-depth : 0 117- run : rustup update stable && rustup default stable 118- name : Install cargo-semver-checks 119run : | 120mkdir installed-bins 121curl -Lf https://github.com/obi1kenobi/cargo-semver-checks/releases/download/v0.45.0/cargo-semver-checks-x86_64-unknown-linux-gnu.tar.gz \ 122| tar -xz --directory=./installed-bins 123echo `pwd`/installed-bins >> $GITHUB_PATH 124- run : ci/validate-version-bump.sh 125 126test : 127runs-on : ${{ matrix.os }} 128env : 129CARGO_PROFILE_DEV_DEBUG : 1 130CARGO_PROFILE_TEST_DEBUG : 1 131CARGO_INCREMENTAL : 0 132CARGO_PUBLIC_NETWORK_TESTS : 1 133# Workaround for https://github.com/rust-lang/rustup/issues/3036 134RUSTUP_WINDOWS_PATH_ADD_BIN : 0 135strategy : 136matrix : 137include : 138- name : Linux x86_64 stable 139os : ubuntu-latest 140rust : stable 141other : i686-unknown-linux-gnu 142- name : Linux x86_64 beta 143os : ubuntu-latest 144rust : beta 145other : i686-unknown-linux-gnu 146- name : Linux x86_64 nightly 147os : ubuntu-latest 148rust : nightly 149other : i686-unknown-linux-gnu 150- name : Linux aarch64 stable 151os : ubuntu-24.04-arm 152rust : stable 153other : TODO # cross-compile tests are disabled, this shouldn't matter. 154- name : Linux aarch64 nightly 155os : ubuntu-24.04-arm 156rust : nightly 157other : TODO # cross-compile tests are disabled, this shouldn't matter. 158- name : macOS aarch64 stable 159os : macos-14 160rust : stable 161other : x86_64-apple-darwin 162- name : macOS aarch64 nightly 163os : macos-14 164rust : nightly 165other : x86_64-apple-darwin 166- name : Windows x86_64 MSVC stable 167os : windows-latest 168rust : stable-msvc 169other : i686-pc-windows-msvc 170- name : Windows x86_64 MSVC nightly 171os : windows-latest 172rust : nightly-msvc 173other : i686-pc-windows-msvc 174- name : Windows aarch64 MSVC stable 175os : windows-11-arm 176rust : stable-msvc 177other : i686-pc-windows-msvc 178- name : Windows aarch64 MSVC nightly 179os : windows-11-arm 180rust : nightly-msvc 181other : i686-pc-windows-msvc 182- name : Windows x86_64 gnu nightly # runs out of space while trying to link the test suite 183os : windows-latest 184rust : nightly-gnu 185other : i686-pc-windows-gnu 186name : Tests ${{ matrix.name }} 187steps : 188- uses : actions/checkout@v5 189- name : Dump Environment 190run : ci/dump-environment.sh 191# Some tests require stable. Make sure it is set to the most recent stable 192# so that we can predictably handle updates if necessary (and not randomly 193# when GitHub updates its image). 194- run : rustup update --no-self-update stable 195- run : rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} 196- run : rustup target add ${{ matrix.other }} 197if : matrix.os != 'ubuntu-24.04-arm' # cross-compile tests are disabled on ARM machines 198- run : rustup target add wasm32-unknown-unknown 199- run : rustup target add aarch64-unknown-none # need this for build-std mock tests 200if : startsWith(matrix.rust, 'nightly') 201- run : rustup component add rustc-dev llvm-tools-preview rust-docs 202if : startsWith(matrix.rust, 'nightly') 203- run : sudo apt update -y && sudo apt install lldb gcc-multilib libsecret-1-0 libsecret-1-dev -y 204if : matrix.os == 'ubuntu-latest' 205- run : rustup component add rustfmt || echo "rustfmt not available" 206- name : Add Windows debuggers bin to PATH 207shell : pwsh 208run : Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64" 209if : matrix.os == 'windows-latest' 210- name : Add Windows debuggers bin to PATH 211shell : pwsh 212run : Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64" 213if : matrix.os == 'windows-11-arm' 214- name : Configure extra test environment 215run : echo CARGO_CONTAINER_TESTS=1 >> $GITHUB_ENV 216if : matrix.os == 'ubuntu-latest' 217- run : cargo test -p cargo 218- name : Clear intermediate test output 219run : ci/clean-test-output.sh 220 221- name : gitoxide tests (all git-related tests) 222run : cargo test -p cargo git 223env : 224__CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2 : 1 225# The testsuite generates a huge amount of data, and fetch-smoke-test was 226# running out of disk space. 227- name : Clear test output 228run : ci/clean-test-output.sh 229 230# This only tests `cargo fix` because fix-proxy-mode is one of the most 231# complicated subprocess management in Cargo. 232- name : Check operability of rustc invocation with argfile 233run : 'cargo test -p cargo --test testsuite -- fix::' 234env : 235__CARGO_TEST_FORCE_ARGFILE : 1 236- run : cargo test --workspace --exclude cargo --exclude benchsuite --exclude resolver-tests 237- name : Check benchmarks 238run : | 239# This only tests one benchmark since it can take over 10 minutes to 240# download all workspaces. 241cargo test -p benchsuite --all-targets -- cargo 242cargo check -p capture 243# The testsuite generates a huge amount of data, and fetch-smoke-test was 244# running out of disk space. 245- name : Clear benchmark output 246run : ci/clean-test-output.sh 247 248- name : Fetch smoke test 249run : ci/fetch-smoke-test.sh 250 251schema : 252runs-on : ubuntu-latest 253steps : 254- uses : actions/checkout@v5 255- run : rustup update stable && rustup default stable 256- run : cargo test -p cargo-util-schemas -F unstable-schema 257 258resolver : 259runs-on : ubuntu-latest 260steps : 261- uses : actions/checkout@v5 262- run : rustup update stable && rustup default stable 263- run : cargo test -p resolver-tests 264 265test_gitoxide : 266runs-on : ubuntu-latest 267steps : 268- uses : actions/checkout@v5 269- run : rustup update --no-self-update stable && rustup default stable 270- run : rustup target add i686-unknown-linux-gnu 271- run : rustup target add wasm32-unknown-unknown 272- run : sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y 273- run : rustup component add rustfmt || echo "rustfmt not available" 274- run : cargo test -p cargo 275env : 276__CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2 : 1 277 278build_std : 279runs-on : ubuntu-latest 280steps : 281- uses : actions/checkout@v5 282- run : rustup update nightly && rustup default nightly 283- run : rustup component add rust-src 284- run : cargo build 285- run : cargo test -p cargo --test build-std 286env : 287CARGO_RUN_BUILD_STD_TESTS : 1 288docs : 289runs-on : ubuntu-latest 290steps : 291- uses : actions/checkout@v5 292- run : rustup update nightly && rustup default nightly 293- run : rustup update stable 294- run : rustup component add rust-docs 295- run : rustup component add rustfmt --toolchain stable 296- run : ci/validate-man.sh 297# This requires rustfmt, use stable. 298- name : Run semver-check 299run : cargo +stable run -p semver-check 300- name : Ensure intradoc links are valid 301run : cargo doc --workspace --document-private-items --no-deps 302env : 303RUSTDOCFLAGS : -D warnings 304- name : Install mdbook 305run : | 306mkdir mdbook 307curl -Lf https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook 308echo `pwd`/mdbook >> $GITHUB_PATH 309- run : cd src/doc && mdbook build --dest-dir ../../target/doc 310- name : Run linkchecker.sh 311run : | 312cd target 313curl -sSLO https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh 314sh linkcheck.sh --all --path ../src/doc cargo 315 316msrv : 317runs-on : ubuntu-latest 318steps : 319- uses : actions/checkout@v5 320- uses : taiki-e/install-action@cargo-hack 321- run : cargo hack check --all-targets --rust-version --workspace --ignore-private --locked 322 323spellcheck : 324name : Spell Check with Typos 325runs-on : ubuntu-latest 326steps : 327- name : Checkout Actions Repository 328uses : actions/checkout@v5 329- name : Spell Check Repo 330uses : crate-ci/typos@v1.40.0 331 332report-timings : 333name : Timing HTML report 334runs-on : ubuntu-latest 335steps : 336- uses : actions/checkout@v5 337- run : rustup update nightly && rustup default nightly 338- run : cargo build 339- name : Generate timing report for rustfix 340run : | 341cargo run -- build -p rustfix -Zbuild-analysis -Zsection-timings --config build.analysis.enabled=true --config 'build.build-dir="tmp"' 342cargo run -- report timings -Zbuild-analysis 343- uses : actions/upload-artifact@v6 344with : 345name : timing-report 346path : target/cargo-timings/*.html 347if-no-files-found : error