-
Notifications
You must be signed in to change notification settings - Fork 15
71 lines (60 loc) · 2.62 KB
/
pull_request.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
name: corsair_scan Pull Request handler
on: pull_request
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.8]
steps:
- name: Checkout Code
uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install PIP Dependencies
run: pip install -r requirements_dev.txt
- name: Test with Pytest
run: python -m pytest --cov=corsair_scan --cov-report=html:coverage/${{ matrix.python-version }} --cov-fail-under=85 -o junit_family=xunit2 --junitxml=${{ matrix.python-version }}.results.xml
- name: Upload Test results
uses: actions/upload-artifact@master
with:
name: Test Results - ${{ matrix.python-version }}
path: ${{ matrix.python-version }}.results.xml
- name: Upload Code Coverage
uses: actions/upload-artifact@master
with:
name: Test Coverage - ${{ matrix.python-version }}
path: coverage/${{ matrix.python-version }}
- name: Flake8 styles
run: python -m flake8 ./corsair_scan
- name: Bandit security scan
run: python -m bandit -r ./corsair_scan
- name: Safety dependency scan
run: python -m safety check
- name: Semgrep
id: semgrep
uses: returntocorp/semgrep-action@v1
with:
config: p/r2c-ci
- name: Checkout origin branch if PR 'to-branch' is main
if: github.base_ref == 'main'
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: BumpVersion if PR 'to-branch' is main
if: github.base_ref == 'main'
run: |
grep -i 'current_version = ' setup.cfg | head -1 | tr -d 'current_version = '
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
bump2version minor
grep -i 'current_version = ' setup.cfg | head -1 | tr -d 'current_version = '
- name: Push changes if PR 'to-branch' is main
if: github.base_ref == 'main'
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}