Skip to content

build: pin cuda requirements to latest supported versions #20

build: pin cuda requirements to latest supported versions

build: pin cuda requirements to latest supported versions #20

Workflow file for this run

name: pre-commit
on:
pull_request:
push:
branches:
- main
jobs:
pre-commit:
name: pre-commit
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
clean: false
ref: ${{ github.head_ref }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
cache: 'pip'
# N.B. we don't need all the dependencies to run the code for just pre-commit
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Cache pre-commit envs
uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/requirements-dev.txt') }}-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-${{ hashFiles('**/requirements-dev.txt') }}-
${{ runner.os }}-pre-commit-
- name: Run pre-commit
env:
REF_BEFORE: ${{ github.event_name == 'pull_request' && github.base_ref || github.event.before }}
REF_AFTER: ${{ github.event_name == 'pull_request' && github.head_ref || github.event.after }}
run: |
# make sure dropped commits are fetched
git fetch origin $REF_BEFORE:$REF_BEFORE
# if it's a push, check since the common ancestor of the before/after (for forced pushes)
if [[ "${{ github.event_name }}" == "push" ]]; then
export REF_BEFORE=$(git merge-base $REF_BEFORE $REF_AFTER)
fi
# make sure gitlint knows which commits to lint
export GITLINT_COMMITS=$REF_BEFORE..$REF_AFTER
# run pre-commit
pre-commit run --from-ref $REF_BEFORE --to-ref $REF_AFTER