Skip to content

Commit

Permalink
Update pytorch release PR workflow (#1286)
Browse files Browse the repository at this point in the history
* Update pytorch-latest-release.yml

* Update latest-pytorch-support.yml

* Delete .github/workflows/pytorch-latest-main.yml

* Update checkout version

---------

Co-authored-by: Claudia Comito <[email protected]>
  • Loading branch information
mtar and ClaudiaComito authored Dec 6, 2023
1 parent 05325e2 commit 3db7af7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
name: Python ${{ matrix.py-version }} with ${{ matrix.pytorch-version }}; options ${{ matrix.install-options }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup MPI
uses: mpi4py/setup-mpi@v1
with:
Expand Down
37 changes: 15 additions & 22 deletions .github/workflows/latest-pytorch-support.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Support latest PyTorch

on:
push:
branches:
- 'support/new-pytorch-release-branch'
- 'support/new-pytorch-main-branch'
paths:
- '.github/pytorch-release-versions/*'
env:
working_branch: ${{ github.ref }}
workflow_call:
inputs:
working_branch:
required: true
type: string
base_branch:
required: true
type: string
permissions:
contents: write
issues: write
Expand All @@ -17,7 +17,7 @@ jobs:
latest-torch-support:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -29,10 +29,10 @@ jobs:
update_existing: true
search_existing: open
- name: Check out new branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: '${{ env.working_branch }}'
ref: '${{ inputs.working_branch }}'
- name: Set env variables
run: |
echo "previous_pytorch=$(grep 'torch>=' setup.py | awk -F '<' '{print $2}' | tr -d '",')" >> $GITHUB_ENV
Expand All @@ -44,22 +44,15 @@ jobs:
- name: Update setup.py
run: |
sed -i '/torch>=/ s/'"${{ env.previous_pytorch }}"'/'"${{ env.setup_pytorch }}"'/g' setup.py
- name: Define base branch
run: |
if [[ ${{ github.ref }} =~ .*main.* ]]; then
echo "base_branch=main" >> $GITHUB_ENV
elif [[ ${{ github.ref }} =~ .*release.* ]]; then
echo "base_branch=release/1.2.x" >> $GITHUB_ENV
fi
- name: Create PR from branch
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v5
with:
base: ${{ env.base_branch }}
branch: ${{ env.working_branch }}
base: ${{ inputs.base_branch }}
branch: ${{ inputs.working_branch }}
delete-branch: true
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Support latest PyTorch release
title: Support PyTorch ${{ env.new_pytorch }} on branch ${{ env.base_branch }}
title: Support PyTorch ${{ env.new_pytorch }} on branch ${{ inputs.base_branch }}
body: |
Run tests on latest PyTorch release
Issue/s resolved: #${{ steps.create-issue.outputs.number }}
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/pytorch-latest-main.yml

This file was deleted.

12 changes: 10 additions & 2 deletions .github/workflows/pytorch-latest-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ name: Get latest PyTorch version release branch
on:
workflow_dispatch:
env:
working_branch: support/new-pytorch-release-branch
base_branch: release/1.2.x
working_branch: support/new-pytorch-${{ github.ref_name }}
base_branch: ${{ github.ref_name }}
permissions:
contents: write
issues: write
pull-requests: write
jobs:
get-version:
runs-on: ubuntu-latest
Expand All @@ -32,3 +34,9 @@ jobs:
git config --global user.email '[email protected]@users.noreply.github.com'
git commit -am "New PyTorch release ${{ env.new }}"
git push --set-upstream origin ${{ env.working_branch }}
call-workflow:
needs: get-version
uses: ./.github/workflows/latest-pytorch-support.yml
with:
working_branch: support/new-pytorch-${{ github.ref_name }}
base_branch: ${{ github.ref_name }}

0 comments on commit 3db7af7

Please sign in to comment.