Skip to content

Commit

Permalink
#7 - Updated GitHub action workflows (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianMontaguSmartDCSIT authored May 16, 2024
1 parent 8861e77 commit 7c1e792
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 3 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/PythonLinting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: run-tests
on: [workflow_call]
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Setup Actions
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Python Dependencies
run: |
pip install --upgrade pip
pip install flake8
flake8 --version
pip install pylint
pylint --version
pip install mypy
mypy --version
pip install -r requirements.txt
- name: Flake8
if: '!cancelled()'
run: |
PY_FILES=$(git ls-files '*.py')
if [ -z "$PY_FILES" ]
then
echo "No files to check!"
else
flake8 $PY_FILES
fi
- name: Pylint
if: '!cancelled()'
run: |
PY_FILES=$(git ls-files '*.py')
if [ -z "$PY_FILES" ]
then
echo "No files to check!"
else
pylint $PY_FILES
fi
- name: MyPy
if: '!cancelled()'
run: |
PY_FILES=$(git ls-files '*.py')
if [ -z "$PY_FILES" ]
then
echo "No files to check!"
else
mypy --strict --explicit-package-bases --namespace-packages .
fi
21 changes: 21 additions & 0 deletions .github/workflows/SAST.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: run-tests
on: [workflow_call]
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Setup Actions
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Python Dependencies
run: |
pip install semgrep
semgrep --version
- name: Run Tests
run: semgrep scan --error --config auto
21 changes: 21 additions & 0 deletions .github/workflows/SecretDetection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: run-secret-detection
on: [workflow_call]
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Setup Actions
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Python Dependencies
run: |
pip install detect-secrets
- name: Run Tests
run: |
git ls-files -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline
6 changes: 3 additions & 3 deletions .github/workflows/test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ on:
'**'
jobs:
sast:
uses: SmartDCSITlimited/actions-store/.github/workflows/SAST.yml@main
uses: ./.github/workflows/SAST.yml
secret-detection:
uses: SmartDCSITlimited/actions-store/.github/workflows/SecretDetection.yml@main
uses: ./.github/workflows/SecretDetection.yml
python-linting:
uses: SmartDCSITlimited/actions-store/.github/workflows/PythonLinting.yml@main
uses: ./.github/workflows/PythonLinting.yml

run-tests:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 7c1e792

Please sign in to comment.