diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml deleted file mode 100644 index 77f94f2f12ba9..0000000000000 --- a/.github/workflows/dependencies.yml +++ /dev/null @@ -1,146 +0,0 @@ -# Automatically run `cargo update` periodically - ---- -name: Bump dependencies in Cargo.lock -on: - schedule: - # Run weekly - - cron: '0 0 * * Sun' - workflow_dispatch: - # Needed so we can run it manually -permissions: - contents: read -defaults: - run: - shell: bash -env: - # So cargo doesn't complain about unstable features - RUSTC_BOOTSTRAP: 1 - PR_TITLE: Weekly `cargo update` - PR_MESSAGE: | - Automation to keep dependencies in `Cargo.lock` current. - r? dep-bumps - - The following is the output from `cargo update`: - COMMIT_MESSAGE: "cargo update \n\n" - -jobs: - not-waiting-on-bors: - if: github.repository_owner == 'rust-lang' - name: skip if S-waiting-on-bors - runs-on: ubuntu-24.04 - steps: - - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Fetch state and labels of PR - # Or exit successfully if PR does not exist - JSON=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json labels,state || exit 0) - STATE=$(echo "$JSON" | jq -r '.state') - WAITING_ON_BORS=$(echo "$JSON" | jq '.labels[] | any(.name == "S-waiting-on-bors"; .)') - - # Exit with error if open and S-waiting-on-bors - if [[ "$STATE" == "OPEN" && "$WAITING_ON_BORS" == "true" ]]; then - exit 1 - fi - - update: - if: github.repository_owner == 'rust-lang' - name: update dependencies - needs: not-waiting-on-bors - runs-on: ubuntu-24.04 - steps: - - name: checkout the source code - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - submodules: recursive - - name: install the bootstrap toolchain - run: | - # Extract the stage0 version - TOOLCHAIN=$(awk -F= '{a[$1]=$2} END {print(a["compiler_version"] "-" a["compiler_date"])}' src/stage0) - # Install and set as default - rustup toolchain install --no-self-update --profile minimal $TOOLCHAIN - rustup default $TOOLCHAIN - - - name: cargo update - run: ./src/tools/update-lockfile.sh - - - name: upload Cargo.lock artifact for use in PR - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: Cargo-lock - path: | - Cargo.lock - library/Cargo.lock - src/tools/rustbook/Cargo.lock - retention-days: 1 - - name: upload cargo-update log artifact for use in PR - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: cargo-updates - path: cargo_update.log - retention-days: 1 - - pr: - if: github.repository_owner == 'rust-lang' - name: amend PR - needs: update - runs-on: ubuntu-24.04 - permissions: - contents: write - pull-requests: write - steps: - - name: checkout the source code - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - name: download Cargo.lock from update job - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: Cargo-lock - - name: download cargo-update log from update job - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: cargo-updates - - - name: craft PR body and commit message - run: | - echo "${COMMIT_MESSAGE}" > commit.txt - cat cargo_update.log >> commit.txt - - echo "${PR_MESSAGE}" > body.md - echo '```txt' >> body.md - cat cargo_update.log >> body.md - echo '```' >> body.md - - - name: commit - run: | - git config user.name github-actions - git config user.email github-actions@github.com - git switch --force-create cargo_update - git add ./Cargo.lock ./library/Cargo.lock ./src/tools/rustbook/Cargo.lock - git commit --no-verify --file=commit.txt - - - name: push - run: git push --no-verify --force --set-upstream origin cargo_update - - - name: edit existing open pull request - id: edit - # Don't fail job if we need to open new PR - continue-on-error: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Exit with error if PR is closed - STATE=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json state --jq '.state') - if [[ "$STATE" != "OPEN" ]]; then - exit 1 - fi - - gh pr edit cargo_update --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY - - - name: open new pull request - # Only run if there wasn't an existing PR - if: steps.edit.outcome != 'success' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh pr create --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY diff --git a/src/tools/update-lockfile.sh b/src/tools/update-lockfile.sh deleted file mode 100755 index 123481b6b681c..0000000000000 --- a/src/tools/update-lockfile.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Updates the workspaces in `.`, `library` and `src/tools/rustbook` -# Logs are written to `cargo_update.log` -# Used as part of regular dependency bumps - -set -euo pipefail - -printf "\ncompiler & tools dependencies:" > cargo_update.log -# Remove first line that always just says "Updating crates.io index" -cargo update 2>&1 | sed '/crates.io index/d' | \ - tee -a cargo_update.log -printf "\nlibrary dependencies:" >> cargo_update.log -cargo update --manifest-path library/Cargo.toml 2>&1 | sed '/crates.io index/d' | \ - tee -a cargo_update.log -printf "\nrustbook dependencies:" >> cargo_update.log -cargo update --manifest-path src/tools/rustbook/Cargo.toml 2>&1 | sed '/crates.io index/d' | \ - tee -a cargo_update.log