Skip to content

Commit ab12b93

Browse files
committed
Adding safety check
1 parent 743fd46 commit ab12b93

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

.github/workflows/python-license-check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Python License Checks
1+
name: Python Dependency License Check with Pylic
22

33
on: push
44

55
jobs:
66
Linting:
77
runs-on: ubuntu-latest
88
strategy:
9-
fail-fast: false
9+
fail-fast: true
1010
matrix:
1111
python-version: [3.9]
1212
steps:

.github/workflows/safety.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Python Dependency Vulnerability Check with Safety
2+
3+
on: push
4+
5+
jobs:
6+
Linting:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
python-version: [3.9]
12+
steps:
13+
#----------------------------------------------
14+
# check-out repo and set-up python
15+
#----------------------------------------------
16+
- name: Check out repository
17+
uses: actions/checkout@v3
18+
- name: Set up python
19+
id: setup-python
20+
uses: actions/setup-python@v3
21+
with:
22+
python-version: 3.9
23+
#----------------------------------------------
24+
# ----- install & configure poetry -----
25+
#----------------------------------------------
26+
- name: Load Cached Poetry Installation
27+
uses: actions/cache@v3
28+
with:
29+
path: ~/.local # the path depends on the OS
30+
key: poetry-no-dev-2 # increment to reset cache
31+
- name: Install Poetry
32+
uses: snok/install-poetry@v1
33+
with:
34+
virtualenvs-create: true
35+
virtualenvs-in-project: true
36+
installer-parallel: true
37+
#----------------------------------------------
38+
# load cached venv if cache exists
39+
#----------------------------------------------
40+
- name: Load cached venv
41+
id: cached-poetry-no-dev-dependencies
42+
uses: actions/cache@v3
43+
with:
44+
path: .venv
45+
key: venv-no-dev-dependencies-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
46+
#----------------------------------------------
47+
# install dependencies if cache does not exist
48+
#----------------------------------------------
49+
- name: Install dependencies
50+
if: steps.cached-poetry-no-dev-dependencies.outputs.cache-hit != 'true'
51+
run: poetry install --no-dev --no-root
52+
#----------------------------------------------
53+
# Run Safety check
54+
#----------------------------------------------
55+
- name: Safety check
56+
run: |
57+
poetry run pip install safety
58+
poetry run safety check

0 commit comments

Comments
 (0)