Automatically update requirements.txt with GitHub Actions #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: Update requirements.txt | |
on: | |
push: | |
branches: | |
- "main" | |
paths: | |
- "setup.cfg" | |
pull_request: | |
paths: | |
- "setup.cfg" | |
jobs: | |
update-requirements: | |
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 PyTorch manually | |
run: pip install --no-cache-dir --find-links https://download.pytorch.org/whl/torch_stable.html torch==1.12.1+cu113 torchvision==0.13.1+cu113 | |
- name: Install dependencies | |
run: pip install -e .[all] | |
- name: Verify dependencies | |
run: pip check | |
- 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. |