-
Notifications
You must be signed in to change notification settings - Fork 3
80 lines (67 loc) · 2.65 KB
/
lint.yml
File metadata and controls
80 lines (67 loc) · 2.65 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
name: Lint
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', 'setup.py', 'pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y g++ python3-dev libomp-dev build-essential
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install numpy pandas
python -m pip install black isort flake8 mypy typing-extensions
python -m pip install build
- name: Set up compiler environment
run: |
python_include=$(python3 -c 'import sysconfig; print(sysconfig.get_path("include"))')
numpy_include=$(python3 -c 'import numpy; print(numpy.get_include())')
echo "CFLAGS=-I${python_include} -I${numpy_include}" >> $GITHUB_ENV
echo "CXXFLAGS=-I${python_include} -I${numpy_include} -fopenmp -std=c++11 -O3 -Wall -fPIC" >> $GITHUB_ENV
echo "LDFLAGS=-fopenmp" >> $GITHUB_ENV
echo "NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION" >> $GITHUB_ENV
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
- name: Create directories
run: |
mkdir -p pattern_causality/utils
mkdir -p pattern_causality/cpp
mkdir -p utils
touch pattern_causality/__init__.py
touch pattern_causality/utils/__init__.py
touch pattern_causality/cpp/__init__.py
touch utils/__init__.py
- name: Build package
run: |
python -m pip install -v -e .
- name: Format with Black
run: |
black . --check --diff
continue-on-error: true
- name: Check imports with isort
run: |
isort . --check-only --diff
continue-on-error: true
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --statistics
continue-on-error: true
- name: Type check with mypy
run: |
mypy pattern_causality --ignore-missing-imports
continue-on-error: true