Skip to content

Commit ebbdf62

Browse files
authored
Merge pull request cloud-custodian#14 from cloud-custodian/releng/github-actions
releng - github action and pre-check
2 parents bd8bf0b + 1069e0a commit ebbdf62

56 files changed

Lines changed: 1410 additions & 279 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yaml‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: "CI"
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
Lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-python@v1
13+
with:
14+
python-version: 3.8
15+
- name: Linting
16+
run: |
17+
pip install pre-commit
18+
pre-commit run --all-files
19+
20+
Tests:
21+
needs: Lint
22+
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
python-version: [3.6, 3.7, 3.8]
26+
include:
27+
- python-version: 3.6
28+
tox-target: py36
29+
- python-version: 3.7
30+
tox-target: py37
31+
- python-version: 3.8
32+
tox-target: py38
33+
steps:
34+
- uses: actions/checkout@v2
35+
- name: Set up Python ${{ matrix.python-version }}
36+
uses: actions/setup-python@v1
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
40+
- name: Install Test Runner
41+
run: |
42+
python -m pip install --upgrade pip
43+
pip install tox
44+
45+
- name: Install Deps
46+
run: |
47+
tox -e ${{ matrix.tox-target }} --notest
48+
49+
- name: Test
50+
run: |
51+
tox -e ${{ matrix.tox-target }}
52+
53+
Coverage:
54+
needs: Tests
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v2
58+
- uses: actions/setup-python@v1
59+
with:
60+
python-version: 3.8
61+
62+
- name: Install Test Runner
63+
run: |
64+
python -m pip install --upgrade pip
65+
pip install tox
66+
67+
- name: Coverage Create and Upload XML
68+
run: |
69+
tox -e lint && \
70+
bash <(curl -s https://codecov.io/bash) -Z -v -f coverage.xml

‎.pre-commit-config.yaml‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
exclude: "\\.(json|textproto)"
2+
repos:
3+
# - repo: https://github.com/psf/black
4+
# rev: 19.10b0
5+
# hooks:
6+
# - id: black
7+
8+
# - repo: https://github.com/pre-commit/mirrors-mypy
9+
# rev: v0.790
10+
# hooks:
11+
# - id: mypy
12+
13+
# - repo: https://gitlab.com/pycqa/flake8
14+
# rev: 3.7.8
15+
# hooks:
16+
# - id: flake8
17+
18+
- repo: https://github.com/timothycrosley/isort
19+
rev: 5.6.4
20+
hooks:
21+
- id: isort
22+
additional_dependencies: [pyproject, toml]
23+
24+
- repo: https://github.com/pre-commit/pre-commit-hooks
25+
rev: v2.3.0
26+
hooks:
27+
- id: trailing-whitespace
28+
exclude: ^tests/.*/fixtures/.*
29+
- id: end-of-file-fixer
30+
exclude: ^tests/.*/fixtures/.*
31+
- id: debug-statements

‎MANIFEST.in‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ prune .vscode
55
prune .github
66
global-exclude .travis.yml .gitignore .drone.yml .dockerignore .coveragerc
77
global-exclude .codecov.yml requirements*txt tox.ini Makefile .azure-piplines.yml
8-

‎README.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,4 @@ Code of Conduct
161161
===============
162162

163163
This project adheres to the `Open Code of Conduct <https://developer.capitalone.com/resources/code-of-conduct>`_. By
164-
participating, you are expected to honor this code.
164+
participating, you are expected to honor this code.

‎benches/large_resource_set.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,16 @@
6767
import sys
6868
import textwrap
6969
import time
70-
from typing import Iterable, Union, List, Dict, Any, Optional, Counter, Callable
70+
from typing import (Any, Callable, Counter, Dict, Iterable, List, Optional,
71+
Union)
72+
7173
import yaml
7274

7375
import celpy
7476
import celpy.c7nlib
7577
import celpy.celtypes
7678
from xlate.c7n_to_cel import C7N_Rewriter
7779

78-
7980
JSON = Union[Dict[Dict, Any], List[Any], None, bool, str, int, float]
8081

8182

@@ -108,7 +109,7 @@ class TagAssetPolicy(PolicyCase):
108109
resource: ec2
109110
comment: 'Notify janitorial services about ec2 instances when instances use custodian
110111
reserved roles but don''t have Custodian''s ASSET Tag.
111-
112+
112113
'
113114
actions:
114115
- cc:

‎demo/README.rst‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ For more information see https://docs.conda.io/en/latest/index.html
2121
(Much of this can be done with PIP, also.)
2222

2323
Create and activate a Conda virtual environment, we've used the name "cel"::
24-
24+
2525
conda create -n cel python=3.8
2626
conda activate cel
2727

2828
Install Jupyter Lab::
2929

3030
conda install jupyterlab
31-
32-
31+
32+
3333
Start a lab server::
3434

3535
PYTHONPATH=$(pwd)/src jupyter lab
@@ -50,4 +50,4 @@ and examine the notebooks. We'll look at this from a Cloud Custodian (C7N) persp
5050
- `demo/complex_policy.ipynb`_ shows a complex policy and how we can build -- and debug -- the policy
5151
filter expression.
5252

53-
These should help youo build an understanding of
53+
These should help youo build an understanding of

‎demo/celdemo.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,16 @@
3333
"""
3434

3535
import argparse
36-
import celpy
3736
import datetime
3837
import json
3938
import logging
40-
from pathlib import Path
4139
import sys
42-
from typing import List, Iterable, Any, Dict
40+
from pathlib import Path
41+
from typing import Any, Dict, Iterable, List
42+
4343
import yaml
4444

45+
import celpy
4546

4647
logger = logging.getLogger("celdemo")
4748

0 commit comments

Comments
 (0)