|
52 | 52 | # "slow step failed" rather than masking the fast ones. |
53 | 53 | run: pytest -v tests/test_fresh_install.py -m slow |
54 | 54 |
|
| 55 | + fresh-install-docker: |
| 56 | + # Docker E2E: generates compose from template, starts the full |
| 57 | + # Immich stack, validates API + detection. Runs on Ubuntu where |
| 58 | + # Docker is pre-installed (macOS runners can't run Docker VMs). |
| 59 | + runs-on: ubuntu-latest |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + with: |
| 63 | + submodules: true |
| 64 | + - uses: actions/setup-python@v5 |
| 65 | + with: |
| 66 | + python-version: "3.11" |
| 67 | + - name: Generate compose from template |
| 68 | + run: | |
| 69 | + python3 -c " |
| 70 | + import sys, os, secrets |
| 71 | + from pathlib import Path |
| 72 | + sys.path.insert(0, '.') |
| 73 | + from immich_accelerator.__main__ import _COMPOSE_TEMPLATE |
| 74 | + test_dir = Path('/tmp/fresh-install-ci') |
| 75 | + test_dir.mkdir(parents=True, exist_ok=True) |
| 76 | + photos = '/tmp/test-photos' |
| 77 | + os.makedirs(photos, exist_ok=True) |
| 78 | + data = str(test_dir / 'data') |
| 79 | + os.makedirs(data, exist_ok=True) |
| 80 | + compose = _COMPOSE_TEMPLATE.replace('{photos_mount}', f'{photos}:{photos}:ro') |
| 81 | + (test_dir / 'docker-compose.yml').write_text(compose) |
| 82 | + pw = secrets.token_urlsafe(24) |
| 83 | + env = f'UPLOAD_LOCATION={data}\nDB_PASSWORD={pw}\nDB_HOSTNAME=immich_postgres\nDB_USERNAME=postgres\nDB_DATABASE_NAME=immich\nREDIS_HOSTNAME=immich_redis\n' |
| 84 | + (test_dir / '.env').write_text(env) |
| 85 | + print('Compose generated') |
| 86 | + " |
| 87 | + - name: Validate compose syntax |
| 88 | + run: docker compose -f /tmp/fresh-install-ci/docker-compose.yml config > /dev/null |
| 89 | + - name: Start Immich stack |
| 90 | + run: | |
| 91 | + cd /tmp/fresh-install-ci |
| 92 | + docker compose up -d |
| 93 | + echo "Waiting for API..." |
| 94 | + for i in $(seq 1 90); do |
| 95 | + if curl -sf http://localhost:2283/api/server/ping 2>/dev/null | grep -q pong; then |
| 96 | + echo "API up after ${i}x3s" |
| 97 | + break |
| 98 | + fi |
| 99 | + sleep 3 |
| 100 | + done |
| 101 | + curl -sf http://localhost:2283/api/server/ping | grep -q pong || { echo "API never came up"; docker logs immich_server; exit 1; } |
| 102 | + - name: Verify all containers running |
| 103 | + run: | |
| 104 | + docker ps --format "{{.Names}}\t{{.Status}}" | grep immich |
| 105 | + [ $(docker ps --format "{{.Names}}" | grep -c immich) -eq 3 ] || { echo "Not all containers running"; exit 1; } |
| 106 | + - name: Verify setup detection |
| 107 | + run: | |
| 108 | + python3 -c " |
| 109 | + import sys |
| 110 | + sys.path.insert(0, '.') |
| 111 | + from immich_accelerator.__main__ import detect_immich |
| 112 | + immich = detect_immich('docker') |
| 113 | + assert immich['version'], 'no version' |
| 114 | + assert immich['workers_include'] == 'api', f'wrong workers: {immich[\"workers_include\"]}' |
| 115 | + assert immich.get('media_location'), 'no media_location' |
| 116 | + print(f'Detected: v{immich[\"version\"]}, workers={immich[\"workers_include\"]}') |
| 117 | + print(f'Media: {immich[\"media_location\"]}') |
| 118 | + print('Detection: OK') |
| 119 | + " |
| 120 | + - name: Tear down |
| 121 | + if: always() |
| 122 | + run: cd /tmp/fresh-install-ci && docker compose down -v 2>/dev/null || true |
| 123 | + |
55 | 124 | auto-tag: |
56 | 125 | if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
57 | | - needs: [lint, fresh-install-macos] |
| 126 | + needs: [lint, fresh-install-macos, fresh-install-docker] |
58 | 127 | runs-on: ubuntu-latest |
59 | 128 | permissions: |
60 | 129 | contents: write |
|
0 commit comments