Skip to content

Commit

Permalink
Merge remote-tracking branch 'source/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianMontaguSmartDCSIT committed May 16, 2024
2 parents 25ecc6b + beadee8 commit 8861e77
Show file tree
Hide file tree
Showing 41 changed files with 17,496 additions and 2 deletions.
25 changes: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.12",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": {
"1": "sudo apt-get update && sudo apt-get -y install graphviz graphviz-dev && pip3 install --user -r requirements.txt",
"2": "echo 'export PYTHONPATH=/workspaces/test-event-generator:$PYTHONPATH' >> ~/.bashrc"
}

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
40 changes: 40 additions & 0 deletions .github/workflows/test_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: test_workflow
on:
pull_request:

push:
branches:
'**'
jobs:
sast:
uses: SmartDCSITlimited/actions-store/.github/workflows/SAST.yml@main
secret-detection:
uses: SmartDCSITlimited/actions-store/.github/workflows/SecretDetection.yml@main
python-linting:
uses: SmartDCSITlimited/actions-store/.github/workflows/PythonLinting.yml@main

run-tests:
runs-on: ubuntu-latest
steps:
- name: Setup Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'

- name: Install Requirements
run: |
pip install --upgrade pip
pip install pytest
pytest --version
pip install -r requirements.txt
- name: Run Tests
run: |
export PYTHONPATH=/workspaces/test-event-generator:$PYTHONPATH
pytest
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.vscode

# ignore .pyc files
*.pyc
# ignore build files
build
*.egg-info
# ignore env folder
env

.mypy_cache/
38 changes: 38 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
GITLAB_PYTHON_VERSION: python:3.11

stages:
- lint
- test

cache:
paths:
- .cache/pip
- venv/

include:
- template: Security/SAST.gitlab-ci.yml
- template: "Jobs/Secret-Detection.latest.gitlab-ci.yml"
- template: "Security/Dependency-Scanning.gitlab-ci.yml"
- template: "Security/License-Scanning.gitlab-ci.yml"
- project: 'smartdcs1/internal/gitlab-ci-templates/python-linting-ci'
ref: main
file: '.python-linting-ci-template.yml'

pytest:
image: $GITLAB_PYTHON_VERSION
stage: test
before_script:
- pip install pytest
- pytest --version
- pip install -r requirements.txt
script:
- export PYTHONPATH=/workspaces/test-event-generator:$PYTHONPATH
- pytest --junitxml=report.xml
artifacts:
when: always
reports:
junit: report.xml
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
2 changes: 2 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[mypy]
ignore_errors = True
10 changes: 10 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[MESSAGES CONTROL]
disable=
invalid-name,
duplicate-code,
redefined-outer-name,
too-many-locals,
too-many-lines,
too-many-arguments,
too-many-instance-attributes,
too-few-public-methods
112 changes: 112 additions & 0 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"version": "1.4.0",
"plugins_used": [
{
"name": "ArtifactoryDetector"
},
{
"name": "AWSKeyDetector"
},
{
"name": "AzureStorageKeyDetector"
},
{
"name": "Base64HighEntropyString",
"limit": 4.5
},
{
"name": "BasicAuthDetector"
},
{
"name": "CloudantDetector"
},
{
"name": "DiscordBotTokenDetector"
},
{
"name": "GitHubTokenDetector"
},
{
"name": "HexHighEntropyString",
"limit": 3.0
},
{
"name": "IbmCloudIamDetector"
},
{
"name": "IbmCosHmacDetector"
},
{
"name": "JwtTokenDetector"
},
{
"name": "KeywordDetector",
"keyword_exclude": ""
},
{
"name": "MailchimpDetector"
},
{
"name": "NpmDetector"
},
{
"name": "PrivateKeyDetector"
},
{
"name": "SendGridDetector"
},
{
"name": "SlackDetector"
},
{
"name": "SoftlayerDetector"
},
{
"name": "SquareOAuthDetector"
},
{
"name": "StripeDetector"
},
{
"name": "TwilioKeyDetector"
}
],
"filters_used": [
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
},
{
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
},
{
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
},
{
"path": "detect_secrets.filters.heuristic.is_lock_file"
},
{
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
},
{
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
},
{
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
},
{
"path": "detect_secrets.filters.heuristic.is_sequential_string"
},
{
"path": "detect_secrets.filters.heuristic.is_swagger_file"
},
{
"path": "detect_secrets.filters.heuristic.is_templated_secret"
}
],
"results": {},
"generated_at": "2023-10-02T11:09:20Z"
}
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# janus
test event generator
# Test Event Generator
# Install
Before requirements install run the following:
* `sudo apt-get update -y`
* `sudo apt-get -y install graphviz`
* `sudo apt-get install graphviz-dev`

Then run in you dev or python environment:
* `pip install -r requirements.txt`
32 changes: 32 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
absl-py==2.1.0
certifi==2023.11.17
charset-normalizer==3.3.2
contourpy==1.2.0
cycler==0.12.1
docopt==0.6.2
flatdict==4.0.1
fonttools==4.47.2
idna==3.6
iniconfig==2.0.0
kiwisolver==1.4.5
matplotlib==3.8.2
networkx==3.2.1
numpy==1.26.3
ortools==9.8.3296
packaging==23.2
pandas==2.2.0
pillow==10.2.0
pipreqs==0.4.13
pluggy==1.4.0
protobuf==4.25.2
pyparsing==3.1.1
pytest==7.4.4
python-dateutil==2.8.2
pytz==2023.3.post1
requests==2.31.0
setuptools==69.0.3
six==1.16.0
tzdata==2023.4
urllib3==2.1.0
wheel==0.42.0
yarg==0.1.9
19 changes: 19 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python
"""Setup script for installation
"""
from setuptools import setup

setup(
name='test-event-gen',
version='0.0.1',
description='Audit event generator',
author='Freddie Mather',
author_email='freddie.mather@smartdcs.co.uk',
packages=[
'test_event_generator',
'test_event_generator.core',
'test_event_generator.utils',
'test_event_generator.solutions',
'test_event_generator.io'
],
)
4 changes: 4 additions & 0 deletions test_event_generator/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Init file for main module
"""

from test_event_generator.io.run import puml_file_to_test_events # noqa: F401
Loading

0 comments on commit 8861e77

Please sign in to comment.