Skip to content

Make changes so package can upload to TestPyPi #51

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

Merged
merged 7 commits into from
Aug 7, 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
80 changes: 80 additions & 0 deletions .github/workflows/test-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Publish Python 🐍 distribution 📦 to TestPyPI

on:
push:
tags:
- 'dev-v*'

jobs:
tests:
name: Linting and running tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pip install poetry
- name: Install dependencies
run: poetry install
- name: Run Pylint
run: |
poetry run pylint --fail-under=9 --rcfile=.pylintrc aikido_firewall/
pylint_exit_code=$?
if [ $pylint_exit_code -ne 0 ]; then
echo "Pylint check failed. Please fix the issues."
exit 1
fi

- name: Run Black Check
run: |
poetry run black --check --diff aikido_firewall/
black_exit_code=$?
if [ $black_exit_code -ne 0 ]; then
echo "Black check failed. Please run 'black .' to format the code."
exit 1
fi
- name: Run tests
run: |
make test
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pip install poetry
- name: Install dependencies
run: poetry install

- name: Build distribution packages
run: poetry build

- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
- build
- tests
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/aikido_firewall

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
447 changes: 277 additions & 170 deletions poetry.lock

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
[tool.poetry]
name = "aikido_firewall"
version = "0.1.0"
version = "0.0.7"
description = "Aikido RASP for Python"
authors = ["Aikido"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.12"
python = "^3.8"
importhook = "^1.0.9"
python-dotenv = "^1.0.1"
pytest = "^8.2.2"
pytest-cov = "^5.0.0"
pytest-mock = "^3.14.0"
werkzeug = "^3.0.3"
flask-http-middleware = "^0.4.2"
regex = "^2024.5.15"
requests = "^2.32.3"

[tool.poetry.group.dev.dependencies]
black = "^24.4.2"
pylint = "^3.2.5"
pytest = "^8.2.2"
pytest-cov = "^5.0.0"
pytest-mock = "^3.14.0"

[build-system]
requires = ["poetry-core"]
Expand Down
4 changes: 3 additions & 1 deletion sample-apps/django-mysql-gunicorn/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ RUN pip install -r requirements.txt
# Build and install aikido_firewall from source
WORKDIR /tmp
RUN pip install poetry
RUN rm -r ./dist
RUN make build
RUN pip install ./dist/aikido_firewall-0.1.0.tar.gz
RUN mv ./dist/aikido_firewall-*.tar.gz ./dist/aikido_firewall.tar.gz
RUN pip install ./dist/aikido_firewall.tar.gz
RUN pip list

WORKDIR /app
6 changes: 4 additions & 2 deletions sample-apps/django-mysql/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ RUN pip install -r requirements.txt
# Build and install aikido_firewall from source
WORKDIR /tmp
RUN pip install poetry
RUN rm -r ./dist
RUN make build
RUN pip install ./dist/aikido_firewall-0.1.0.tar.gz
RUN mv ./dist/aikido_firewall-*.tar.gz ./dist/aikido_firewall.tar.gz
RUN pip install ./dist/aikido_firewall.tar.gz
RUN pip list

WORKDIR /app
WORKDIR /app
4 changes: 3 additions & 1 deletion sample-apps/flask-mongo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ RUN pip install -r requirements.txt
# Build and install aikido_firewall from source
WORKDIR /tmp
RUN pip install poetry
RUN rm -r ./dist
RUN make build
RUN pip install ./dist/aikido_firewall-0.1.0.tar.gz
RUN mv ./dist/aikido_firewall-*.tar.gz ./dist/aikido_firewall.tar.gz
RUN pip install ./dist/aikido_firewall.tar.gz
RUN pip list

WORKDIR /app
4 changes: 3 additions & 1 deletion sample-apps/flask-mysql-uwsgi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ RUN pip install -r requirements.txt
# Build and install aikido_firewall from source
WORKDIR /tmp
RUN pip install poetry
RUN rm -r ./dist
RUN make build
RUN pip install ./dist/aikido_firewall-0.1.0.tar.gz
RUN mv ./dist/aikido_firewall-*.tar.gz ./dist/aikido_firewall.tar.gz
RUN pip install ./dist/aikido_firewall.tar.gz
RUN pip list

WORKDIR /app
6 changes: 4 additions & 2 deletions sample-apps/flask-mysql/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ RUN pip install -r requirements.txt
# Build and install aikido_firewall from source
WORKDIR /tmp
RUN pip install poetry
RUN rm -r ./dist
RUN make build
RUN pip install ./dist/aikido_firewall-0.1.0.tar.gz
RUN mv ./dist/aikido_firewall-*.tar.gz ./dist/aikido_firewall.tar.gz
RUN pip install ./dist/aikido_firewall.tar.gz
RUN pip list

WORKDIR /app
WORKDIR /app
4 changes: 3 additions & 1 deletion sample-apps/flask-postgres/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ RUN pip install -r requirements.txt
# Build and install aikido_firewall from source
WORKDIR /tmp
RUN pip install poetry
RUN rm -r ./dist
RUN make build
RUN pip install ./dist/aikido_firewall-0.1.0.tar.gz
RUN mv ./dist/aikido_firewall-*.tar.gz ./dist/aikido_firewall.tar.gz
RUN pip install ./dist/aikido_firewall.tar.gz
RUN pip list

WORKDIR /app
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ classifiers =
package_dir =
= src
packages = find:
python_requires = >=3.6
python_requires = >=3.8

[options.packages.find]
where = src
where = src
Loading