-
Notifications
You must be signed in to change notification settings - Fork 57
81 lines (77 loc) · 2.47 KB
/
python-app.yml
File metadata and controls
81 lines (77 loc) · 2.47 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python
env:
LINEAPY_DO_NOT_TRACK: true
PYTHONUSERBASE: /opt/hostedtoolcache/linea
on:
workflow_dispatch:
push:
branches:
- main
- "v[0-9]+.[0-9]+.x"
paths:
- "**.py"
- "**.ipynb"
pull_request:
paths:
- "**.py"
- "**.ipynb"
- "requirements.txt"
concurrency:
group: "${{ github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
pytest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
with:
lfs: true
# Don't check out submodules, they are not needed to run the tests by default
# submodules: "recursive"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
id: pipcache
with:
path: |
/home/runner/.cache/pip
/opt/hostedtoolcache/linea/lib/python${{ matrix.python-version }}/site-packages
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
${{ runner.os }}-pip-${{ matrix.python-version }}
${{ runner.os }}-pip
- name: Install pip dependencies
if: steps.pipcache.outputs.cache-hit != 'true'
run: |
pip install wheel && python -m pip install --user -r requirements.txt
- name: Install linea
run: |
python setup.py install && rm -rf build
- name: Test with pytest
run: |
python -m pytest -v
pre-commit:
name: ${{ matrix.id }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]
id: [black, flake8, isort, mypy]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: pre-commit/action@v2.0.3
with:
extra_args: ${{ matrix.id }} --all-files