From c81ab26da0acc9e7afa5f05519d858f86ba5a92b Mon Sep 17 00:00:00 2001 From: Petr Jasek Date: Mon, 8 Apr 2024 11:35:06 +0200 Subject: [PATCH] fix e2e - drop old service config - use docker for server - clean up github actions - setup dependabot for e2e package --- .github/dependabot.yml | 4 ++++ .github/workflows/ci-e2e.yml | 29 +++++++++-------------------- .travis-docker-compose.yml | 22 ---------------------- e2e/docker-compose.yml | 8 +++++++- e2e/package.json | 10 +++++----- scripts/ci-start-services.sh | 2 +- scripts/ci-wait-for-services.sh | 3 +++ 7 files changed, 29 insertions(+), 49 deletions(-) delete mode 100644 .travis-docker-compose.yml create mode 100755 scripts/ci-wait-for-services.sh diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3d9999646..bea731cd2 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,6 +9,10 @@ updates: directory: "/" # Location of package manifests schedule: interval: "weekly" + - package-ecosystem: "npm" # See documentation for possible values + directory: "e2e" # Location of package manifests + schedule: + interval: "weekly" - package-ecosystem: "pip" # See documentation for possible values directory: "/" # Location of package manifests schedule: diff --git a/.github/workflows/ci-e2e.yml b/.github/workflows/ci-e2e.yml index bfbb17250..d46146a57 100644 --- a/.github/workflows/ci-e2e.yml +++ b/.github/workflows/ci-e2e.yml @@ -8,43 +8,32 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8'] node-version: ['14'] e2e: ['a', 'b'] env: - INSTALL_NODE_MODULES: true - RUN_SERVICES: true E2E: true TZ: Australia/Sydney + CYPRESS_SCREENSHOTS_FOLDER: /tmp/cypress steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: 'server/requirements.txt' - - name: Setup Environment - run: ./scripts/ci-install.sh - - name: Build Client + cache: npm + - run: | + npm install + npm build + docker compose up -d + ./ci-wait-for-services.sh working-directory: ./e2e - run: npm run build - - name: Start Services - run: ./scripts/ci-start-services.sh - name: E2E Suite A if: matrix.e2e == 'a' working-directory: ./e2e run: npm run cypress-ci -- --spec "cypress/e2e/events/*.cy.ts" - env: - CYPRESS_SCREENSHOTS_FOLDER: /tmp/cypress - name: E2E Suite B if: matrix.e2e == 'b' working-directory: ./e2e run: npm run cypress-ci -- --spec "cypress/e2e/!(events)/*.cy.ts|cypress/e2e/workqueue.cy.ts" - env: - CYPRESS_SCREENSHOTS_FOLDER: /tmp/cypress - name: Upload screenshots if: ${{ failure() }} uses: actions/upload-artifact@v2 diff --git a/.travis-docker-compose.yml b/.travis-docker-compose.yml deleted file mode 100644 index 9faf1b02f..000000000 --- a/.travis-docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: "2.4" -services: - redis: - image: redis:alpine - ports: - - "6379:6379" - - mongo: - image: mongo:3.6 - ports: - - "27017:27017" - tmpfs: - - /data/db - - elastic: - image: elasticsearch:7.6.2 - ports: - - "9200:9200" - environment: - - discovery.type=single-node - tmpfs: - - /usr/share/elasticsearch/data diff --git a/e2e/docker-compose.yml b/e2e/docker-compose.yml index b0e8eaab5..d6f9c8123 100644 --- a/e2e/docker-compose.yml +++ b/e2e/docker-compose.yml @@ -2,11 +2,13 @@ version: "3.8" services: elastic: - image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2 + image: docker.elastic.co/elasticsearch/elasticsearch:7.17.18 environment: - discovery.type=single-node networks: - e2e + ports: + - "9200:9200" tmpfs: - /usr/share/elasticsearch/data @@ -14,11 +16,15 @@ services: image: redis:alpine networks: - e2e + ports: + - "6379:6379" mongo: image: mongo:4 networks: - e2e + ports: + - "27017:27017" tmpfs: - /data/db diff --git a/e2e/package.json b/e2e/package.json index 4652fb99b..c44d2d81e 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -6,14 +6,14 @@ "superdesk-planning": "file:../" }, "devDependencies": { - "@superdesk/build-tools": "^1.0.14", + "@superdesk/build-tools": "^1.0.19", "cypress": "^12.6.0", - "cypress-real-events": "^1.7.6", + "cypress-real-events": "^1.12.0", "cypress-terminal-report": "^5.0.2", "extract-text-webpack-plugin": "3.0.2", - "lodash": "^4.17.15", - "moment": "^2.29.4", - "moment-timezone": "^0.5.42" + "lodash": "^4.17.21", + "moment": "^2.30.1", + "moment-timezone": "^0.5.45" }, "scripts": { "cypress-ui": "cypress open", diff --git a/scripts/ci-start-services.sh b/scripts/ci-start-services.sh index 4cf286dec..6e9b1ccdd 100755 --- a/scripts/ci-start-services.sh +++ b/scripts/ci-start-services.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash if [ "$RUN_SERVICES" == "true" ]; then - docker compose -f .travis-docker-compose.yml up -d + docker compose -f ./e2e/docker-compose.yml up elastic redis mongo -d while ! curl -sfo /dev/null 'http://localhost:9200/'; do echo -n '.' && sleep .5; done fi diff --git a/scripts/ci-wait-for-services.sh b/scripts/ci-wait-for-services.sh new file mode 100755 index 000000000..2f19e0496 --- /dev/null +++ b/scripts/ci-wait-for-services.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +while ! curl -sfo /dev/null 'http://localhost:9200/'; do echo -n '.' && sleep .5; done \ No newline at end of file