Skip to content

Commit

Permalink
Add simple ci script to bump torch-mlir submodule (iree-org#17236)
Browse files Browse the repository at this point in the history
skip-ci: new workflow file not affecting existing jobs

---------

Co-authored-by: Scott Todd <[email protected]>
Signed-off-by: Lubo Litchev <[email protected]>
  • Loading branch information
2 people authored and LLITCHEV committed Jul 30, 2024
1 parent 33309a9 commit 2d47377
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/bump_torch_mlir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Copyright 2024 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

# Automatically bumps the torch-mlir submodule to match shark-infra/torch-mlir:main.
# Manually triggered for now, but can be scheduled in the future.
# This typically takes ~90s to run.
# Will succeed without creating a PR if there is no newer version for torch-mlir.
name: Bump submodule - torch-mlir

on:
# TODO: Uncomment the following lines to enable the schedule when this action is stable & useful enough
# schedule:
# - cron: '0 0 * * 0,4' # Run at 00:00 on Sunday and Thursday
workflow_dispatch:
inputs:
bump_target:
description: 'Commit hash or branch to bump the submodule to'
required: false
default: 'origin/main'
pull_request:
branches:
- main
paths:
- .github/workflows/bump_torch_mlir.yml

jobs:
bump_submodule:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
submodules: false

- name: Setting git config
run: |
git config --local user.email "[email protected]"
git config --local user.name "Submodule Bump Action"
- name: Update torch-mlir submodule
run: |
git submodule update --init --depth 1 third_party/torch-mlir
- name: Bump torch-mlir submodule
id: bump_submodule
run: |
cd third_party/torch-mlir
git fetch origin
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
git checkout ${{ github.event.inputs.bump_target }}
else
git checkout origin/main
fi
TORCH_MLIR_COMMIT=$(git rev-parse HEAD)
cd ../..
git add third_party/torch-mlir
git commit -m "Bump torch-mlir submodule to $TORCH_MLIR_COMMIT"
echo "TORCH_MLIR_COMMIT=$TORCH_MLIR_COMMIT" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: main
branch: bump-torch-mlir-submodule
delete-branch: true # automatically supercedes the previous bump
title: 'Bump torch-mlir submodule to ${{ steps.bump_submodule.outputs.TORCH_MLIR_COMMIT }}'
body: |
This PR updates the torch-mlir submodule to https://github.com/llvm/torch-mlir/commit/${{ steps.bump_submodule.outputs.TORCH_MLIR_COMMIT }}.
Auto-generated by GitHub Actions using `.github/workflows/bump_torch_mlir.yml`.
commit-message: 'Bump torch-mlir submodule to ${{ steps.bump_submodule.outputs.TORCH_MLIR_COMMIT }}'

0 comments on commit 2d47377

Please sign in to comment.