Add gitlab ci script
Change-Id: I0d4d2a0a934b4a47f0e778fbb83f6307fc0a752a
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..ae9025a
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,113 @@
+# GitLab CI/CD configuration for KorAP E2E Tests
+# This pipeline runs end-to-end tests against a KorAP instance
+
+stages:
+ - test
+
+variables:
+ # Default test configuration
+ KORAP_URL: "https://korap.ids-mannheim.de/"
+ KORAP_QUERIES: 'geht, [orth=geht & tt/p="VVFIN"]'
+ LC_ALL: "C"
+
+ # Node.js configuration
+ NODE_ENV: "test"
+
+# Main E2E test job
+e2e_tests:
+ stage: test
+ image: node:bullseye
+
+ # Install system dependencies required for Puppeteer
+ before_script:
+ - apt-get update
+ - apt-get install -y
+ wget
+ gnupg
+ ca-certificates
+ fonts-liberation
+ libasound2
+ libatk-bridge2.0-0
+ libatk1.0-0
+ libc6
+ libcairo2
+ libcups2
+ libdbus-1-3
+ libexpat1
+ libfontconfig1
+ libgbm1
+ libgcc1
+ libglib2.0-0
+ libgtk-3-0
+ libnspr4
+ libnss3
+ libpango-1.0-0
+ libpangocairo-1.0-0
+ libstdc++6
+ libx11-6
+ libx11-xcb1
+ libxcb1
+ libxcomposite1
+ libxcursor1
+ libxdamage1
+ libxext6
+ libxfixes3
+ libxi6
+ libxrandr2
+ libxrender1
+ libxss1
+ libxtst6
+ lsb-release
+ wget
+ xdg-utils
+ - npm install
+
+ script:
+ - echo "Running KorAP E2E tests against $KORAP_URL"
+ - npm run test:ci
+
+ after_script:
+ - echo "Test execution completed, checking for test results..."
+ - ls -la test-results.xml || echo "No test-results.xml found"
+
+ # Use CI variables for sensitive data
+ variables:
+ KORAP_LOGIN: $KORAP_USERNAME # Set this in GitLab CI/CD Variables
+ KORAP_PWD: $KORAP_PASSWORD # Set this in GitLab CI/CD Variables
+ SLACK_WEBHOOK_URL: $SLACK_WEBHOOK # Optional: Set for Slack notifications
+
+ # Generate test artifacts - always keep results even on test failure
+ artifacts:
+ when: always # Collect artifacts on success, failure, and cancellation
+ reports:
+ junit: test-results.xml # GitLab will parse this for test reporting
+ paths:
+ - "test-results.xml" # Keep the raw XML file as well
+ - "failed_*.png" # Screenshots of failed tests
+ expire_in: 1 week
+
+ # Retry on failure (network issues, etc.)
+ retry:
+ max: 2
+ when:
+ - unknown_failure
+ - api_failure
+ - runner_system_failure
+
+ # Pipeline trigger rules
+ rules:
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+ - if: $CI_PIPELINE_SOURCE == "schedule" # Allow scheduled runs
+ - when: manual
+
+ # Set timeout
+ timeout: 5 minutes
+
+# Optional: Scheduled test job for regular monitoring
+scheduled_tests:
+ extends: e2e_tests
+ rules:
+ - if: $CI_PIPELINE_SOURCE == "schedule"
+ variables:
+ SLACK_WEBHOOK_URL: $SLACK_WEBHOOK # Enable notifications for scheduled runs