Repository navigation
Add Baikal Docker test server framework for CI/CD #1086
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: tests | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| tests: | |
| name: ${{ matrix.python }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ${{ github.event_name == 'pull_request' && fromJSON('["3.9", "3.14"]') || fromJSON('["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]') }} | |
| services: | |
| baikal: | |
| image: ckulka/baikal:nginx | |
| ports: | |
| - 8800:80 | |
| options: >- | |
| --health-cmd "curl -f http://localhost/ || exit 1" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| --health-start-period 30s | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: pip|${{ hashFiles('setup.py') }}|${{ hashFiles('tox.ini') }} | |
| - run: pip install tox | |
| - name: Configure Baikal with pre-seeded database | |
| run: | | |
| # Copy pre-configured database and config to Baikal container | |
| docker cp tests/docker-test-servers/baikal/Specific/. ${{ job.services.baikal.id }}:/var/www/baikal/Specific/ | |
| docker cp tests/docker-test-servers/baikal/config/. ${{ job.services.baikal.id }}:/var/www/baikal/config/ | |
| # Fix permissions for SQLite | |
| docker exec ${{ job.services.baikal.id }} chown -R nginx:nginx /var/www/baikal/Specific /var/www/baikal/config | |
| docker exec ${{ job.services.baikal.id }} chmod -R 770 /var/www/baikal/Specific | |
| # Restart to pick up configuration | |
| docker restart ${{ job.services.baikal.id }} | |
| - name: Wait for Baikal to be ready | |
| run: | | |
| sleep 5 | |
| timeout 60 bash -c 'until curl -f http://localhost:8800/ 2>/dev/null; do echo "Waiting..."; sleep 2; done' | |
| echo "Baikal is ready!" | |
| - run: tox -e py | |
| env: | |
| BAIKAL_URL: http://localhost:8800 | |
| docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: pip|${{ hashFiles('setup.py') }}|${{ hashFiles('tox.ini') }} | |
| - run: pip install tox | |
| - run: tox -e docs | |
| style: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: pip|${{ hashFiles('setup.py') }}|${{ hashFiles('tox.ini') }} | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit|${{ hashFiles('.pre-commit-config.yaml') }} | |
| - run: pip install tox | |
| - run: tox -e style |