Skip to content

Commit fdf25e6

Browse files
author
Frankie Robertson
committed
Add CI
1 parent f092e59 commit fdf25e6

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/pytest.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Run tests
2+
3+
on: [push, workflow_dispatch]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 10
9+
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
14+
- name: Setup Python
15+
id: setup_py
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.10'
19+
20+
- name: Install Poetry
21+
uses: snok/install-poetry@v1
22+
with:
23+
virtualenvs-in-project: true
24+
25+
- name: Generate requirements.txt
26+
run: |
27+
poetry export --extras demos --with=dev --without-hashes -o requirements.txt &&
28+
sed -i '/^torch$/d' requirements.txt
29+
- name: Load cached venv
30+
id: cached-poetry-dependencies
31+
uses: actions/cache@v3
32+
with:
33+
path: ~/.local
34+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}
35+
36+
- name: Install dependencies
37+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
38+
run: |
39+
pip install --user -r requirements.txt &&
40+
pip install --user --extra-index-url https://download.pytorch.org/whl/nightly/cpu --pre torch &&
41+
pip install --user --no-deps -e .
42+
43+
- name: Run test suite
44+
run: |
45+
~/.local/bin/pytest tests
46+
47+
- name: Run mypy
48+
run: |
49+
~/.local/bin/mypy

0 commit comments

Comments
 (0)