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

Ostefano refactory #686

Merged
merged 2 commits into from
Aug 19, 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
39 changes: 22 additions & 17 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,55 @@ jobs:
- name: Install packages
run: |
sudo apt-get install libpoppler-cpp-dev libzbar0 tesseract-ocr

- name: Compile and install yara
run: |
sudo apt-get install automake libtool make gcc pkg-config
wget https://github.com/VirusTotal/yara/archive/refs/tags/v4.5.0.tar.gz
tar xzf *.tar.gz
wget https://github.com/VirusTotal/yara/archive/refs/tags/v4.5.0.tar.gz -O yara.tar.gz
tar xzf yara.tar.gz
pushd yara-*
./bootstrap.sh
./configure
make
sudo make install
popd
- uses: actions/checkout@v4

- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install pipenv
sed -i "s/python_version.*/python_version = \"${{ matrix.python-version }}\"/" Pipfile
pipenv lock
pipenv requirements > requirements.txt
# pyfaul must be installed manually (?)
pip install -r requirements.txt pyfaup
pip install .
python -m pip install --upgrade poetry
poetry install
# Tell poetry to not use a virtual environment
# poetry config virtualenvs.create false

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Run server in background
run: |
misp-modules -l 127.0.0.1 -s 2>error.log &
sleep 3
poetry run misp-modules -l 127.0.0.1 -s 2>error.log &
sleep 10

- name: Check if server is running
run: |
curl -sS localhost:6666/healthcheck

- name: Test with pytest
run: |
pytest tests
poetry run pytest

- name: Show error log
if: always()
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ venv*
.vscode*
*.sqlite
website/conf/config.cfg
wheels
56 changes: 0 additions & 56 deletions .travis.yml

This file was deleted.

3 changes: 0 additions & 3 deletions DOC-REQUIREMENTS

This file was deleted.

81 changes: 52 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,61 @@
# https://www.mkdocs.org/user-guide/deploying-your-docs/
# See: https://www.mkdocs.org/user-guide/deploying-your-docs/
# Running 'make' uses poetry-installed mkdocs
# Running 'USE_DOCKER=true make' uses docker mkdocs

.PHONY: prepare_docs generate_docs ci_generate_docs test_docs
.PHONY: prepare_docs generate_docs deploy test_docs

prepare_docs:
pip3 install .
cd documentation; python3 generate_documentation.py
mkdir -p docs/expansion/logos docs/export_mod/logos docs/import_mod/logos
mkdir -p docs/logos
cd documentation; cp -R ./logos/* ../docs/logos
cd documentation; cp -R ./logos/* ../docs/expansion/logos
cd documentation; cp -R ./logos/* ../docs/export_mod/logos
cd documentation; cp -R ./logos/* ../docs/import_mod/logos
cp ./documentation/mkdocs/*.md ./docs
cp LICENSE ./docs/license.md

install_requirements:
pip install -r docs/REQUIREMENTS.txt
MKDOCS_DOCKER_IMAGE := squidfunk/mkdocs-material

generate_docs: prepare_docs
mkdocs build
DOCS_DIST_DIR := ./docs

deploy:
mkdocs gh-deploy
DOCS_SRC_DIR := ./documentation

test_docs: prepare_docs
mkdocs serve
USE_DOCKER ?=

.DEFAULT_GOAL := generate_docs

# DOCKER make commands
generate_docs_docker: prepare_docs
docker run --rm -it -v $(PWD):/docs squidfunk/mkdocs-material build

deploy_docker:
docker run --rm -it -v $(PWD):/docs -v /home/$(whoami)/.docker:/root/.docker:ro squidfunk/mkdocs-material gh-deploy
prepare_docs:
@echo "Preparing documentation."
poetry install --only docs
poetry run python $(DOCS_SRC_DIR)/generate_documentation.py
mkdir -p $(DOCS_DIST_DIR)/logos
mkdir -p $(DOCS_DIST_DIR)/expansion/logos
mkdir -p $(DOCS_DIST_DIR)/export_mod/logos
mkdir -p $(DOCS_DIST_DIR)/import_mod/logos
cp -R $(DOCS_SRC_DIR)/logos/* $(DOCS_DIST_DIR)/logos
cp -R $(DOCS_SRC_DIR)/logos/* $(DOCS_DIST_DIR)/expansion/logos
cp -R $(DOCS_SRC_DIR)/logos/* $(DOCS_DIST_DIR)/export_mod/logos
cp -R $(DOCS_SRC_DIR)/logos/* $(DOCS_DIST_DIR)/import_mod/logos
cp $(DOCS_SRC_DIR)/mkdocs/*.md $(DOCS_DIST_DIR)
cp LICENSE $(DOCS_DIST_DIR)/license.md


test_docs_docker: prepare_docs
docker run --rm -it -p 8000:8000 -v $(PWD):/docs squidfunk/mkdocs-material
generate_docs: prepare_docs
ifeq ($(USE_DOCKER), true)
@echo "Generating documentation using '$(MKDOCS_DOCKER_IMAGE)'."
docker run --rm -it -v $(PWD):/docs $(MKDOCS_DOCKER_IMAGE) build
else
@echo "Generating docunentation."
poetry run mkdocs build
endif


deploy: generate_docs
ifeq ($(USE_DOCKER), true)
@echo "Deploying documentation using '$(MKDOCS_DOCKER_IMAGE)'."
docker run --rm -it -v $(PWD):/docs -v /home/$(whoami)/.docker:/root/.docker:ro $(MKDOCS_DOCKER_IMAGE) gh-deploy
else
@echo "Deploying docunentation."
poetry run mkdocs gh-deploy
endif


test_docs: prepare_docs
ifeq ($(USE_DOCKER), true)
@echo "Serving documentation using '$(MKDOCS_DOCKER_IMAGE)'."
docker run --rm -it -v $(PWD):/docs -p 8000:8000 $(MKDOCS_DOCKER_IMAGE)
else
@echo "Serving docunentation."
poetry run mkdocs serve
endif
87 changes: 0 additions & 87 deletions Pipfile

This file was deleted.

Loading