From 08ffcfe4bab603ef7f893e6aad17aec54a0346d8 Mon Sep 17 00:00:00 2001 From: Lars Kiesow Date: Fri, 2 Feb 2024 15:52:51 +0100 Subject: [PATCH] Automatically run bandit and flake8 --- .github/workflows/test.yml | 36 ++++++++++++++++++++++++++++++++++++ nginx-ldap-connector.py | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..820a504 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,36 @@ +name: bandit and flake8 + +on: + push: + branches-ignore: + - 'dependabot/**' + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + # https://endoflife.date/python + # https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#python + python-version: + - '3.8' + - '3.9' + - '3.10' + - '3.11' + + steps: + - uses: actions/checkout@v4 + + - name: set up python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - run: pip install -r requirements.txt + + - run: pip install flake8 bandit + + - run: flake8 *.py + + - run: bandit *.py diff --git a/nginx-ldap-connector.py b/nginx-ldap-connector.py index 83b35d5..3db0b66 100644 --- a/nginx-ldap-connector.py +++ b/nginx-ldap-connector.py @@ -76,5 +76,5 @@ def auth(): if __name__ == '__main__': - app.run(host=os.environ.get('LISTEN_ADDR', '0.0.0.0'), + app.run(host=os.environ.get('LISTEN_ADDR', '127.0.0.1'), port=os.environ.get('LISTEN_PORT' '5000'))