Automatically update requirements.txt with GitHub Actions #1
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: 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. |