-
-
Notifications
You must be signed in to change notification settings - Fork 9
52 lines (44 loc) · 1.65 KB
/
py-dead-code.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
---
name: "Python Find Dead Code"
on: [pull_request]
jobs:
lint:
name: "Find Dead Code"
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v3
- run: |
echo "package=$(ls -F | grep \/$ | grep -v "bin\|examples\|tests" | sed -n "s/\///g;1p")" >> $GITHUB_ENV
- name: "Set up Python"
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: "Cache pip"
uses: actions/cache@v3
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
if [ -f requirements-test.txt ]; then
bin/install_requirements requirements-test.txt "${{ secrets.ADMIN_GITHUB_TOKEN }}"
elif [ -f requirements-dev.txt ]; then
bin/install_requirements requirements-dev.txt "${{ secrets.ADMIN_GITHUB_TOKEN }}"
elif [ -f requirements.txt ]; then
bin/install_requirements requirements.txt "${{ secrets.ADMIN_GITHUB_TOKEN }}"
fi
pip install flake8-eradicate
if [ -d custom_components ]; then
echo '"""Stub."""' >custom_components/__init__.py
fi
- name: "Lint with flake8 & mypy"
run: |
flake8 ${{ env.package }} tests
mypy --warn-unreachable ${{ env.package }} tests