56 lines
1.7 KiB
YAML
56 lines
1.7 KiB
YAML
name: Docker Compose Action
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Run docker compose
|
|
uses: hoverkraft-tech/compose-action@8be2d741e891ac9b8ac20825e6f3904149599925 # v2.2.0
|
|
with:
|
|
compose-file: "./docker-compose.yml"
|
|
|
|
- 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: Install notes app
|
|
run: |
|
|
docker compose exec app php occ app:enable notes
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt update -y && sudo apt install -y pipx
|
|
pipx install uv
|
|
uv sync
|
|
env:
|
|
DEBIAN_FRONTEND: "noninteractive"
|
|
|
|
# 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 python -m pytest
|