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

feat(tests): move e2e tests for consultation-portal to their app #17008

Open
wants to merge 10 commits into
base: main
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
**/*.log
**/tmp/
**/temp/
**/.next/

# Outputs
**/dist/
Expand Down
223 changes: 147 additions & 76 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ jobs:

outputs:
TEST_CHUNKS: ${{ steps.test_projects.outputs.CHUNKS }}
E2E_CI_CHUNKS: ${{ steps.e2e_ci_projects.outputs.CHUNKS }}
E2E_CHUNKS: ${{ steps.e2e_projects.outputs.CHUNKS }}
E2E_CI_BUILD_ID: ${{ steps.e2e_ci_projects.outputs.BUILD_ID }}
E2E_BUILD_ID: ${{ steps.e2e_projects.outputs.BUILD_ID }}
LINT_CHUNKS: ${{ steps.lint_projects.outputs.CHUNKS }}
BUILD_CHUNKS: ${{ steps.build_projects.outputs.CHUNKS }}
Expand Down Expand Up @@ -141,13 +143,25 @@ jobs:
echo "CHUNKS={\"projects\":$CHUNKS}" >> "$GITHUB_OUTPUT"
fi

- name: Prepare e2e-ci targets
id: e2e_ci_projects
env:
CHUNK_SIZE: 1
run: |
set -euo pipefail
CHUNKS="$(./scripts/ci/generate-chunks.sh e2e-ci)"
if [[ "$CHUNKS" != "[]" ]]; then
echo "CHUNKS={\"projects\":$CHUNKS}" >> "$GITHUB_OUTPUT"
fi
echo BUILD_ID="$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER-$(uuidgen)" >> "$GITHUB_OUTPUT"

- name: Prepare e2e targets
id: e2e_projects
env:
CHUNK_SIZE: 1
run: |
set -euo pipefail
CHUNKS="$(./scripts/ci/generate-chunks.sh e2e-ci)"
CHUNKS="$(./scripts/ci/generate-chunks.sh e2e)"
if [[ "$CHUNKS" != "[]" ]]; then
echo "CHUNKS={\"projects\":$CHUNKS}" >> "$GITHUB_OUTPUT"
fi
Expand All @@ -172,23 +186,71 @@ jobs:
set -euo pipefail
node -r esbuild-register .github/actions/check-team-approval.ts release-managers
tests:
if: false
runs-on: ec2-runners
steps:
- run: echo "This step won't run"
# needs:
# - prepare
# if: needs.prepare.outputs.TEST_CHUNKS
# runs-on: ec2-runners
# container:
# image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
# timeout-minutes: 45
# env:
# AFFECTED_PROJECTS: ${{ matrix.projects }}
# MAX_JOBS: 1
# strategy:
# fail-fast: false
# matrix: ${{ fromJson(needs.prepare.outputs.TEST_CHUNKS) }}
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0

# - uses: actions/setup-node@v4
# with:
# node-version-file: 'package.json'

# - name: Setup yarn
# run: corepack enable

# - name: Get cache
# id: get-cache
# uses: ./.github/actions/get-cache
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# keys: ${{ needs.prepare.outputs.CACHE_KEYS }}
# enable-cache: 'node_modules,cypress,generated-files'

# - uses: ./.github/actions/unit-test
# with:
# dd-api-key: '${{ secrets.DD_API_KEY }}'
# codecov-token: ${{ secrets.CODECOV_TOKEN }}
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# docker-registry: 821090935708.dkr.ecr.eu-west-1.amazonaws.com/

Comment on lines +189 to +233
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Remove commented-out code

Instead of keeping the commented-out test job configuration, consider removing it entirely since it's tracked in version control. If this code needs to be referenced later, it can be found in the git history.

🧰 Tools
🪛 actionlint (1.7.4)

190-190: label "ec2-runners" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "macos-12-xl", "macos-12-xlarge", "macos-12-large", "macos-12", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file

(runner-label)

