Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Add worfklow to use autoscaling runners #6147

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ff075a4
Add worfklow to use autoscaling runners
AlexanderSavelyev Dec 12, 2024
9bda578
update playwright version
AlexanderSavelyev Dec 12, 2024
734c6da
fix macro tests execution
AlexanderSavelyev Dec 13, 2024
afc8dae
try to use shards
AlexanderSavelyev Dec 13, 2024
4d5105f
disable trace
AlexanderSavelyev Dec 13, 2024
5f03231
skip the toggle tests for now
AlexanderSavelyev Dec 13, 2024
f8e5be3
make trace off for ci
AlexanderSavelyev Dec 13, 2024
9e2a174
ignore long running tests for now
AlexanderSavelyev Dec 14, 2024
1031351
add report only on fail
AlexanderSavelyev Dec 14, 2024
8dcec5c
return back skiped tests
AlexanderSavelyev Dec 14, 2024
bd9d333
fix commands to run ketcher inside
AlexanderSavelyev Dec 14, 2024
434c825
disable long running
AlexanderSavelyev Dec 15, 2024
5ebf7c6
disable slow test. try dot
AlexanderSavelyev Dec 15, 2024
d27d4b3
disable log
AlexanderSavelyev Dec 15, 2024
0e943c7
disable 25 min test. Make new shards
AlexanderSavelyev Dec 15, 2024
ebcb984
playwright_tests_micro (1, 3) tests corrected and screenshots updated
AlexeyGirin Dec 16, 2024
5b98113
playwright_tests_micro (3, 3) tests corrected and screenshots updated
AlexeyGirin Dec 16, 2024
330233b
playwright-report-macromolecules-1 tests corrected and screenshots up…
AlexeyGirin Dec 16, 2024
0d708d0
playwright-report-macromolecules-2 tests corrected and screenshots up…
AlexeyGirin Dec 16, 2024
66bb8f5
Horisontal split for connection-rules-for-chems-monomers and connecti…
AlexeyGirin Dec 16, 2024
75d4c77
Merge branch 'master' of https://github.com/epam/ketcher into github_…
AlexeyGirin Dec 16, 2024
6d73d0c
Adding missing screenshots
AlexeyGirin Dec 17, 2024
9683c9d
Fix for flack tests
AlexeyGirin Dec 17, 2024
de45c3d
Always make a report and 60 mins timeout
AlexeyGirin Dec 17, 2024
c5d6ab9
fullyParallel parameter made isCI dependent
AlexeyGirin Dec 17, 2024
8a77f99
connection-rules-for-chems-monomers-3 screens correction and other
AlexeyGirin Dec 17, 2024
8b44bc6
fix num workers
AlexanderSavelyev Dec 17, 2024
a6b6f5e
fix run wait to start
AlexanderSavelyev Dec 17, 2024
e94f458
fix unstable test
AlexanderSavelyev Dec 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
10 changes: 2 additions & 8 deletions .github/workflows/playwright-macromolecules.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
name: Playwright Tests Macromolecules
on:
push:
branches:
- master
- 'release/**'
pull_request:
branches:
- master
- 'release/**'
workflow_dispatch:

env:
# Warnings breaks build on CI
# See: https://github.com/orgs/community/discussions/25228#discussioncomment-3246960
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
name: Playwright Tests
on:
push:
branches:
- master
- 'release/**'
pull_request:
branches:
- master
- 'release/**'
workflow_dispatch:

env:
# Warnings breaks build on CI
# See: https://github.com/orgs/community/discussions/25228#discussioncomment-3246960
Expand Down
172 changes: 172 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: Run Playwright Tests
on:
push:
branches:
- master
- 'release/**'
pull_request:
branches:
- master
- 'release/**'
workflow_dispatch:

