-
Notifications
You must be signed in to change notification settings - Fork 50
96 lines (95 loc) · 3.24 KB
/
tests_and_lint.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Tests and lint
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- "*"
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
# Use a matrix for the python version here to make the rest of the lint job setup
# as similar as possible to the test job below.
python-version: [3.8]
lint-flags:
- "--run-only-fast-linters"
- "--run-only-pylint"
- "--run-only-mypy"
- "--run-only-bandit"
- "--run-only-sphinx-build"
- "--run-only-typing-copilot-tighten"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install core dependencies
run: |
./scripts/install_ubuntu_ci_core_dependencies.sh
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache the Python dependencies
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: Install Python dependencies
run: |
pipenv install --dev --deploy --system
pip install -e .
- name: Run lint checks
if: matrix.lint-flags != '--run-only-typing-copilot-tighten'
run: |
pipenv run ./scripts/lint.sh ${{ matrix.lint-flags }}
- name: Run typing_copilot to ensure tightest possible mypy config
if: matrix.lint-flags == '--run-only-typing-copilot-tighten'
run: |
pipenv run typing_copilot tighten --error-if-can-tighten
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
markers: ["not slow", "slow"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install core dependencies
run: |
./scripts/install_ubuntu_ci_core_dependencies.sh
- name: Start database docker containers
if: matrix.markers != 'not slow' # don't bring up db containers for non-slow tests
run: |
docker-compose up -d
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache the Python dependencies
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: Install Python dependencies
run: |
pipenv install --dev --deploy --system
pip install -e .
- name: Test with pytest
run: |
pytest --cov=graphql_compiler graphql_compiler/tests -m '${{ matrix.markers }}'
codecov