mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
111 lines
No EOL
2.9 KiB
YAML
111 lines
No EOL
2.9 KiB
YAML
image: denoland/deno:2.2.2
|
|
|
|
default:
|
|
interruptible: true
|
|
|
|
stages:
|
|
- test
|
|
- e2e-setup
|
|
- e2e-test
|
|
|
|
# Original test stage
|
|
test:
|
|
stage: test
|
|
timeout: 2 minutes
|
|
script:
|
|
- deno fmt --check
|
|
- deno task lint
|
|
- deno task check
|
|
- deno task test --ignore=packages/transcode --coverage=cov_profile
|
|
- deno coverage cov_profile
|
|
coverage: /All files[^\|]*\|[^\|]*\s+([\d\.]+)/
|
|
services:
|
|
- postgres:16
|
|
variables:
|
|
DITTO_NSEC: nsec1zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs4rm7hz
|
|
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
RUST_BACKTRACE: 1
|
|
artifacts:
|
|
when: always
|
|
paths:
|
|
- deno-test.xml
|
|
reports:
|
|
junit: deno-test.xml
|
|
|
|
# Start E2E environment
|
|
e2e-environment:
|
|
stage: e2e-setup
|
|
image: ubuntu:22.04
|
|
before_script:
|
|
## Temporary - Utilize this approach while debugging docker-in-docker networking quirks.
|
|
# Install required packages
|
|
- apt update
|
|
- apt install -y ca-certificates curl
|
|
|
|
# Install docker via helper script
|
|
- curl -fsSL https://get.docker.com | bash
|
|
|
|
# Start Docker daemon in background, redirect logs
|
|
- dockerd > /tmp/dockerd.log 2>&1 &
|
|
|
|
# Wait until Docker daemon is ready
|
|
- |
|
|
echo "Waiting for dockerd to be ready..."
|
|
timeout=30
|
|
waited=0
|
|
while ! grep -q 'API listen on /var/run/docker.sock' /tmp/dockerd.log; do
|
|
sleep 1
|
|
waited=$((waited + 1))
|
|
if [ $waited -ge $timeout ]; then
|
|
echo "❌ Timeout waiting for Docker daemon to start"
|
|
cat /tmp/dockerd.log
|
|
exit 1
|
|
fi
|
|
done
|
|
echo "✅ Docker daemon is ready"
|
|
script:
|
|
- docker compose -f docker-compose.test.yml up -d --build
|
|
- end=$((SECONDS + 30))
|
|
- |
|
|
while [[ $SECONDS -lt $end ]] && ! curl -fs http://localhost:4036 >/dev/null; do
|
|
echo "Waiting for localhost:4036..."
|
|
sleep 1
|
|
done
|
|
# Generate dynamic child pipeline config
|
|
- |
|
|
cat > child-pipeline.yml << EOF
|
|
playwright-tests:
|
|
trigger:
|
|
project: soapbox-pub/ditto-playwright
|
|
strategy: depend
|
|
variables:
|
|
BASE_URL: http://localhost:4036
|
|
CI_PROJECT_ID: ${CI_PROJECT_ID}
|
|
CI_MERGE_REQUEST_IID: ${CI_MERGE_REQUEST_IID}
|
|
CI_COMMIT_SHA: ${CI_COMMIT_SHA}
|
|
CI_COMMIT_SHORT_SHA: ${CI_COMMIT_SHORT_SHA}
|
|
CI_COMMIT_REF_NAME: ${CI_COMMIT_REF_NAME}
|
|
EOF
|
|
artifacts:
|
|
paths:
|
|
- child-pipeline.yml
|
|
only:
|
|
- merge_requests
|
|
|
|
# Trigger child pipeline
|
|
e2e-test:
|
|
stage: e2e-test
|
|
trigger:
|
|
include:
|
|
- artifact: child-pipeline.yml
|
|
job: e2e-environment
|
|
strategy: depend
|
|
needs:
|
|
- e2e-environment
|
|
variables:
|
|
BASE_URL: http://localhost:4036
|
|
# after_script:
|
|
# - docker compose -f docker-compose.test.yml down -v
|
|
only:
|
|
- merge_requests |