name: Docker Compose Action on: pull_request: branches: - master jobs: linting: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Install the latest version of uv uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6 - name: Check format run: | uv run --frozen ruff format --diff - name: Linting run: | uv run --frozen ruff check integration-test: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Run docker compose uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0 with: compose-file: "./docker-compose.yml" - name: Install the latest version of uv uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6 - name: Wait for service to be ready run: | echo "Waiting for service at http://localhost:8080/ocs/v2.php/apps/serverinfo/api/v1/info to return 401..." max_attempts=60 attempt=0 until curl -o /dev/null -s -w "%{http_code}\n" http://localhost:8080/ocs/v2.php/apps/serverinfo/api/v1/info | grep -q "401"; do attempt=$((attempt + 1)) if [ $attempt -ge $max_attempts ]; then echo "Service did not become ready in time." exit 1 fi echo "Attempt $attempt/$max_attempts: Service not ready, sleeping for 5 seconds..." sleep 5 done echo "Service is ready (returned 401)." - name: Verify required apps are installed and ready run: | echo "Checking if required Nextcloud apps are installed and ready..." # Check Notes app echo "Checking Notes app..." max_attempts=30 attempt=0 until curl -u admin:admin -s -w "%{http_code}\n" -o /dev/null http://localhost:8080/apps/notes/api/v1/settings | grep -q "200"; do attempt=$((attempt + 1)) if [ $attempt -ge $max_attempts ]; then echo "Notes app not ready after $max_attempts attempts." exit 1 fi echo "Notes app attempt $attempt/$max_attempts: Not ready, sleeping for 3 seconds..." sleep 3 done echo "Notes app is ready." # Check Tables app echo "Checking Tables app..." attempt=0 until curl -u admin:admin -H 'OCS-APIRequest: true' -s -w "%{http_code}\n" -o /dev/null http://localhost:8080/ocs/v2.php/apps/tables/api/2/tables | grep -q "200"; do attempt=$((attempt + 1)) if [ $attempt -ge $max_attempts ]; then echo "Tables app not ready after $max_attempts attempts." exit 1 fi echo "Tables app attempt $attempt/$max_attempts: Not ready, sleeping for 3 seconds..." sleep 3 done echo "Tables app is ready." # Check Calendar app (CalDAV endpoint) echo "Checking Calendar app..." attempt=0 until curl -u admin:admin -s -w "%{http_code}\n" -o /dev/null -X PROPFIND http://localhost:8080/remote.php/dav/calendars/admin | grep -E "20[0-9]"; do attempt=$((attempt + 1)) if [ $attempt -ge $max_attempts ]; then echo "Calendar app not ready after $max_attempts attempts." # Debug output echo "Final calendar check response:" curl -u admin:admin -v -X PROPFIND http://localhost:8080/remote.php/dav/calendars/admin exit 1 fi echo "Calendar app attempt $attempt/$max_attempts: Not ready, sleeping for 5 seconds..." sleep 5 done echo "Calendar app is ready." # Additional verification - wait longer for CalDAV to be fully ready echo "Waiting additional 10 seconds for CalDAV service to stabilize..." sleep 10 echo "All required apps are installed and ready!" # Add subsequent steps here, e.g., running tests - name: Run tests env: NEXTCLOUD_HOST: "http://localhost:8080" NEXTCLOUD_USERNAME: "admin" NEXTCLOUD_PASSWORD: "admin" run: | uv run --frozen python -m pytest