env:
# Warnings breaks build on CI
# See: https://github.com/orgs/community/discussions/25228#discussioncomment-3246960
CI: false
MODE: standalone
KETCHER_URL: http://127.0.0.1:4002
DOCKER: true
IGNORE_UNSTABLE_TESTS: true
CI_ENVIRONMENT: true
USE_SEPARATE_INDIGO_WASM: true
jobs:
build_ketcher_micro:
runs-on: ubuntu-latest
container: node:18.14-bullseye-slim
env:
ENABLE_POLYMER_EDITOR: false
steps:
- name: Install dependencies
run: apt-get update -y && apt-get install -y git
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Git safe
run: git config --global --add safe.directory '*'
- name: Install NPM dependencies
run: npm ci
- name: Build all packages
run: npm run build:packages && npm run build:example:standalone
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ketcher-dist-micro
path: example/dist
build_ketcher_macro:
runs-on: ubuntu-latest
container: node:18.14-bullseye-slim
env:
ENABLE_POLYMER_EDITOR: true
steps:
- name: Install dependencies
run: apt-get update -y && apt-get install -y git
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Git safe
run: git config --global --add safe.directory '*'
- name: Install NPM dependencies
run: npm ci
- name: Build all packages
run: npm run build:packages && npm run build:example:standalone
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ketcher-dist-macro
path: example/dist
playwright_tests_micro:
timeout-minutes: 60
runs-on: self-hosted-a
needs: build_ketcher_micro
container: mcr.microsoft.com/playwright:v1.44.1-jammy
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3]
shardTotal: [3]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Install dependencies
run: npm ci
- name: Create folder for dist
run: mkdir -p example/dist
- name: Download compiled ketcher
uses: actions/download-artifact@v3
with:
name: ketcher-dist-micro
path: example/dist/
- name: Create env file
env:
ENABLE_POLYMER_EDITOR: false
run: |
cat > ketcher-autotests/.env << EOF
DOCKER=true
KETCHER_URL=$KETCHER_URL
MODE=$MODE
IGNORE_UNSTABLE_TESTS=$IGNORE_UNSTABLE_TESTS
CI_ENVIRONMENT=$CI_ENVIRONMENT
USE_SEPARATE_INDIGO_WASM=$USE_SEPARATE_INDIGO_WASM
ENABLE_POLYMER_EDITOR=$ENABLE_POLYMER_EDITOR
EOF
- name: Run tests
run: |
cd example/ && nohup npm run serve:standalone &
cd ketcher-autotests/
npm i
npx playwright install chromium
npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- uses: actions/upload-artifact@v3
# run even if previous steps fails
if: always()
with:
name: playwright-report-micro-${{ matrix.shardIndex }}
path: ketcher-autotests/playwright-report/
retention-days: 5

playwright_tests_macro:
timeout-minutes: 60
runs-on: self-hosted-a
needs: build_ketcher_macro
container: mcr.microsoft.com/playwright:v1.44.1-jammy
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2]
shardTotal: [2]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Install dependencies
run: npm ci
- name: Create folder for dist
run: mkdir -p example/dist
- name: Download compiled ketcher
uses: actions/download-artifact@v3
with:
name: ketcher-dist-macro
path: example/dist/
- name: Create env file
env:
ENABLE_POLYMER_EDITOR: true
run: |
cat > ketcher-autotests/.env << EOF
DOCKER=true
KETCHER_URL=$KETCHER_URL
MODE=$MODE
IGNORE_UNSTABLE_TESTS=$IGNORE_UNSTABLE_TESTS
CI_ENVIRONMENT=$CI_ENVIRONMENT
USE_SEPARATE_INDIGO_WASM=$USE_SEPARATE_INDIGO_WASM
ENABLE_POLYMER_EDITOR=$ENABLE_POLYMER_EDITOR
EOF
- name: Run tests
run: |
cd example/ && nohup npm run serve:standalone &
cd ketcher-autotests/
npm i
npx playwright install chromium
npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- uses: actions/upload-artifact@v3
# run even if previous steps fails
if: always()
with:
name: playwright-report-macromolecules-${{ matrix.shardIndex }}
path: ketcher-autotests/playwright-report/
retention-days: 5
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ yarn-error.log*

.vscode
/.idea
nohup.out
ketcher-autotests/results.json

