Marc Kupietz | bfb2301 | 2025-06-03 15:47:10 +0200 | [diff] [blame] | 1 | # GitLab CI/CD configuration for KorAP E2E Tests |
| 2 | # This pipeline runs end-to-end tests against a KorAP instance |
| 3 | |
| 4 | stages: |
| 5 | - test |
| 6 | |
| 7 | variables: |
| 8 | # Default test configuration |
| 9 | KORAP_URL: "https://korap.ids-mannheim.de/" |
| 10 | KORAP_QUERIES: 'geht, [orth=geht & tt/p="VVFIN"]' |
Marc Kupietz | 43769d4 | 2025-06-14 12:05:01 +0200 | [diff] [blame] | 11 | KORAP_MIN_TOKENS_IN_CORPUS: "22000000000" |
Marc Kupietz | bfb2301 | 2025-06-03 15:47:10 +0200 | [diff] [blame] | 12 | LC_ALL: "C" |
| 13 | |
| 14 | # Node.js configuration |
| 15 | NODE_ENV: "test" |
| 16 | |
| 17 | # Main E2E test job |
| 18 | e2e_tests: |
| 19 | stage: test |
| 20 | image: node:bullseye |
| 21 | |
| 22 | # Install system dependencies required for Puppeteer |
| 23 | before_script: |
| 24 | - apt-get update |
| 25 | - apt-get install -y |
| 26 | wget |
| 27 | gnupg |
| 28 | ca-certificates |
| 29 | fonts-liberation |
| 30 | libasound2 |
| 31 | libatk-bridge2.0-0 |
| 32 | libatk1.0-0 |
| 33 | libc6 |
| 34 | libcairo2 |
| 35 | libcups2 |
| 36 | libdbus-1-3 |
| 37 | libexpat1 |
| 38 | libfontconfig1 |
| 39 | libgbm1 |
| 40 | libgcc1 |
| 41 | libglib2.0-0 |
| 42 | libgtk-3-0 |
| 43 | libnspr4 |
| 44 | libnss3 |
| 45 | libpango-1.0-0 |
| 46 | libpangocairo-1.0-0 |
| 47 | libstdc++6 |
| 48 | libx11-6 |
| 49 | libx11-xcb1 |
| 50 | libxcb1 |
| 51 | libxcomposite1 |
| 52 | libxcursor1 |
| 53 | libxdamage1 |
| 54 | libxext6 |
| 55 | libxfixes3 |
| 56 | libxi6 |
| 57 | libxrandr2 |
| 58 | libxrender1 |
| 59 | libxss1 |
| 60 | libxtst6 |
| 61 | lsb-release |
| 62 | wget |
| 63 | xdg-utils |
| 64 | - npm install |
| 65 | |
| 66 | script: |
| 67 | - echo "Running KorAP E2E tests against $KORAP_URL" |
| 68 | - npm run test:ci |
| 69 | |
| 70 | after_script: |
| 71 | - echo "Test execution completed, checking for test results..." |
| 72 | - ls -la test-results.xml || echo "No test-results.xml found" |
| 73 | |
| 74 | # Use CI variables for sensitive data |
| 75 | variables: |
| 76 | KORAP_LOGIN: $KORAP_USERNAME # Set this in GitLab CI/CD Variables |
| 77 | KORAP_PWD: $KORAP_PASSWORD # Set this in GitLab CI/CD Variables |
| 78 | SLACK_WEBHOOK_URL: $SLACK_WEBHOOK # Optional: Set for Slack notifications |
| 79 | |
| 80 | # Generate test artifacts - always keep results even on test failure |
| 81 | artifacts: |
| 82 | when: always # Collect artifacts on success, failure, and cancellation |
| 83 | reports: |
| 84 | junit: test-results.xml # GitLab will parse this for test reporting |
| 85 | paths: |
| 86 | - "test-results.xml" # Keep the raw XML file as well |
| 87 | - "failed_*.png" # Screenshots of failed tests |
| 88 | expire_in: 1 week |
| 89 | |
| 90 | # Retry on failure (network issues, etc.) |
| 91 | retry: |
| 92 | max: 2 |
| 93 | when: |
| 94 | - unknown_failure |
| 95 | - api_failure |
| 96 | - runner_system_failure |
| 97 | |
| 98 | # Pipeline trigger rules |
| 99 | rules: |
| 100 | - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH |
| 101 | - if: $CI_PIPELINE_SOURCE == "merge_request_event" |
| 102 | - if: $CI_PIPELINE_SOURCE == "schedule" # Allow scheduled runs |
| 103 | - when: manual |
| 104 | |
| 105 | # Set timeout |
| 106 | timeout: 5 minutes |
| 107 | |
| 108 | # Optional: Scheduled test job for regular monitoring |
| 109 | scheduled_tests: |
| 110 | extends: e2e_tests |
| 111 | rules: |
| 112 | - if: $CI_PIPELINE_SOURCE == "schedule" |
| 113 | variables: |
| 114 | SLACK_WEBHOOK_URL: $SLACK_WEBHOOK # Enable notifications for scheduled runs |