e2e-ci:
needs:
- prepare
if: needs.prepare.outputs.TEST_CHUNKS
if: needs.prepare.outputs.E2E_CI_CHUNKS
runs-on: ec2-runners
container:
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
timeout-minutes: 45
env:
AFFECTED_PROJECTS: ${{ matrix.projects }}
MAX_JOBS: 1
AFFECTED_PROJECT: ${{ matrix.projects }}
CYPRESS_PROJECT_ID: 4q7jz8
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
API_MOCKS: 'true'
NODE_OPTIONS: --max-old-space-size=4096
E2E_CI_BUILD_ID: '${{ needs.prepare.outputs.E2E_CI_BUILD_ID }}-${{ github.run_attempt }}'
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.TEST_CHUNKS) }}
matrix: ${{ fromJson(needs.prepare.outputs.E2E_CI_CHUNKS) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
Expand All @@ -205,13 +267,8 @@ jobs:
keys: ${{ needs.prepare.outputs.CACHE_KEYS }}
enable-cache: 'node_modules,cypress,generated-files'

- uses: ./.github/actions/unit-test
with:
dd-api-key: '${{ secrets.DD_API_KEY }}'
codecov-token: ${{ secrets.CODECOV_TOKEN }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
docker-registry: 821090935708.dkr.ecr.eu-west-1.amazonaws.com/
- name: Running e2e tests
run: ./scripts/ci/40_e2e.sh "${AFFECTED_PROJECT}"

e2e:
needs:
Expand All @@ -220,12 +277,9 @@ jobs:
runs-on: ec2-runners
container:
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
timeout-minutes: 45
timeout-minutes: 35
env:
AFFECTED_PROJECT: ${{ matrix.projects }}
CYPRESS_PROJECT_ID: 4q7jz8
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
API_MOCKS: 'true'
NODE_OPTIONS: --max-old-space-size=4096
E2E_BUILD_ID: '${{ needs.prepare.outputs.E2E_BUILD_ID }}-${{ github.run_attempt }}'
strategy:
Expand All @@ -246,11 +300,17 @@ jobs:
uses: ./.github/actions/get-cache
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
keys: ${{ needs.prepare.outputs.CACHE_KEYS }}
enable-cache: 'node_modules,cypress,generated-files'

- name: Building NodeJS dependencies
working-directory: infra
run: yarn install --immutable

- name: Running e2e tests
run: ./scripts/ci/40_e2e.sh "${AFFECTED_PROJECT}"
run: yarn e2e "${AFFECTED_PROJECT}"

- name: Stop and Clean Docker Compose
run: docker compose down
Comment on lines +305 to +313
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider error handling for Docker Compose cleanup

The Docker Compose cleanup step should handle potential failures gracefully.

- run: docker compose down
+ run: docker compose down || true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Building NodeJS dependencies
working-directory: infra
run: yarn install --immutable
- name: Running e2e tests
run: ./scripts/ci/40_e2e.sh "${AFFECTED_PROJECT}"
run: yarn e2e "${AFFECTED_PROJECT}"
- name: Stop and Clean Docker Compose
run: docker compose down
- name: Building NodeJS dependencies
working-directory: infra
run: yarn install --immutable
- name: Running e2e tests
run: yarn e2e "${AFFECTED_PROJECT}"
- name: Stop and Clean Docker Compose
run: docker compose down || true


linting-workspace:
needs:
Expand Down Expand Up @@ -334,68 +394,76 @@ jobs:
./infra/scripts/ci/git-check-dirty.sh "/" "nx format:write" "dirtybot"

linting:
needs:
- prepare
if: false
runs-on: ec2-runners
container:
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
timeout-minutes: 35
if: needs.prepare.outputs.LINT_CHUNKS
env:
AFFECTED_PROJECTS: ${{ matrix.projects }}
NODE_OPTIONS: --max-old-space-size=4096
MAX_JOBS: 3
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.LINT_CHUNKS) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- name: Setup yarn
run: corepack enable
- name: Get cache
id: get-cache
uses: ./.github/actions/get-cache
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
keys: ${{ needs.prepare.outputs.CACHE_KEYS }}
enable-cache: 'node_modules,generated-files'
- name: Linting
run: ./scripts/ci/run-in-parallel-native.sh lint
- run: echo "This step won't run"
# needs:
# - prepare
# runs-on: ec2-runners
# container:
# image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
# timeout-minutes: 35
# if: needs.prepare.outputs.LINT_CHUNKS
# env:
# AFFECTED_PROJECTS: ${{ matrix.projects }}
# NODE_OPTIONS: --max-old-space-size=4096
# MAX_JOBS: 3
# strategy:
# fail-fast: false
# matrix: ${{ fromJson(needs.prepare.outputs.LINT_CHUNKS) }}
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version-file: 'package.json'
# - name: Setup yarn
# run: corepack enable
# - name: Get cache
# id: get-cache
# uses: ./.github/actions/get-cache
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# keys: ${{ needs.prepare.outputs.CACHE_KEYS }}
# enable-cache: 'node_modules,generated-files'
# - name: Linting
# run: ./scripts/ci/run-in-parallel-native.sh lint

build:
needs:
- prepare
if: false
runs-on: ec2-runners
container:
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
timeout-minutes: 35
env:
AFFECTED_PROJECTS: ${{ matrix.projects }}
MAX_JOBS: 2
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.BUILD_CHUNKS) }}
if: needs.prepare.outputs.BUILD_CHUNKS
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- name: Setup yarn
run: corepack enable
- name: Get cache
id: get-cache
uses: ./.github/actions/get-cache
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
keys: ${{ needs.prepare.outputs.CACHE_KEYS }}
enable-cache: 'node_modules,generated-files'

- name: Building
run: ./scripts/ci/run-in-parallel-native.sh build
- run: echo "This step won't run"
# needs:
# - prepare
# runs-on: ec2-runners
# container:
# image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
# timeout-minutes: 35
# env:
# AFFECTED_PROJECTS: ${{ matrix.projects }}
# MAX_JOBS: 2
# strategy:
# fail-fast: false
# matrix: ${{ fromJson(needs.prepare.outputs.BUILD_CHUNKS) }}
# if: needs.prepare.outputs.BUILD_CHUNKS
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version-file: 'package.json'
# - name: Setup yarn
# run: corepack enable
# - name: Get cache
# id: get-cache
# uses: ./.github/actions/get-cache
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# keys: ${{ needs.prepare.outputs.CACHE_KEYS }}
# enable-cache: 'node_modules,generated-files'

# - name: Building
# run: ./scripts/ci/run-in-parallel-native.sh build

success:
runs-on: ec2-runners
Expand All @@ -410,12 +478,15 @@ jobs:
- run-shellcheck
- formatting
- e2e
- e2e-ci
- build
steps:
- name: Check prepare success
run: '[[ ${{ needs.prepare.result }} == "success" ]] || exit 1'
- name: Check tests success
run: '[[ ${{ needs.tests.result }} != "failure" ]] || exit 1'
- name: Check e2e-ci success
run: '[[ ${{ needs.e2e-ci.result }} != "failure" ]] || exit 1'
- name: Check e2e success
run: '[[ ${{ needs.e2e.result }} != "failure" ]] || exit 1'
- name: Check linting success
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ testem.log
/typings
/debug.log
*.log
docker-compose.yml

# System Files
.DS_Store
Expand Down
Loading
Loading