-
Notifications
You must be signed in to change notification settings - Fork 7
48 lines (41 loc) · 1.4 KB
/
precommit_and_docs_build_check.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
name: Pre-commit and docs build check
on:
pull_request:
workflow_dispatch:
jobs:
pre-commit-and-docs:
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: create venv and install dependencies
run: |
rm -r /tmp/kazu-env || true
PIP_CACHE_DIR=$(pip cache dir)
echo "pip cache dir is "${PIP_CACHE_DIR}
python -m venv /tmp/kazu-env
. /tmp/kazu-env/bin/activate
python -m pip install --upgrade pip
pip install --upgrade --upgrade-strategy eager --index-url https://download.pytorch.org/whl/cpu "torch>=2.0.0"
pip install -e ."[dev]" --cache-dir $PIP_CACHE_DIR --upgrade --upgrade-strategy eager
- name: Check precommit
run: |
. /tmp/kazu-env/bin/activate
pre-commit run --all-files
- name: Check docs build successfully
# still run even if the pre-commit fails, so we
# have the output on if the docs build succeeded or not
if: "!cancelled()"
run: |
. /tmp/kazu-env/bin/activate
make -C docs html
# need to call twice, for NFS bug
rm -r /tmp/kazu-env || true
rm -r /tmp/kazu-env || true