mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Merge branch 'addPlaywrightTrigger' into 'main'
Add trigger to call Playwright test pipeline via webhook. See merge request soapbox-pub/ditto!725
This commit is contained in:
commit
23112ee438
4 changed files with 120 additions and 1 deletions
|
|
@ -1,6 +1,15 @@
|
||||||
|
.git
|
||||||
.env
|
.env
|
||||||
|
.env.*
|
||||||
*.cpuprofile
|
*.cpuprofile
|
||||||
*.swp
|
*.swp
|
||||||
|
*.log
|
||||||
|
node_modules
|
||||||
|
cov_profile
|
||||||
deno-test.xml
|
deno-test.xml
|
||||||
|
|
||||||
/data
|
/data
|
||||||
|
Dockerfile
|
||||||
|
Dockerfile.*
|
||||||
|
.dockerignore
|
||||||
|
.gitlab-ci.yml
|
||||||
|
|
@ -5,7 +5,10 @@ default:
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
|
- e2e-setup
|
||||||
|
- e2e-test
|
||||||
|
|
||||||
|
# Original test stage
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
timeout: 2 minutes
|
timeout: 2 minutes
|
||||||
|
|
@ -29,3 +32,55 @@ test:
|
||||||
- deno-test.xml
|
- deno-test.xml
|
||||||
reports:
|
reports:
|
||||||
junit: deno-test.xml
|
junit: deno-test.xml
|
||||||
|
|
||||||
|
# Start E2E environment
|
||||||
|
e2e-environment:
|
||||||
|
stage: e2e-setup
|
||||||
|
image: docker/compose:latest
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
|
variables:
|
||||||
|
DOCKER_HOST: tcp://docker:2375
|
||||||
|
DOCKER_TLS_CERTDIR: ""
|
||||||
|
DOCKER_DRIVER: overlay2
|
||||||
|
script:
|
||||||
|
- docker compose -f docker-compose.test.yml up -d --build
|
||||||
|
# Wait for ditto instance to become active
|
||||||
|
- end=$((SECONDS + 30)); while [[ $SECONDS -lt $end ]] && ! curl http://localhost:4036; do echo "Waiting for localhost:4036..."; sleep 1; echo $SECONDS ; done
|
||||||
|
# Generate dynamic child pipeline configuration
|
||||||
|
- |
|
||||||
|
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
|
||||||
27
Dockerfile.test
Normal file
27
Dockerfile.test
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
FROM denoland/deno:2.2.2
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install curl and Rust for nak installation
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
curl \
|
||||||
|
jq \
|
||||||
|
unzip \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Copy the application files
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Install soapbox
|
||||||
|
RUN deno task soapbox
|
||||||
|
|
||||||
|
# Generate NSEC at build time
|
||||||
|
RUN export DITTO_NSEC=$(deno task nsec) && \
|
||||||
|
echo "export DITTO_NSEC=$DITTO_NSEC" > /app/nsec.env
|
||||||
|
|
||||||
|
ENV DATABASE_URL=""
|
||||||
|
|
||||||
|
EXPOSE 4036
|
||||||
|
|
||||||
|
# Use array form with shell -c to properly handle the command
|
||||||
|
CMD ["/bin/sh", "-c", ". /app/nsec.env && deno run -A /app/packages/ditto/server.ts"]
|
||||||
28
docker-compose.test.yml
Normal file
28
docker-compose.test.yml
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:16
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: postgres
|
||||||
|
POSTGRES_HOST_AUTH_METHOD: trust
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
ditto:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile.test
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:postgres@postgres:5432/postgres
|
||||||
|
- RUST_BACKTRACE=1
|
||||||
|
ports:
|
||||||
|
- "4036:4036"
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
Loading…
Add table
Reference in a new issue