From f7fe19a8e1409d118ec1b13648c78092a62016ca Mon Sep 17 00:00:00 2001 From: Roman Rodionov Date: Thu, 31 Oct 2024 18:46:43 +0100 Subject: [PATCH 1/6] - test gh actions to run tests with sharding --- .github/workflows/tests-gh-action.yml | 67 +++++++++++++++++++++++++++ ketcher-autotests/package.json | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/tests-gh-action.yml diff --git a/.github/workflows/tests-gh-action.yml b/.github/workflows/tests-gh-action.yml new file mode 100644 index 0000000000..554bf6a18e --- /dev/null +++ b/.github/workflows/tests-gh-action.yml @@ -0,0 +1,67 @@ +name: Test GH Actions +on: + push: + branches: + - master + - 'release/**' + pull_request: + branches: + - master + - 'release/**' +env: + # Warnings breaks build on CI + # See: https://github.com/orgs/community/discussions/25228#discussioncomment-3246960 + CI: false + MODE: standalone + KETCHER_URL: http://host.docker.internal:4002 + DOCKER: true + IGNORE_UNSTABLE_TESTS: true + CI_ENVIRONMENT: true + ENABLE_POLYMER_EDITOR: true + USE_SEPARATE_INDIGO_WASM: true +jobs: + playwright_tests_1: + timeout-minutes: 120 + runs-on: ubuntu-latest + strategy: + matrix: + shardIndex: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ] + shardTotal: [ 20 ] + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-node@v3 + with: + node-version: 18.12.0 + - name: Install dependencies + run: npm ci + - name: Build all packages + run: npm run build:packages && npm run build:example:standalone + - name: Run example in standalone mode + run: cd example/ && nohup npm run serve:standalone & + - name: Create env file + run: | + cd ketcher-autotests + echo "DOCKER=true" > .env + echo "KETCHER_URL=$KETCHER_URL" >> .env + echo "MODE=$MODE" >> .env + echo "IGNORE_UNSTABLE_TESTS=$IGNORE_UNSTABLE_TESTS" >> .env + echo "CI_ENVIRONMENT=$CI_ENVIRONMENT" >> .env + echo "ENABLE_POLYMER_EDITOR=$ENABLE_POLYMER_EDITOR" >> .env + echo "USE_SEPARATE_INDIGO_WASM=$USE_SEPARATE_INDIGO_WASM" >> .env + - name: Build autotests for docker + run: cd ketcher-autotests && npm run docker:build + - name: Run playwright tests in docker + run: cd ketcher-autotests && npm run docker:test -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} + + - uses: actions/upload-artifact@v3 + # run even if previous steps fails + if: always() + with: + name: playwright-report + path: ketcher-autotests/playwright-report/ + retention-days: 5 + - name: Remove unused docker images + if: always() + run: docker system prune -f diff --git a/ketcher-autotests/package.json b/ketcher-autotests/package.json index 3471724501..03caa7c8f8 100644 --- a/ketcher-autotests/package.json +++ b/ketcher-autotests/package.json @@ -16,7 +16,7 @@ "prettier:write": "prettier --write \"./**/*.{js,ts}\" ", "docker": "docker-compose run --rm autotests", "docker:build": "docker-compose build autotests", - "docker:test": "npm run docker npx playwright test", + "docker:test": "npm run docker npx playwright test --", "docker:trace": "npm run docker npm run test:trace", "docker:update": "npm run docker npm run test:update", "docker:update:test": "npm run docker -- npx playwright test --update-snapshots -g" From 2fa44ca9603e68418289d9db7a8979943f5f0bf8 Mon Sep 17 00:00:00 2001 From: Roman Rodionov Date: Thu, 31 Oct 2024 19:07:28 +0100 Subject: [PATCH 2/6] - test --- .github/workflows/tests-gh-action.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/tests-gh-action.yml b/.github/workflows/tests-gh-action.yml index 554bf6a18e..aff6791ef8 100644 --- a/.github/workflows/tests-gh-action.yml +++ b/.github/workflows/tests-gh-action.yml @@ -34,6 +34,12 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.12.0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Install Docker Compose + run: | + sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r .tag_name)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose - name: Install dependencies run: npm ci - name: Build all packages From 8e47306521123013de121c03d4f13ea902b95cb0 Mon Sep 17 00:00:00 2001 From: Roman Rodionov Date: Mon, 4 Nov 2024 16:46:14 +0100 Subject: [PATCH 3/6] - reduced timeout and shards amount --- .github/workflows/tests-gh-action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests-gh-action.yml b/.github/workflows/tests-gh-action.yml index aff6791ef8..0cd2a12dc9 100644 --- a/.github/workflows/tests-gh-action.yml +++ b/.github/workflows/tests-gh-action.yml @@ -21,12 +21,12 @@ env: USE_SEPARATE_INDIGO_WASM: true jobs: playwright_tests_1: - timeout-minutes: 120 + timeout-minutes: 60 runs-on: ubuntu-latest strategy: matrix: - shardIndex: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ] - shardTotal: [ 20 ] + shardIndex: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] + shardTotal: [ 10 ] steps: - uses: actions/checkout@v3 with: From c35138ae22b47720d017023b550b9b2439ddc791 Mon Sep 17 00:00:00 2001 From: Roman Rodionov Date: Mon, 4 Nov 2024 17:29:40 +0100 Subject: [PATCH 4/6] - set fail-fast: false - fixed docker compose issue --- .github/workflows/tests-gh-action.yml | 7 +------ ketcher-autotests/package.json | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests-gh-action.yml b/.github/workflows/tests-gh-action.yml index 0cd2a12dc9..9ad797a8c1 100644 --- a/.github/workflows/tests-gh-action.yml +++ b/.github/workflows/tests-gh-action.yml @@ -27,6 +27,7 @@ jobs: matrix: shardIndex: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] shardTotal: [ 10 ] + fail-fast: false steps: - uses: actions/checkout@v3 with: @@ -34,12 +35,6 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.12.0 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Install Docker Compose - run: | - sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r .tag_name)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose - sudo chmod +x /usr/local/bin/docker-compose - name: Install dependencies run: npm ci - name: Build all packages diff --git a/ketcher-autotests/package.json b/ketcher-autotests/package.json index 03caa7c8f8..3bd30f094f 100644 --- a/ketcher-autotests/package.json +++ b/ketcher-autotests/package.json @@ -14,7 +14,7 @@ "check:lint": "eslint .", "lint:fix": "eslint . --fix", "prettier:write": "prettier --write \"./**/*.{js,ts}\" ", - "docker": "docker-compose run --rm autotests", + "docker": "docker compose run --rm autotests", "docker:build": "docker-compose build autotests", "docker:test": "npm run docker npx playwright test --", "docker:trace": "npm run docker npm run test:trace", From 86eb20442529332649f0dc6b58c57e278257676d Mon Sep 17 00:00:00 2001 From: Roman Rodionov Date: Mon, 4 Nov 2024 17:46:50 +0100 Subject: [PATCH 5/6] - fixed docker compose issue --- ketcher-autotests/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ketcher-autotests/package.json b/ketcher-autotests/package.json index 3bd30f094f..643c695f27 100644 --- a/ketcher-autotests/package.json +++ b/ketcher-autotests/package.json @@ -15,7 +15,7 @@ "lint:fix": "eslint . --fix", "prettier:write": "prettier --write \"./**/*.{js,ts}\" ", "docker": "docker compose run --rm autotests", - "docker:build": "docker-compose build autotests", + "docker:build": "docker compose build autotests", "docker:test": "npm run docker npx playwright test --", "docker:trace": "npm run docker npm run test:trace", "docker:update": "npm run docker npm run test:update", From f066fd3a9bd8fd380b0c03f9a67e7d7c676713f0 Mon Sep 17 00:00:00 2001 From: Roman Rodionov Date: Fri, 8 Nov 2024 17:44:53 +0100 Subject: [PATCH 6/6] - added shards --- .github/workflows/tests-gh-action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-gh-action.yml b/.github/workflows/tests-gh-action.yml index 9ad797a8c1..7a9a838c92 100644 --- a/.github/workflows/tests-gh-action.yml +++ b/.github/workflows/tests-gh-action.yml @@ -25,8 +25,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - shardIndex: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] - shardTotal: [ 10 ] + shardIndex: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ] + shardTotal: [ 20 ] fail-fast: false steps: - uses: actions/checkout@v3