Skip to content

Publish Python 🐍 distribution 📦 to TestPyPI #5

Publish Python 🐍 distribution 📦 to TestPyPI

Publish Python 🐍 distribution 📦 to TestPyPI #5

Workflow file for this run

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: Start databases
working-directory: ./sample-apps/databases
run: docker compose up --build -d
- name: Add local.aikido.io to /etc/hosts
run: |
sudo echo "127.0.0.1 local.aikido.io" | sudo tee -a /etc/hosts
- 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@v4.1.7
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/