.pnp.*
.yarn/*
Expand Down
9 changes: 4 additions & 5 deletions ketcher-autotests/.env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
KETCHER_URL=http://host.docker.internal:4002
# KETCHER_URL=http://localhost:4002
# KETCHER_URL=http://host.docker.internal:5173
KETCHER_URL=http://localhost:4002
MODE="standalone"
DOCKER=true
IGNORE_UNSTABLE_TESTS=true
GENERATE_DATA=false
ENABLE_POLYMER_EDITOR = false
CI_ENVIRONMENT=false
ENABLE_POLYMER_EDITOR=false
CI_ENVIRONMENT=false
NUM_WORKERS=8
6 changes: 0 additions & 6 deletions ketcher-autotests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@

FROM node:18-alpine
FROM mcr.microsoft.com/playwright:v1.44.1-jammy

WORKDIR /app

COPY . .

RUN npm i && npx playwright install chromium
5 changes: 5 additions & 0 deletions ketcher-autotests/Dockerfile-ketcher
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM node:18.14-bullseye-slim

RUN apt-get update -y && apt-get install -y git

WORKDIR /ketcher
46 changes: 40 additions & 6 deletions ketcher-autotests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,10 @@ selectNestedTool - select specific tool that has sub / nested levels.
- DOCKER=true
- KETCHER_URL
- Rc: KETCHER_URL=link_to_rc
- Local frontend: KETCHER_URL=http://host.docker.internal:port (port where you run application)
- Local frontend: KETCHER_URL=http://localhost:4002
- OPTIONAL: IGNORE_UNSTABLE_TESTS=true (if you want to ignore unstable tests)
- OPTIONAL: ENABLE_POLYMER_EDITOR=true (If you want to run tests for Macromolecule Editor)
- **OPTIONAL: Build frontend**:
if you want to run tests based on the localhost:4002, you can put KETCHER_URL=http://localhost:4002
- OPTIONAL: NUM_WORKERS=8 (default=num cpus, if you want to define custom number of workers)

### Run tests:

Expand All @@ -115,13 +114,12 @@ Also make sure, that test is not skipped! Check if test starts with
`test.skip('We test something', async ({ page }) => {`
Remove "skip" before running.

- **Run app in browser: from root directory "ketcher"**:
- **Build ketcher: from root directory "ketcher"**:

- `npm ci`
- `npm run build`
- `npm run serve`

- **Run docker**:
- **Run tests using docker**:

- `cd ketcher-autotests`
- `npm run docker:build`
Expand All @@ -146,6 +144,42 @@ Run this command in the directory "ketcher-autotests"
- `npm run docker:update file_name:N` update specific test in a file (N - line on which test starts)
- `npm run docker:update:test -- "test_title"` update only 1 snapshot with test_title

### Testing without installed NPM

If no NPM installed (only docker) to build ketcher the same compiler as on CI platforms, use the following command

Build Ketcher

```
docker-compose build ketcher
docker-compose run --rm --user $(id -u) ketcher bash /app/test_build.sh
```

Prepare tests

```
docker-compose build autotests
docker-compose run --rm --user $(id -u) autotests bash /app/test_prepare.sh
```

Run tests

```
docker-compose run --rm --user $(id -u) autotests bash /app/test_run.sh
```

Run pattern

```
docker-compose run --rm --user $(id -u) autotests bash /app/test_run.sh -g "Cut the reaction"
```

Run update

```
docker-compose run --rm --user $(id -u) autotests bash /app/test_run.sh -g "Cut the reaction" --update-snapshots
```

### Known issues

The "file name too long" error in Git is related to the maximum length of file names in the operating system. In most cases, this happens on Windows systems, where the maximum path length to a file is 260 characters.
Expand Down
23 changes: 18 additions & 5 deletions ketcher-autotests/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
version: '3'
services:
ketcher:
build:
context: ./reporters/
dockerfile: ../Dockerfile-ketcher
env_file:
.env
volumes:
- ./:/app
- ../:/ketcher
autotests:
build:
context: .
context: ./reporters/
dockerfile: ../Dockerfile
container_name: ketcher-autotest
env_file:
.env
network_mode: "host"
extra_hosts:
- "host.docker.internal:host-gateway"
# network_mode: "host"
# extra_hosts:
# - "host.docker.internal:host-gateway"
# ports:
# - "4002:4002"
volumes:
- ./:/app
- /app/node_modules
- ../:/ketcher
11 changes: 5 additions & 6 deletions ketcher-autotests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
"check:lint": "eslint .",
"lint:fix": "eslint . --fix",
"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: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"
"docker:build": "docker-compose build autotests && docker-compose run --rm autotests bash /app/test_prepare.sh",
"docker:test": "docker-compose run --rm autotests bash /app/test_run.sh",
"docker:trace": "docker-compose run --rm autotests bash /app/test_run.sh --trace on",
"docker:update": "docker-compose run --rm autotests bash /app/test_run.sh --update-snapshots",
"docker:update:test": "docker-compose run --rm autotests bash /app/test_run.sh --update-snapshots -g"
},
"author": "Nitvex",
"license": "ISC",
Expand Down
Loading
Loading