-
Notifications
You must be signed in to change notification settings - Fork 24
Action to bump LLVM SHA weekly #560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Hardcode84
wants to merge
7
commits into
iree-org:main
Choose a base branch
from
Hardcode84:action-update-llvm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| # Copyright 2025 The IREE Authors | ||
| # | ||
| # Licensed under the Apache License v2.0 with LLVM Exceptions. | ||
| # See https://llvm.org/LICENSE.txt for license information. | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| name: Update LLVM SHA | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| branch-name: | ||
| default: "integrates/llvm" | ||
| type: string | ||
| description: The branch name to put updates on | ||
| schedule: | ||
| # Weekly on Monday at 09:00 AM UTC | ||
| - cron: "0 9 * * 1" | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| env: | ||
| GIT_BRANCH_NAME: ${{ inputs.branch-name || 'integrates/llvm' }} | ||
| LLVM_REPO: https://github.com/llvm/llvm-project.git | ||
| LLVM_SHA_FILE: water/llvm-sha.txt | ||
|
|
||
| jobs: | ||
| check-for-existing-branch: | ||
| if: ${{ github.repository_owner == 'iree-org' || github.event_name != 'schedule' }} | ||
| runs-on: ubuntu-22.04 | ||
| outputs: | ||
| branch-exists: ${{ steps.check-exists.outputs.branch-exists }} | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | ||
| - name: Check for existing integrate branch | ||
| id: check-exists | ||
| run: | | ||
| BRANCH_EXISTS=$(git ls-remote --exit-code --heads origin ${{ env.GIT_BRANCH_NAME }} | wc -l) | ||
| echo branch-exists=${BRANCH_EXISTS} >> "${GITHUB_OUTPUT}" | ||
| if [[ ${BRANCH_EXISTS} == 1 ]]; then | ||
| echo "Skipping update PR creation since the \`${{ env.GIT_BRANCH_NAME }}\` branch already exists." >> ${GITHUB_STEP_SUMMARY} | ||
Hardcode84 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| fi | ||
|
|
||
| update-llvm: | ||
| needs: check-for-existing-branch | ||
| runs-on: ubuntu-22.04 | ||
| if: ${{ needs.check-for-existing-branch.outputs.branch-exists == 0 }} | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | ||
|
|
||
| - name: Get current LLVM SHA | ||
| id: current-sha | ||
| run: | | ||
| CURRENT_SHA=$(cat ${{ env.LLVM_SHA_FILE }} | tr -d '[:space:]') | ||
| echo "current=${CURRENT_SHA}" >> "${GITHUB_OUTPUT}" | ||
| echo "Current LLVM SHA: ${CURRENT_SHA}" >> ${GITHUB_STEP_SUMMARY} | ||
|
|
||
| - name: Get latest LLVM SHA | ||
| id: latest-sha | ||
| run: | | ||
| LATEST_SHA=$(git ls-remote ${{ env.LLVM_REPO }} HEAD | awk '{print $1}') | ||
| echo "latest=${LATEST_SHA}" >> "${GITHUB_OUTPUT}" | ||
| echo "Latest LLVM SHA: ${LATEST_SHA}" >> ${GITHUB_STEP_SUMMARY} | ||
|
|
||
| - name: Update LLVM SHA file | ||
| if: ${{ steps.current-sha.outputs.current != steps.latest-sha.outputs.latest }} | ||
| run: | | ||
| echo "${{ steps.latest-sha.outputs.latest }}" > ${{ env.LLVM_SHA_FILE }} | ||
| echo "Updated ${{ env.LLVM_SHA_FILE }} to ${{ steps.latest-sha.outputs.latest }}" >> ${GITHUB_STEP_SUMMARY} | ||
|
|
||
| - uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0 | ||
| if: ${{ steps.current-sha.outputs.current != steps.latest-sha.outputs.latest && env.CREATE_PULL_REQUEST_TOKEN_APP_ID != '' && env.CREATE_PULL_REQUEST_TOKEN_APP_PRIVATE_KEY != '' }} | ||
| id: generate-token | ||
| with: | ||
| app-id: ${{ secrets.CREATE_PULL_REQUEST_TOKEN_APP_ID }} | ||
| private-key: ${{ secrets.CREATE_PULL_REQUEST_TOKEN_APP_PRIVATE_KEY }} | ||
| env: | ||
| CREATE_PULL_REQUEST_TOKEN_APP_ID: ${{ secrets.CREATE_PULL_REQUEST_TOKEN_APP_ID }} | ||
| CREATE_PULL_REQUEST_TOKEN_APP_PRIVATE_KEY: ${{ secrets.CREATE_PULL_REQUEST_TOKEN_APP_PRIVATE_KEY }} | ||
|
|
||
| - name: Create or update pull request | ||
| if: ${{ steps.current-sha.outputs.current != steps.latest-sha.outputs.latest }} | ||
| id: cpr | ||
| uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412 # v7.0.9 | ||
| with: | ||
| token: ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }} | ||
| base: main | ||
| branch: ${{ env.GIT_BRANCH_NAME }} | ||
| author: iree-pr-automator[bot] <[email protected]> | ||
| signoff: true | ||
| title: "Bump LLVM to latest upstream commit" | ||
| body: | | ||
| This PR updates the LLVM commit SHA in `${{ env.LLVM_SHA_FILE }}` to the latest upstream commit. | ||
|
|
||
| **Current SHA:** `${{ steps.current-sha.outputs.current }}` | ||
| **Latest SHA:** `${{ steps.latest-sha.outputs.latest }}` | ||
|
|
||
| Commit diff: https://github.com/llvm/llvm-project/compare/${{ steps.current-sha.outputs.current }}...${{ steps.latest-sha.outputs.latest }} | ||
|
|
||
| Auto-generated by GitHub Actions using [`.github/workflows/update_llvm_sha.yml`](https://github.com/${{ github.repository }}/blob/main/.github/workflows/update_llvm_sha.yml). | ||
| commit-message: "Bump LLVM to ${{ steps.latest-sha.outputs.latest }}" | ||
|
|
||
| - name: Write summary | ||
| if: ${{ steps.cpr.outputs.pull-request-number }} | ||
| run: | | ||
| echo "Pull Request URL: ${{ steps.cpr.outputs.pull-request-url }}" >> ${GITHUB_STEP_SUMMARY} | ||
|
|
||
| - name: No update needed | ||
| if: ${{ steps.current-sha.outputs.current == steps.latest-sha.outputs.latest }} | ||
| run: | | ||
| echo "No update needed. LLVM is already at the latest commit: ${{ steps.current-sha.outputs.current }}" >> ${GITHUB_STEP_SUMMARY} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use 24 here for longer term support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess? It was copypasted from exisitng update iree script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please link to the script somewhere (e.g. in the PR description)
We've had a few iterations of automated updates. I want to check which you forked and if there were known issues with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/iree-org/wave/blob/main/.github/workflows/update_iree_requirement_pins.yml