Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions .github/workflows/container_testing_run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: container-testing-run

on:
push:
branches:
- develop
paths-ignore:
- 'doc/**'
- '**/*.md'
- '**/*.txt'
- '.github/ISSUE_TEMPLATE/**'
- '.github/*.md'
pull_request:
branches:
- develop
paths-ignore:
- 'doc/**'
- '**/*.md'
- '**/*.txt'
- '.github/ISSUE_TEMPLATE/**'
- '.github/*.md'

concurrency:
group: container-testing-${{ github.ref }}
cancel-in-progress: true

jobs:
container-test:
runs-on: ubuntu-latest
timeout-minutes: 45

defaults:
run:
shell: bash

steps:
# ---------------------------
# CHECKOUT
# ---------------------------
- name: Checkout repository
uses: actions/checkout@v4

# ---------------------------
# SCRUB RUNNER
# ---------------------------
- name: Scrub Docker state
run: |
set -euo pipefail
sudo systemctl stop docker || true
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scrub Docker state stops the Docker daemon and wipes Docker/containerd state, but the workflow never starts Docker again. On GitHub-hosted runners this will usually cause the later docker version / docker compose steps to fail; add a systemctl start docker (and wait for readiness) or avoid stopping Docker in the first place.

Suggested change
sudo rm -rf /var/lib/containerd
sudo rm -rf /var/lib/containerd
sudo systemctl start docker
# Wait for Docker daemon to become ready
for i in {1..30}; do
if docker info >/dev/null 2>&1; then
break
fi
sleep 1
done

Copilot uses AI. Check for mistakes.

# Ubuntu runner already has Docker installed.
- name: Verify Docker
run: |
set -euo pipefail
docker version

# ---------------------------
# BUILD + START CONTAINERS
# ---------------------------
- name: Build containers
run: |
set -euo pipefail
docker compose -f docker-compose-dev.yml build

- name: Start containers
run: |
set -euo pipefail
docker compose -f docker-compose-dev.yml up -d
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker-compose-dev.yml is a dev-focused compose file and bind-mounts ./target/dataverse into the container. This workflow never builds/populates ./target/dataverse, so on CI the mount will be empty and will override whatever is in the image at that path, likely preventing the app from deploying and making the readiness check fail. Use a CI-friendly compose file (e.g., without the dev bind mounts) or add the build step that produces the expected artifacts.

Copilot uses AI. Check for mistakes.

# ---------------------------
# WAIT FOR DATAVERSE (STRICT API CHECK)
# ---------------------------
- name: Wait for Dataverse API readiness
run: |
set -euo pipefail

URL="http://localhost:8080/api/info/version"
MAX_ATTEMPTS=6
SLEEP_TIME=10

echo "Checking Dataverse API readiness at $URL"

for attempt in $(seq 1 $MAX_ATTEMPTS); do
echo "Attempt $attempt..."

RESPONSE=$(curl -s --max-time 10 "$URL" || true)

if echo "$RESPONSE" | grep -q '"status":"OK"'; then
echo "Dataverse API is ready."
echo "Response: $RESPONSE"
exit 0
fi

echo "Not ready yet. Sleeping ${SLEEP_TIME}s..."
sleep $SLEEP_TIME

# Exponential backoff (10 → 20 → 40 → 60 → 60 → 60)
if [ $SLEEP_TIME -lt 60 ]; then
SLEEP_TIME=$((SLEEP_TIME * 2))
if [ $SLEEP_TIME -gt 60 ]; then
SLEEP_TIME=60
fi
fi
done

echo "Dataverse failed to report status OK within timeout."
docker compose -f docker-compose-dev.yml logs
exit 1

# ---------------------------
# SETUP PYTHON + SELENIUM
# ---------------------------
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install test dependencies
run: |
set -euo pipefail
python -m pip install --upgrade pip
pip install -r tests/requirements.txt
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow installs Python deps from tests/requirements.txt, but that file is not present in the repo, so this step will fail. Update this to an existing dependency source (or add the missing file) before enabling the workflow.

Suggested change
pip install -r tests/requirements.txt
pip install -r requirements.txt

Copilot uses AI. Check for mistakes.

# Chrome is preinstalled on ubuntu-latest
- name: Verify Chrome
run: |
google-chrome --version

# ---------------------------
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After setting up Python and verifying Chrome, there is no step that actually runs any container/integration/UI tests (the workflow proceeds to shutdown). Add an explicit test execution step here (or remove the Python/Chrome setup if the workflow is only intended as a container smoke-start check).

Suggested change
# ---------------------------
# ---------------------------
# RUN CONTAINER/UI TESTS
# ---------------------------
- name: Run container/UI tests
run: |
set -euo pipefail
pytest -v
# ---------------------------

Copilot uses AI. Check for mistakes.
# SHUTDOWN
# ---------------------------
- name: Shutdown containers
if: always()
run: |
docker compose -f docker-compose-dev.yml down -v

- name: Final Docker cleanup
if: always()
run: |
docker system prune -af || true
Loading