Skip to content

Commit

Permalink
feat(CI): Initial CI
Browse files Browse the repository at this point in the history
Signed-off-by: Anurag Rajawat <[email protected]>
  • Loading branch information
Anurag Rajawat committed Sep 20, 2024
1 parent 4999457 commit 757e140
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 218 deletions.
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:
# 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.

0 comments on commit 757e140

Please sign in to comment.