Skip to content

Integration and Data Consistency Tests #802

Integration and Data Consistency Tests

Integration and Data Consistency Tests #802

name: Integration and Data Consistency Tests
on:
workflow_run:
workflows: ["Build and Publish Docker image to GHCR"]
types: [completed]
workflow_dispatch:
permissions: {}
jobs:
test-sqlite:
name: External Harness (SQLite)
runs-on: ubuntu-24.04
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
permissions:
contents: read
packages: read
env:
DATABASE_URL: sqlite:///home/lynx/lynx.db
steps:
- name: Checkout profiled source
uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}
submodules: recursive
- name: Set image reference
id: image
run: echo "reference=ghcr.io/${GITHUB_REPOSITORY,,}:${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}" >> "$GITHUB_OUTPUT"
- name: Build and verify frontend
uses: ./.github/actions/build-frontend
with:
save_cache: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.head_branch == github.event.repository.default_branch }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Restore and save trusted debug Rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-lynx-rust
shared-key: debug
cache-targets: true
cache-bin: false
save-if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.head_branch == github.event.repository.default_branch }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Start Lynx with SQLite
run: |
docker pull "${{ steps.image.outputs.reference }}"
docker run --detach --name lynx \
--publish 8080:8080 --publish 3000:3000 \
--env DATABASE_BACKEND=sqlite \
--env DATABASE_URL \
--env RUST_LOG=info \
--env AUTH_MODE=none \
--env ANALYTICS_ENABLED=true --env ANALYTICS_FLUSH_INTERVAL_SECS=1 \
--env API_HOST=0.0.0.0 --env API_PORT=8080 \
--env REDIRECT_HOST=0.0.0.0 --env REDIRECT_PORT=3000 \
"${{ steps.image.outputs.reference }}"
- name: Run typed external scenarios
run: cargo test --test external_harness -- --ignored --test-threads=1 --nocapture
env:
LYNX_E2E_CONTAINER: lynx
LYNX_E2E_CONCURRENCY: '100'
LYNX_E2E_EXPECT_ANALYTICS: 'true'
RUST_LOG: info
- name: Collect service logs
if: always()
run: docker logs lynx || true
- name: Clean up service
if: always()
run: docker rm --force lynx || true
test-postgres:
name: External Harness (PostgreSQL)
runs-on: ubuntu-24.04
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
permissions:
contents: read
packages: read
env:
DATABASE_URL: postgresql://lynx:lynx_password@localhost:5432/lynx
services:
postgres:
image: postgres:18-alpine
env:
POSTGRES_USER: lynx
POSTGRES_PASSWORD: lynx_password
POSTGRES_DB: lynx
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout profiled source
uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}
submodules: recursive
- name: Set image reference
id: image
run: echo "reference=ghcr.io/${GITHUB_REPOSITORY,,}:${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}" >> "$GITHUB_OUTPUT"
- name: Build and verify frontend
uses: ./.github/actions/build-frontend
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Restore trusted debug Rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-lynx-rust
shared-key: debug
cache-targets: true
cache-bin: false
save-if: false
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Start Lynx with PostgreSQL
run: |
docker pull "${{ steps.image.outputs.reference }}"
docker run --detach --name lynx --network host \
--env DATABASE_BACKEND=postgres --env DATABASE_URL \
--env RUST_LOG=info \
--env AUTH_MODE=none \
--env ANALYTICS_ENABLED=true --env ANALYTICS_FLUSH_INTERVAL_SECS=1 \
--env API_HOST=0.0.0.0 --env API_PORT=8080 \
--env REDIRECT_HOST=0.0.0.0 --env REDIRECT_PORT=3000 \
"${{ steps.image.outputs.reference }}"
- name: Run typed external scenarios
run: cargo test --test external_harness -- --ignored --test-threads=1 --nocapture
env:
LYNX_E2E_CONTAINER: lynx
LYNX_E2E_CONCURRENCY: '100'
LYNX_E2E_EXPECT_ANALYTICS: 'true'
RUST_LOG: info
- name: Collect service logs
if: always()
run: docker logs lynx || true
- name: Clean up service
if: always()
run: docker rm --force lynx || true