From 10ee2acdd26a7f1298c6f6d6b7af9b469fe29b87 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 14:41:41 +0200 Subject: Merging upstream version 1.70.0+dfsg2. Signed-off-by: Daniel Baumann --- .../cargo/.github/ISSUE_TEMPLATE/bug_report.yml | 43 ++++ src/tools/cargo/.github/ISSUE_TEMPLATE/config.yml | 10 + .../.github/ISSUE_TEMPLATE/feature_request.yml | 35 ++++ .../.github/ISSUE_TEMPLATE/tracking_issue.yml | 50 +++++ src/tools/cargo/.github/PULL_REQUEST_TEMPLATE.md | 43 ++++ src/tools/cargo/.github/workflows/audit.yml | 30 +++ src/tools/cargo/.github/workflows/contrib.yml | 38 ++++ src/tools/cargo/.github/workflows/main.yml | 222 +++++++++++++++++++++ 8 files changed, 471 insertions(+) create mode 100644 src/tools/cargo/.github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 src/tools/cargo/.github/ISSUE_TEMPLATE/config.yml create mode 100644 src/tools/cargo/.github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 src/tools/cargo/.github/ISSUE_TEMPLATE/tracking_issue.yml create mode 100644 src/tools/cargo/.github/PULL_REQUEST_TEMPLATE.md create mode 100644 src/tools/cargo/.github/workflows/audit.yml create mode 100644 src/tools/cargo/.github/workflows/contrib.yml create mode 100644 src/tools/cargo/.github/workflows/main.yml (limited to 'src/tools/cargo/.github') diff --git a/src/tools/cargo/.github/ISSUE_TEMPLATE/bug_report.yml b/src/tools/cargo/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 000000000..f465e1240 --- /dev/null +++ b/src/tools/cargo/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,43 @@ +name: Bug Report +description: Create a report to help us improve +labels: ["C-bug"] +body: + - type: markdown + attributes: + value: Thanks for filing a 🐛 bug report 😄! + - type: textarea + id: problem + attributes: + label: Problem + description: > + Please provide a clear and concise description of what the bug is, + including what currently happens and what you expected to happen. + validations: + required: true + - type: textarea + id: steps + attributes: + label: Steps + description: Please list the steps to reproduce the bug. + placeholder: | + 1. + 2. + 3. + - type: textarea + id: possible-solutions + attributes: + label: Possible Solution(s) + description: > + Not obligatory, but suggest a fix/reason for the bug, + or ideas how to implement the addition or change. + - type: textarea + id: notes + attributes: + label: Notes + description: Provide any additional notes that might be helpful. + - type: textarea + id: version + attributes: + label: Version + description: Please paste the output of running `cargo version --verbose`. + render: text diff --git a/src/tools/cargo/.github/ISSUE_TEMPLATE/config.yml b/src/tools/cargo/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..ed4289847 --- /dev/null +++ b/src/tools/cargo/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,10 @@ +contact_links: + - name: Question + url: https://users.rust-lang.org + about: > + Got a question about Cargo? Ask the community on the user forum. + - name: Inspiring Idea + url: https://internals.rust-lang.org/c/tools-and-infrastructure/cargo + about: > + Need more discussions with your next big idea? + Reach out the coummunity on the internals forum. diff --git a/src/tools/cargo/.github/ISSUE_TEMPLATE/feature_request.yml b/src/tools/cargo/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 000000000..bae2469d1 --- /dev/null +++ b/src/tools/cargo/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,35 @@ +name: Feature Request +description: Suggest an idea for enhancing Cargo +labels: ["C-feature-request"] +body: + - type: markdown + attributes: + value: | + Thanks for filing a 🙋 feature request 😄! + + If the feature request is relatively small and already with a possible solution, this might be the place for you. + + If you are brewing a big feature that needs feedback from the community, [the internal forum] is the best fit, especially for pre-RFC. You can also talk the idea over with other developers in [#t-cargo Zulip stream]. + + [the internal forum]: https://internals.rust-lang.org/c/tools-and-infrastructure/cargo/15 + [#t-cargo Zulip stream]: https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo + - type: textarea + id: problem + attributes: + label: Problem + description: > + Please provide a clear description of your use case and the problem + this feature request is trying to solve. + validations: + required: true + - type: textarea + id: solution + attributes: + label: Proposed Solution + description: > + Please provide a clear and concise description of what you want to happen. + - type: textarea + id: notes + attributes: + label: Notes + description: Provide any additional context or information that might be helpful. diff --git a/src/tools/cargo/.github/ISSUE_TEMPLATE/tracking_issue.yml b/src/tools/cargo/.github/ISSUE_TEMPLATE/tracking_issue.yml new file mode 100644 index 000000000..d687db4e5 --- /dev/null +++ b/src/tools/cargo/.github/ISSUE_TEMPLATE/tracking_issue.yml @@ -0,0 +1,50 @@ +name: Tracking Issue +description: A tracking issue for an accepted feature or RFC in Cargo. +title: "Tracking Issue for _FEATURE_NAME_" +labels: ["C-tracking-issue"] +body: + - type: markdown + attributes: + value: > + Thank you for creating a tracking issue! Tracking issues are for tracking an + accepted feature or RFC from implementation to stabilization. Please do not + file a tracking issue until the feature or RFC has been approved. + - type: textarea + id: summary + attributes: + label: Summary + description: Please provide a very brief summary of the feature. + value: | + RFC: [#NNNN](https://github.com/rust-lang/rfcs/pull/NNNN) + Original issue: #NNNN + Implementation: #NNNN + Documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#my-feature + + Please enter a short, one-sentence description here. + validations: + required: true + - type: textarea + id: unresolved + attributes: + label: Unresolved Issues + description: List issues that have not yet been resolved. + placeholder: | + * [ ] Make a list of any known implementation or design issues. + - type: textarea + id: future + attributes: + label: Future Extensions + description: > + An optional section where you can mention where the feature may be + extended in the future, but is explicitly not intended to + address. + - type: textarea + id: about + attributes: + label: About tracking issues + description: Please include this notice in the issue. + value: | + Tracking issues are used to record the overall progress of implementation. + They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. + A tracking issue is however *not* meant for large scale discussion, questions, or bug reports about a feature. + Instead, open a dedicated issue for the specific matter and add the relevant feature gate label. diff --git a/src/tools/cargo/.github/PULL_REQUEST_TEMPLATE.md b/src/tools/cargo/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..141ac5ed4 --- /dev/null +++ b/src/tools/cargo/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,43 @@ + + + diff --git a/src/tools/cargo/.github/workflows/audit.yml b/src/tools/cargo/.github/workflows/audit.yml new file mode 100644 index 000000000..14e35b7b3 --- /dev/null +++ b/src/tools/cargo/.github/workflows/audit.yml @@ -0,0 +1,30 @@ +name: Security audit + +permissions: + contents: read + +on: + pull_request: + paths: + - '**/Cargo.toml' + - '**/Cargo.lock' + push: + branches: + - master + +jobs: + cargo_deny: + runs-on: ubuntu-latest + strategy: + matrix: + checks: + - advisories + - bans licenses sources + steps: + - uses: actions/checkout@v3 + - uses: EmbarkStudios/cargo-deny-action@v1 + # Prevent sudden announcement of a new advisory from failing ci: + continue-on-error: ${{ matrix.checks == 'advisories' }} + with: + command: check ${{ matrix.checks }} + rust-version: stable diff --git a/src/tools/cargo/.github/workflows/contrib.yml b/src/tools/cargo/.github/workflows/contrib.yml new file mode 100644 index 000000000..bbd4a7ef7 --- /dev/null +++ b/src/tools/cargo/.github/workflows/contrib.yml @@ -0,0 +1,38 @@ +name: Contrib Deploy +on: + push: + branches: + - master + +permissions: + contents: read + +jobs: + deploy: + permissions: + contents: write # for Git to git push + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Install mdbook + run: | + mkdir mdbook + curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.27/mdbook-v0.4.27-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + echo `pwd`/mdbook >> $GITHUB_PATH + - name: Deploy docs + run: | + cd src/doc/contrib + mdbook build + git worktree add gh-pages gh-pages + git config user.name "Deploy from CI" + git config user.email "" + cd gh-pages + # Delete the ref to avoid keeping history. + git update-ref -d refs/heads/gh-pages + rm -rf contrib + mv ../book contrib + git add contrib + git commit -m "Deploy $GITHUB_SHA to gh-pages" + git push --force diff --git a/src/tools/cargo/.github/workflows/main.yml b/src/tools/cargo/.github/workflows/main.yml new file mode 100644 index 000000000..400e725e5 --- /dev/null +++ b/src/tools/cargo/.github/workflows/main.yml @@ -0,0 +1,222 @@ +name: CI +on: + push: + branches-ignore: [master] + pull_request: + branches: ['*'] + +defaults: + run: + shell: bash + +permissions: + contents: read + +env: + CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse + +jobs: + # Check Code style quickly by running `rustfmt` over all code + rustfmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: rustup update stable && rustup default stable + - run: rustup component add rustfmt + - run: cargo fmt --all --check + - run: | + for manifest in `find crates benches/benchsuite benches/capture -name Cargo.toml` + do + echo check fmt for $manifest + cargo fmt --all --manifest-path $manifest --check + done + + # Ensure there are no clippy warnings + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: rustup update stable && rustup default stable + - run: rustup component add clippy + # Only check cargo lib for now + - run: cargo clippy -p cargo --lib -- -D warnings + + test: + runs-on: ${{ matrix.os }} + env: + CARGO_PROFILE_DEV_DEBUG: 1 + CARGO_PROFILE_TEST_DEBUG: 1 + CARGO_INCREMENTAL: 0 + CARGO_PUBLIC_NETWORK_TESTS: 1 + # Deny warnings on CI to avoid warnings getting into the codebase. + RUSTFLAGS: -D warnings + strategy: + 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 }} + steps: + - uses: actions/checkout@v3 + - name: Dump Environment + run: ci/dump-environment.sh + - name: Update Rustup (temporary workaround) + run: rustup self update + shell: bash + if: startsWith(matrix.os, 'windows') + - run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} + - run: rustup target add ${{ matrix.other }} + - run: rustup component add rustc-dev llvm-tools-preview rust-docs + if: startsWith(matrix.rust, 'nightly') + - run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y + if: matrix.os == 'ubuntu-latest' + - run: rustup component add rustfmt || echo "rustfmt not available" + - name: Configure extra test environment + run: echo CARGO_CONTAINER_TESTS=1 >> $GITHUB_ENV + if: matrix.os == 'ubuntu-latest' + + - run: cargo test + - name: Clear intermediate test output + run: ci/clean-test-output.sh + - name: gitoxide tests (all git-related tests) + run: cargo test git + env: + __CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2: 1 + # The testsuite generates a huge amount of data, and fetch-smoke-test was + # running out of disk space. + - name: Clear test output + run: ci/clean-test-output.sh + - name: Check operability of rustc invocation with argfile + env: + __CARGO_TEST_FORCE_ARGFILE: 1 + run: | + # This only tests `cargo fix` because fix-proxy-mode is one of the most + # complicated subprocess management in Cargo. + cargo test --test testsuite -- fix:: + - run: cargo test --manifest-path crates/cargo-test-support/Cargo.toml + env: + CARGO_TARGET_DIR: target + - run: cargo test -p cargo-platform + - run: cargo test -p cargo-util + - run: cargo test --manifest-path crates/home/Cargo.toml + - run: cargo test --manifest-path crates/mdman/Cargo.toml + - run: cargo build --manifest-path crates/credential/cargo-credential-1password/Cargo.toml + - run: cargo build --manifest-path crates/credential/cargo-credential-gnome-secret/Cargo.toml + if: matrix.os == 'ubuntu-latest' + - run: cargo build --manifest-path crates/credential/cargo-credential-macos-keychain/Cargo.toml + if: matrix.os == 'macos-latest' + - run: cargo build --manifest-path crates/credential/cargo-credential-wincred/Cargo.toml + if: matrix.os == 'windows-latest' + - name: Check benchmarks + env: + # Share the target dir to try to cache a few build-time deps. + CARGO_TARGET_DIR: target + run: | + # This only tests one benchmark since it can take over 10 minutes to + # download all workspaces. + cargo test --manifest-path benches/benchsuite/Cargo.toml --all-targets -- cargo + cargo check --manifest-path benches/capture/Cargo.toml + # The testsuite generates a huge amount of data, and fetch-smoke-test was + # running out of disk space. + - name: Clear benchmark output + run: ci/clean-test-output.sh + - name: Fetch smoke test + run: ci/fetch-smoke-test.sh + + resolver: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: rustup update stable && rustup default stable + - run: cargo test --manifest-path crates/resolver-tests/Cargo.toml + + test_gitoxide: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: rustup update --no-self-update stable && rustup default stable + - run: rustup target add i686-unknown-linux-gnu + - run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y + - run: rustup component add rustfmt || echo "rustfmt not available" + - run: cargo test + env: + __CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2: 1 + + build_std: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: rustup update nightly && rustup default nightly + - run: rustup component add rust-src + - run: cargo build + - run: cargo test --test build-std + env: + CARGO_RUN_BUILD_STD_TESTS: 1 + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: rustup update nightly && rustup default nightly + - run: rustup update stable + - run: rustup component add rust-docs + - run: ci/validate-man.sh + # This requires rustfmt, use stable. + - run: cd src/doc/semver-check && cargo +stable run + - run: | + mkdir mdbook + curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.27/mdbook-v0.4.27-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + echo `pwd`/mdbook >> $GITHUB_PATH + - run: cargo doc --document-private-items --no-deps + env: + RUSTDOCFLAGS: -D warnings + - run: cd src/doc && mdbook build --dest-dir ../../target/doc + - run: | + cd src/doc + curl -sSLo linkcheck.sh \ + https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh + sh linkcheck.sh --all cargo + + success: + permissions: + contents: none + name: bors build finished + needs: [docs, rustfmt, test, resolver, build_std, test_gitoxide] + runs-on: ubuntu-latest + if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto-cargo'" + steps: + - run: echo ok + failure: + permissions: + contents: none + name: bors build finished + needs: [docs, rustfmt, test, resolver, build_std] + runs-on: ubuntu-latest + if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto-cargo'" + steps: + - run: exit 1 -- cgit v1.2.3