diff --git a/.github/workflows/lila.yml b/.github/workflows/lila.yml index 577830c..197dfdf 100644 --- a/.github/workflows/lila.yml +++ b/.github/workflows/lila.yml @@ -9,50 +9,21 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] container: ubuntu:22.04 services: lila: - image: ghcr.io/lichess-org/lila-docker:ci + image: ghcr.io/lichess-org/lila-docker:ci2 options: --restart=always - env: - MONGO_URL: mongodb://mongodb?appName=lila - REDIS_URL: redis://redis - mongodb: - image: mongo:5.0-focal - redis: - image: redis:7-alpine steps: - - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 21 - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install pymongo requests - - name: Checkout lila-db-seed - uses: actions/checkout@v4 - with: - repository: lichess-org/lila-db-seed - - name: Seed database - run: | - ./spamdb/spamdb.py \ - --uri=mongodb://mongodb/lichess \ - --drop-db \ - --password=password \ - --su-password=password \ - --streamers \ - --coaches \ - --tokens + - name: Install curl + run: apt-get update && apt-get install -y curl - name: Checkout berserk uses: actions/checkout@v4 - - name: Install berserk - run: python -m pip install -e . - name: Run tests run: | - python integration/sample.py + ./integration/run.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f16cee2..58cb035 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/typing.yml b/.github/workflows/typing.yml index 83f8131..629ca2f 100644 --- a/.github/workflows/typing.yml +++ b/.github/workflows/typing.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/integration/run.sh b/integration/run.sh new file mode 100755 index 0000000..aed15a1 --- /dev/null +++ b/integration/run.sh @@ -0,0 +1,15 @@ +#!/bin/bash -e + +python3 -m pip install -e . --no-cache-dir + +attempts=0 +while [ $attempts -lt 30 ]; do + if curl -s http://lila:9663 >/dev/null; then + break + fi + echo "⌛ Waiting for lila to start..." + sleep 1 + attempts=$((attempts + 1)) +done + +python3 integration/sample.py diff --git a/integration/sample.py b/integration/sample.py index 7e335cf..0f2af38 100644 --- a/integration/sample.py +++ b/integration/sample.py @@ -6,8 +6,7 @@ me = client.account.get() assert me['id'] == 'bobby' -email = client.account.get_email() -assert email == 'bobby@localhost' +assert client.account.get_email() == 'bobby@localhost' assert client.account.get_kid_mode() == False client.account.set_kid_mode(True) diff --git a/integration/test b/integration/test new file mode 100755 index 0000000..7951937 --- /dev/null +++ b/integration/test @@ -0,0 +1,22 @@ +#!/bin/bash -e + +IMAGE=ghcr.io/lichess-org/lila-docker:ci2 + +cleanup_containers() { + docker rm --force lila > /dev/null 2>&1 || true + docker rm --force app > /dev/null 2>&1 || true + docker network rm lila-network > /dev/null 2>&1 || true +} + +echo "Running integration tests" + +cleanup_containers +docker network create lila-network || true +docker run -d --name lila --network lila-network $IMAGE + +docker run --name app --network lila-network -v $(pwd):/app -w /app $IMAGE sh -c "./integration/run.sh" + +echo "✅ Integration tests passed" + +cleanup_containers +echo "✅ Done"