forked from pytorch/xla
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (51 loc) · 2.48 KB
/
openxla_pin_update_weekly.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Weekly Code Update PR
on:
workflow_dispatch: # Manual trigger
# schedule:
# - cron: '0 9 * * 1' # Each Monday 9:00AM (PDT time)
jobs:
update_and_create_pr:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
- name: Create new branch
run: git checkout -b weekly-update-${{ env.CURRENT_DATE }}
- name: Install sed
run: sudo apt-get update && sudo apt-get install -y sed
- name: Get JAX version for specified date
run: |
# Here catch jax dev version with hard-code format, where _version is defined ever changes, this will break.
# Contributors who help to update OpenXLA-pin update please check line number here if the JAX version doesn't update.
version_line=$(curl -s https://raw.githubusercontent.com/google/jax/main/jax/version.py | sed -n '24p')
JAX_VERSION=$(echo "$version_line" | grep -oP '(?<=")[0-9.]+(?=")')
if [ -z "$JAX_VERSION" ]; then
echo "No JAX release found for ${{ env.CURRENT_DATE }}. Skipping update jax version in automatically status."
exit 0
fi
echo "JAX_VERSION=$JAX_VERSION" >> $GITHUB_ENV
- name: Update date in setup.py
run: |
sed -i "s/_date =.*/_date = '${{ env.CURRENT_DATE }}'/" setup.py
sed -i "s/_jax_version =.*/_jax_version = f'${{ env.JAX_VERSION }}.dev${{ env.CURRENT_DATE }}'/" setup.py
git add setup.py
- name: Fetch HEAD commit from OpenXLA github repo
run: |
echo "HEAD_COMMIT=$(git ls-remote https://github.com/openxla/xla.git HEAD | awk '{print $1}')" >> $GITHUB_ENV
- name: Update OpenXLA commit in WORKSPACE
run: |
sed -i "s/xla_hash =.*/xla_hash = '${{ env.HEAD_COMMIT }}'/" WORKSPACE
git add WORKSPACE
git commit -m "Weekly update WORKSPACE with (${{ env.HEAD_COMMIT }})"
git push origin HEAD
- name: Create Pull Request
uses: actions/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: weekly-update-${{ env.CURRENT_DATE }}
base: main
title: "Weekly Code Update - ${{ env.CURRENT_DATE }}"
body: "This PR contains the weekly OpenXLA-pin update at commit: (HEAD commit: ${{ env.HEAD_COMMIT }}), with libtpu version at ${{ env.CURRENT_DATE }}."
labels: tpuci