Skip to content

Add node-app.yml

Add node-app.yml #117

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: T's Unittest CI
on:
push:
branches: [ "trunk" ]
pull_request:
branches: [ "trunk" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
environment: PRODUCTION
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- 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 --max-complexity=10 --max-line-length=127 --exit-zero
- name: Run Black Formatter
run: |
black . --check
- name: Set Up Docker For Apache Kafka
run: |
docker compose -f docker-compose.yaml up -d --wait
- name: Wait for Kafka and Zookeeper to be ready
run: |
echo "Waiting for Kafka to be ready on port 9092..."
timeout 60 bash -c 'until echo > /dev/tcp/localhost/9092; do sleep 1; done'
echo "Kafka is up and running!"
- name: Test with unittest
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
TEST_CHAT_URL: ${{ secrets.TEST_CHAT_URL }}
run: |
python -m unittest -b