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