-
Notifications
You must be signed in to change notification settings - Fork 7
108 lines (86 loc) · 2.32 KB
/
test_and_build.yaml
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
name: CI/CD Pipeline
on:
push:
branches:
- '**'
pull_request:
branches:
- 'develop'
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e .[dev]
- name: Run Tests
run: pytest -v tests/
lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e .[dev]
- name: Run Lint
run: pylint envcloak/
continue-on-error: true
security-check:
name: Security Check
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e .[dev]
- name: Run Bandit
run: bandit -v -r envcloak/
build-and-deploy:
name: Build and Deploy to PyPI
runs-on: ubuntu-latest
needs:
- test
- lint
- security-check
if: >
(github.ref == 'refs/heads/main') ||
(github.event_name == 'pull_request' && github.base_ref == 'main')
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Build Tools
run: |
python -m pip install --upgrade pip setuptools wheel
pip install build twine
- name: Build Package
run: python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*