-
Notifications
You must be signed in to change notification settings - Fork 24
74 lines (62 loc) · 2.16 KB
/
linting.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
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
name: Linting
on:
push:
branches:
- master
- develop
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Linting
runs-on: ubuntu-latest
env:
# Configure pip to cache dependencies and do a user install
PIP_NO_CACHE_DIR: false
PIP_USER: 1
# Hide the graphical elements from pipenv's output
PIPENV_HIDE_EMOJIS: 1
PIPENV_NOSPIN: 1
# Make sure pipenv does not try reuse an environment it's running in
PIPENV_IGNORE_VIRTUALENVS: 1
# Specify explicit paths for python dependencies and the pre-commit
# environment so we know which directories to cache
PYTHONUSERBASE: ${{ github.workspace }}/.cache/py-user-base
PRE_COMMIT_HOME: ${{ github.workspace }}/.cache/pre-commit-cache
steps:
- name: Add custom PYTHONUSERBASE to PATH
run: echo '${{ env.PYTHONUSERBASE }}/bin/' >> $GITHUB_PATH
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Python Dependency Caching
uses: actions/cache@v2
id: python_cache
with:
path: ${{ env.PYTHONUSERBASE }}
key: "python-0-${{ runner.os }}-${{ env.PYTHONUSERBASE }}-\
${{ steps.python.outputs.python-version }}-\
${{ hashFiles('./Pipfile', './Pipfile.lock') }}"
# Install deps, skipping if we hit a cache
- name: Install dependencies
if: steps.python_cache.outputs.cache-hit != 'true'
run: |
pip install pipenv
pipenv install --dev --deploy --system
- name: Pre-commit Environment Caching
uses: actions/cache@v2
with:
path: ${{ env.PRE_COMMIT_HOME }}
key: "precommit-0-${{ runner.os }}-${{ env.PRE_COMMIT_HOME }}-\
${{ steps.python.outputs.python-version }}-\
${{ hashFiles('./.pre-commit-config.yaml') }}"
- name: Run pre-commit hooks
run: export PIP_USER=0; SKIP=flake8 pre-commit run --all-files
- name: Lint Flake8
run: |
flake8 .