-
Notifications
You must be signed in to change notification settings - Fork 2
177 lines (148 loc) · 5.45 KB
/
update_pytorch.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# name: Run updater for pytorch that will check for pytorch packages
on:
schedule:
# run the job every 30 minutes
- cron: '*/30 * * * *'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
jobs:
generate_hash_letters:
runs-on: ubuntu-latest
outputs:
string_list: ${{ steps.generate.outputs.string_list }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9' # Specify your Python version
- uses: prefix-dev/[email protected]
with:
pixi-version: "latest"
manifest-path: pyproject.toml
- name: pixi install
run: |
pixi install
- name: Generate combination of missing subdirs and letters
id: generate
run: |
# Run your script here to produce a list of missing subdirs and letters
# example: linux-64@p linux-64@d
message=$(pixi run parselmouth updater-producer --channel pytorch)
if [ "$message" = "[]" ]; then
echo "Skipping job as no new packages found"
exit 0
fi
echo $message
echo "string_list=$message" >> $GITHUB_OUTPUT
env:
R2_PREFIX_ACCOUNT_ID: ${{ secrets.R2_PREFIX_ACCOUNT_ID }}
R2_PREFIX_ACCESS_KEY_ID: ${{ secrets.R2_PREFIX_ACCESS_KEY_ID }}
R2_PREFIX_SECRET_ACCESS_KEY: ${{ secrets.R2_PREFIX_SECRET_ACCESS_KEY }}
R2_PREFIX_BUCKET: ${{ secrets.R2_PREFIX_BUCKET }}
- name: Upload requested index.json
uses: actions/upload-artifact@v4
with:
name: index
path: output_index
updater_of_records:
runs-on: ubuntu-latest
needs: generate_hash_letters
strategy:
matrix:
subdirs: ${{fromJson(needs.generate_hash_letters.outputs.string_list)}}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- uses: prefix-dev/[email protected]
with:
pixi-version: "latest"
manifest-path: pyproject.toml
- name: pixi install
run: |
pixi install
- name: Get partial index artifacts
uses: actions/download-artifact@v4
with:
name: index
path: output_index
- name: Get artifact info for subdir@letter and save into partial index
run: pixi run parselmouth updater ${{ matrix.subdirs }} --channel pytorch --upload
env:
R2_PREFIX_ACCOUNT_ID: ${{ secrets.R2_PREFIX_ACCOUNT_ID }}
R2_PREFIX_ACCESS_KEY_ID: ${{ secrets.R2_PREFIX_ACCESS_KEY_ID }}
R2_PREFIX_SECRET_ACCESS_KEY: ${{ secrets.R2_PREFIX_SECRET_ACCESS_KEY }}
R2_PREFIX_BUCKET: ${{ secrets.R2_PREFIX_BUCKET }}
- name: Upload partial index
uses: actions/upload-artifact@v4
with:
name: partial_index_${{ matrix.subdirs }}
path: output
updater_of_index:
runs-on: ubuntu-latest
needs: updater_of_records
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9' # Specify your Python version
- uses: prefix-dev/[email protected]
with:
pixi-version: "latest"
manifest-path: pyproject.toml
- name: pixi install
run: |
pixi install
- name: Get partial index artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: output
- name: Combine all partial index and save into S3 index
run: pixi run parselmouth updater-merger --upload --channel pytorch
env:
R2_PREFIX_ACCOUNT_ID: ${{ secrets.R2_PREFIX_ACCOUNT_ID }}
R2_PREFIX_ACCESS_KEY_ID: ${{ secrets.R2_PREFIX_ACCESS_KEY_ID }}
R2_PREFIX_SECRET_ACCESS_KEY: ${{ secrets.R2_PREFIX_SECRET_ACCESS_KEY }}
R2_PREFIX_BUCKET: ${{ secrets.R2_PREFIX_BUCKET }}
update_file:
runs-on: ubuntu-latest
permissions:
contents: write # To push on main branch
needs: updater_of_index
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- uses: prefix-dev/[email protected]
with:
pixi-version: "latest"
manifest-path: pyproject.toml
- name: Update compressed mapping
run: |
# for pytorch we dont need to use legacy mapping anymore
pixi run parselmouth update-mapping --channel pytorch
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
R2_PREFIX_ACCOUNT_ID: ${{ secrets.R2_PREFIX_ACCOUNT_ID }}
R2_PREFIX_ACCESS_KEY_ID: ${{ secrets.R2_PREFIX_ACCESS_KEY_ID }}
R2_PREFIX_SECRET_ACCESS_KEY: ${{ secrets.R2_PREFIX_SECRET_ACCESS_KEY }}
R2_PREFIX_BUCKET: ${{ secrets.R2_PREFIX_BUCKET }}
- name: Commit and push changes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git pull
git add files/v0/pytorch
git commit -m "Update file via GitHub Action" || true
git push