forked from cloud-custodian/cloud-custodian
-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (155 loc) · 4.43 KB
/
ci-master.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: "CI"
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Linter
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Lint Check
run: |
make lint
Tests:
runs-on: "${{ matrix.os }}"
needs: Lint
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
exclude:
# conserve some osx builders
- python-version: 3.6
os: macos-latest
# conserve some osx builders
- python-version: 3.9
os: macos-latest
include:
- python-version: 3.6
os: ubuntu-latest
tox-target: py36
- python-version: 3.7
os: ubuntu-latest
tox-target: py37
- python-version: 3.8
os: ubuntu-latest
tox-target: py38-cov
- python-version: 3.9
os: ubuntu-latest
tox-target: py39
- python-version: 3.7
tox-target: py37
os: macos-latest
- python-version: 3.8
tox-target: py38
os: macos-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up cache
uses: actions/cache@v1
with:
path: .tox/${{ matrix.tox-target }}
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/requirement*.txt') }}
- name: Install Test Runner
run: |
python -m pip install --upgrade pip
pip install tox
- name: Install Deps
run: |
tox -e ${{ matrix.tox-target }} --notest
- name: Test
run: |
tox -vv -e ${{ matrix.tox-target }}
- name: Coverage Generate XML
if: contains(matrix.tox-target, 'py38-cov')
run: |
./.tox/${{ matrix.tox-target }}/bin/coverage xml && \
bash <(curl -s https://codecov.io/bash) -Z \
-v -f coverage.xml
- name: License Check
if: contains(matrix.tox-target, 'py39')
run: |
./.tox/${{ matrix.tox-target }}/bin/python tools/dev/license-check.py
Test-Windows:
# windows can't use the fast cache technique we use in our matrix builds
# where we cache the entire tox virtualenv directory, without error.
# instead we just cache the pip downloads, and install every time.
runs-on: windows-latest
needs: Lint
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Set up cache
uses: actions/cache@v1
with:
path: ~\AppData\Local\pip\Cache
key: pip-${{ 3.8 }}-${{ hashFiles('**/requirement*.txt') }}
- name: Install Test Runner
run: |
python -m pip install pip
pip install tox codecov
- name: Install Deps
run: |
tox -e py37 --notest
- name: Test
run: |
tox -e py37
Analyzer:
runs-on: ubuntu-latest
needs: Lint
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Run Bandit
run: |
python -m pip install bandit
make analyzer-bandit
- name: Run Semgrep
run: |
python -m pip install semgrep
make analyzer-semgrep
Docs:
# todo, figure out how to fast cache the tox directory here.
runs-on: ubuntu-latest
needs: Lint
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Set up cache
uses: actions/cache@v1
with:
path: "~/.cache/pip"
key: docs-${{ runner.os }}-${{ 3.8 }}-${{ hashFiles('**/requirement*.txt') }}
- name: Install Tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Install Build Deps
run: |
TOXENV=docs tox --notest
- name: Build Docs
run: |
TOXENV=docs tox