-
Notifications
You must be signed in to change notification settings - Fork 273
53 lines (50 loc) · 1.62 KB
/
update-requirements.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
# This GitHub Actions workflow automatically updates the pinned versions
# in requirements.txt for all Python dependencies (including transitive dependencies)
# whenever setup.cfg is modified.
name: Resolve Python Dependencies
on:
push:
branches:
- "main"
paths:
- "setup.cfg"
# Delete this before merging
pull_request:
paths:
- "setup.cfg"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8"]
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Load pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('requirements.txt') }}-${{ matrix.python-version }}
restore-keys: |
pip-
- name: Upgrade pip
run: pip install --upgrade pip
- name: Install dependencies
run: pip install -e .[all]
- name: Write dependencies to requirements.txt
# sed is used to loosen the version matches for PyTorch and JAX libraries
# so that any CUDA version matches
run: pip freeze | sed '/^torch\|^jax/s/==/~=/' > requirements.txt
- name: Create pull request
uses: peter-evans/create-pull-request@v5
with:
commit-message: Update requirements.txt
title: "Update requirements.txt"
branch: actions/update-requirements
delete-branch: true
body: Auto-generated from GitHub Actions.