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

Split web driver e2e and screenshots action into two jobs #408

Open
wants to merge 1 commit into
base: rc
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/webdriver-test-using-docker-artifact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: 'Import docker artifact'
on:
workflow_call:
inputs:
artifacts-name:
required: true
type: string
artifacts-path:
required: true
type: string
wdio-spec:
required: true
type: string

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: ${{ inputs.artifacts-name }}
path: ${{ inputs.artifacts-path }}

- name: List downloaded files
run: ls ${{ inputs.artifacts-path }}

- name: Load Docker images
run: |
for file in ${{ inputs.artifacts-path }}/*.tar.gz; do
docker load < "$file"
done

- name: Run Docker containers
run: |
docker compose up -d
WDIO_SPEC=${{ inputs.wdio_spec }} docker compose run --rm wdio

- name: Archive screenshots
if: failure()
uses: actions/upload-artifact@v2
with:
name: visual-regression-screenshots
path: ./src/test/javascript/screenshots
60 changes: 50 additions & 10 deletions .github/workflows/webdriver-test.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,65 @@
name: Webdriver Test
name: Webdriver Tests

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
outputs:
DOCKER_IMAGES_FOLDER: ${{ steps.set_env.outputs.DOCKER_IMAGES_FOLDER }}
DOCKER_ARTIFACT_NAME: ${{ steps.set_env.outputs.DOCKER_ARTIFACT_NAME }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set env
id: set_env
run: |
echo "DOCKER_ARTIFACT_NAME=docker-images" >> "$GITHUB_OUTPUT"
echo "DOCKER_IMAGES_FOLDER=docker_images" >> "$GITHUB_OUTPUT"

- name: Build Docker images
run: docker compose build

- name: Run Docker containers
- name: Save Docker images
run: |
docker compose up -d
docker compose run --rm wdio
mkdir -p ${{ steps.set_env.outputs.DOCKER_IMAGES_FOLDER }}

images=$(docker images --format "{{.Repository}}")
# Loop through each image ID
echo "$images" | while IFS= read -r image; do
if [[ $image == oncokb* ]]; then
echo "$image"

# Save the image as a tar file
docker save -o "${{ steps.set_env.outputs.DOCKER_IMAGES_FOLDER }}/${image}.tar" $image

- name: Archive screenshots
if: failure()
uses: actions/upload-artifact@v2
# Gzip the tar file
gzip "${{ steps.set_env.outputs.DOCKER_IMAGES_FOLDER }}/${image}.tar"

echo "Gzipped ${image} to ${{ steps.set_env.outputs.DOCKER_IMAGES_FOLDER }}/${image}.tar.gz"
fi
done
shell: bash

- name: Upload Docker image artifact
uses: actions/upload-artifact@v3
with:
name: visual-regression-screenshots
path: ./src/test/javascript/screenshots
name: ${{ steps.set_env.outputs.DOCKER_ARTIFACT_NAME }}
path: ${{ steps.set_env.outputs.DOCKER_IMAGES_FOLDER }}/*.tar.gz

e2e-test:
uses: ./.github/workflows/webdriver-test-using-docker-artifact.yml
needs: build
with:
artifacts-name: ${{ needs.build.outputs.DOCKER_ARTIFACT_NAME }}
artifacts-path: ${{ needs.build.outputs.DOCKER_IMAGES_FOLDER }}
wdio-spec: e2e

screenshot-test:
uses: ./.github/workflows/webdriver-test-using-docker-artifact.yml
needs: build
with:
artifacts-name: ${{ needs.build.outputs.DOCKER_ARTIFACT_NAME }}
artifacts-path: ${{ needs.build.outputs.DOCKER_IMAGES_FOLDER }}
wdio-spec: screenshot
9 changes: 5 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
command: yarn start-tls DOCKER=true

wdio:
build:
build:
context: .
dockerfile: ./docker/app/Dockerfile
depends_on:
Expand All @@ -25,7 +25,8 @@ services:
environment:
- DOCKER=true
- FIREBASE_DATABASE_EMULATOR_HOST=firebase:9095
command: yarn run wdio
- WDIO_SPEC=${WDIO_SPEC}
command: yarn run wdio${WDIO_SPEC:+:$WDIO_SPEC}

firebase:
build:
Expand All @@ -38,12 +39,12 @@ services:
- "4400:4400"
healthcheck:
test: ["CMD", "curl", "http://localhost:4400"]
command: firebase emulators:start --import firebase --project oncokb-curation-test-54b6c # change config here
command: firebase emulators:start --import firebase --project oncokb-curation-test-54b6c # change config here

chrome:
image: seleniarm/standalone-chromium # for those with m1 processors
shm_size: 2g
healthcheck:
test: ["CMD", "/opt/bin/check-grid.sh", "--host", "0.0.0.0", "--port", "4444"]
ports:
- 4444:4444
- 4444:4444
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
"updateAPI": "openapi-generator-cli generate -i http://localhost:9090/v3/api-docs -g typescript-axios -o src/main/webapp/app/shared/api/generated/curation --type-mappings set=Array",
"updateCoreAPI": "curl http://localhost:8000/oncokb/api/v1/v2/api-docs?group=Private%20APIs | jq '.definitions.ResponseEntity.properties.statusCode.enum |= unique' > /tmp/updateCoreAPI.json && openapi-generator-cli generate -i /tmp/updateCoreAPI.json -g typescript-axios -o src/main/webapp/app/shared/api/generated/core --type-mappings List=any",
"wdio": "cross-env TS_NODE_PROJECT=src/test/javascript/tsconfig.json wdio run ./wdio.conf.ts",
"wdio:e2e": "cross-env TS_NODE_PROJECT=src/test/javascript/tsconfig.json wdio run ./wdio.conf.ts --spec ./src/test/javascript/spec/**/*.e2e.ts",
"wdio:screenshot": "cross-env TS_NODE_PROJECT=src/test/javascript/tsconfig.json wdio run ./wdio.conf.ts --spec ./src/test/javascript/spec/**/*.screenshot.ts",
"webapp:build": "yarn run clean-www && yarn run webapp:build:dev --",
"webapp:build:dev": "webpack --config webpack/webpack.dev.js --env stats=minimal",
"webapp:build:prod": "webpack --config webpack/webpack.prod.js --progress=profile",
Expand Down
Loading