Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: Refactor for better maintainability #17

Merged
merged 6 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions .github/workflows/ci-test-go.yml

This file was deleted.

156 changes: 78 additions & 78 deletions .github/workflows/ci-test-py.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,78 @@
name: ci-test-py
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
py-pip-ai-sentryflow:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'

- name: check Python pip3 requirements
run: |
pip install -r requirements.txt
working-directory: ai-engine

py-ruff-ai-sentryflow:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
working-directory: ai-engine

- name: Create pyproject.toml
run: |
echo "[tool.ruff.lint.per-file-ignores]" > pyproject.toml
echo '"stringlifier/*" = ["E402", "F811", "F401"]' >> pyproject.toml
working-directory: ai-engine

- name: Lint with Ruff
run: |
pip install ruff
ruff --output-format=github .
working-directory: ai-engine

py-lint-ai-sentryflow:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pylint
working-directory: ai-engine

- name: Lint with Pylint
run: |
pylint classifier.py
working-directory: ai-engine

py-pep8-ai-sentryflow:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Run PEP8'
uses: quentinguidee/pep8-action@v1
with:
arguments: '--max-line-length=120 --exclude=*stringlifier/*,*protobuf/*'
#name: ci-test-py
#on:
# push:
# branches: [main]
# pull_request:
# branches: [main]
#
#jobs:
# py-pip-ai-sentryflow:
daemon1024 marked this conversation as resolved.
Show resolved Hide resolved
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: '3.11'
# cache: 'pip'
#
# - name: check Python pip3 requirements
# run: |
# pip install -r requirements.txt
# working-directory: ai-engine
#
# py-ruff-ai-sentryflow:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: '3.11'
# cache: 'pip'
#
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r requirements.txt
# working-directory: ai-engine
#
# - name: Create pyproject.toml
# run: |
# echo "[tool.ruff.lint.per-file-ignores]" > pyproject.toml
# echo '"stringlifier/*" = ["E402", "F811", "F401"]' >> pyproject.toml
# working-directory: ai-engine
#
# - name: Lint with Ruff
# run: |
# pip install ruff
# ruff --output-format=github .
# working-directory: ai-engine
#
# py-lint-ai-sentryflow:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: '3.11'
# cache: 'pip'
#
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r requirements.txt
# pip install pylint
# working-directory: ai-engine
#
# - name: Lint with Pylint
# run: |
# pylint classifier.py
# working-directory: ai-engine
#
# py-pep8-ai-sentryflow:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: 'Run PEP8'
# uses: quentinguidee/pep8-action@v1
# with:
# arguments: '--max-line-length=120 --exclude=*stringlifier/*,*protobuf/*'
75 changes: 75 additions & 0 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024 Authors of SentryFlow

name: PR checks

on:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]
paths-ignore:
- '**.md'
- 'docs/**'
- 'LICENSE'

permissions: read-all

jobs:
license:
name: License
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sentryflow
steps:
- uses: actions/checkout@v4

- name: Check License Header
uses: apache/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

static-checks:
name: Static checks
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sentryflow
steps:
- uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: go fmt
run: make fmt

- name: Lint
uses: golangci/golangci-lint-action@v6
with:
working-directory: ./sentryflow
version: v1.60.3
args: --timeout=10m --out-format=line-number
skip-cache: true # https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052197778

build-sentryflow-image:
name: Build SentryFlow container image
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
working-directory: ./sentryflow
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Build image
run: make image

- name: Scan image
uses: anchore/scan-action@v4
with:
image: "docker.io/5gsec/sentryflow:latest"
severity-cutoff: critical
output-format: sarif
35 changes: 0 additions & 35 deletions .github/workflows/pr-checks.yml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ go.work.sum
*.swp
*.swo
*~

venv/
2 changes: 2 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ header:

paths-ignore:
- "protobuf/*"
# Explicitly mention generated go files otherwise the check won't pass.
- "protobuf/**/*.go"

comment: on-failure

Expand Down
Loading
Loading