From cabeb4dffdc8652d8be6487b1aaacbd297ee9b6b Mon Sep 17 00:00:00 2001 From: Nicholas Long Date: Fri, 26 Sep 2025 15:01:06 -0600 Subject: [PATCH] add integration test --- .github/workflows/ci.yml | 5 ++- .github/workflows/integration.yml | 62 +++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/integration.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24e8ad8..c6f7de6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: jobs: test: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: matrix: python-version: ["3.9", "3.11"] @@ -37,7 +37,8 @@ jobs: run: python -c "import sys; print(sys.version)" - name: Setup Python run: | - sudo apt-get update && sudo apt-get install python3-enchant -y + sudo apt-get update + sudo apt-get install python3-enchant -y pip install --upgrade pip pip install tox coveralls - name: Run tox diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 0000000..2e72662 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,62 @@ +name: Integration Tests + +on: + pull_request: + push: + branches: + - "develop" + - "main" + +jobs: + integration: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.11"] + services: + postgres: + image: postgres:11.1 + env: + POSTGRES_PASSWORD: postgres + POSTGRES_DB: bsync_validator + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Setup Python dependencies + run: | + sudo apt-get update + pip install --upgrade pip + pip install -r requirements-test.txt + - name: Setup Django + env: + DJANGO_SETTINGS_MODULE: bsyncviewer.settings.gh_actions + run: | + python manage.py collectstatic --noinput + python manage.py migrate + - name: Start Django server + env: + DJANGO_SETTINGS_MODULE: bsyncviewer.settings.gh_actions + run: | + python manage.py runserver 8000 & + echo $! > server.pid + sleep 10 # Give server time to start + - name: Test home page loads + run: | + curl -f -s -o /dev/null http://localhost:8000/ || (echo "Home page failed to load" && exit 1) + echo "✅ Home page loaded successfully" + - name: Stop Django server + if: always() + run: | + if [ -f server.pid ]; then + kill $(cat server.pid) || true + rm server.pid + fi \ No newline at end of file