Skip to content

Commit

Permalink
chore(root): Tweak test.yml (#5667)
Browse files Browse the repository at this point in the history
* chore(root): Tweak test.yml

- Restore affected checks
- Polish step definitions

* fixup! chore(root): Tweak test.yml
  • Loading branch information
SokratisVidros authored Jun 3, 2024
1 parent af998c9 commit c065680
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 44 deletions.
1 change: 0 additions & 1 deletion .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ runs:
shell: bash
run: pnpm install --frozen-lockfile


- name: Link submodules
shell: bash
if: ${{ inputs.submodules == 'true' }}
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/reusable-web-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,8 @@ on:
jobs:
# This workflow contains a single job called "build"
e2e_web:
if: "!contains(github.event.head_commit.message, 'ci skip')"

strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Dashboard hanging ...
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
fail-fast: true
matrix:
# run 5 copies of the current job in parallel
containers: [1, 2, 3, 4, 5]
Expand Down
69 changes: 33 additions & 36 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,28 +115,8 @@ jobs:
echo "test-libs=$(pnpm run get-affected test origin/${{steps.get-base-branch-name.outputs.branch}} libs | tail -n +5)" >> $GITHUB_OUTPUT
fi
test_web:
name: Test Web Playwright
needs: [get-affected]
# if: ${{ contains(fromJson(needs.get-affected.outputs.test-cypress), '@novu/web') }}
if: contains(github.event.pull_request.labels.*.name, 'run-e2e')
uses: ./.github/workflows/reusable-web-e2e.yml
secrets: inherit
with:
ee: true

test_widget:
name: Test Widget Cypress
needs: [get-affected]
uses: ./.github/workflows/reusable-widget-e2e.yml
with:
ee: true
if: contains(github.event.pull_request.labels.*.name, 'run-e2e')
# if: ${{ contains(fromJson(needs.get-affected.outputs.test-cypress), '@novu/widget') || contains(fromJson(needs.get-affected.outputs.test-unit), '@novu/notification-center') || contains(fromJson(needs.get-affected.outputs.test-unit), '@novu/ws') }}
secrets: inherit

test_providers:
name: Unit Test Providers
test_unit_providers:
name: Unit test @novu/providers
runs-on: ubuntu-latest
needs: [get-affected]
if: ${{ fromJson(needs.get-affected.outputs.test-providers)[0] }}
Expand All @@ -153,8 +133,8 @@ jobs:
parallel: 5
projects: ${{join(fromJson(needs.get-affected.outputs.test-providers), ',')}}

test_packages:
name: Unit Test Packages
test_unit_packages:
name: Unit test @novu/* public NPM packages (except providers)
runs-on: ubuntu-latest
needs: [get-affected]
if: ${{ fromJson(needs.get-affected.outputs.test-packages)[0] }}
Expand All @@ -165,20 +145,15 @@ jobs:
deployments: write
id-token: write
steps:
- name: Display Test Packages
- name: Affected packages
run: echo '${{ needs.get-affected.outputs.test-packages }}'

- name: Checkout Code
uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Setup Project
uses: ./.github/actions/setup-project
- uses: ./.github/actions/setup-project
with:
slim: 'true'

- name: Setup Redis Cluster
uses: ./.github/actions/setup-redis-cluster

- name: Run Lint, Build, Test
uses: mansagroup/nrwl-nx-action@v3
env:
Expand All @@ -187,16 +162,20 @@ jobs:
targets: lint,build,test
projects: ${{join(fromJson(needs.get-affected.outputs.test-packages), ',')}}

test_libs:
name: Unit Test Libs
test_unit_libs:
name: Unit test internal novu lib packages
runs-on: ubuntu-latest
needs: [get-affected]
if: ${{ fromJson(needs.get-affected.outputs.test-libs)[0] }}
timeout-minutes: 80
steps:
- run: echo '${{ needs.get-affected.outputs.test-libs }}'
- name: Affected libs
run: echo '${{ needs.get-affected.outputs.test-libs }}'
- uses: actions/checkout@v3

- uses: ./.github/actions/setup-project

- name: Run Lint, Build, Test
- uses: mansagroup/nrwl-nx-action@v3
with:
targets: lint,build,test
Expand All @@ -205,7 +184,6 @@ jobs:
test_unit_api:
name: Test API
needs: [get-affected]
if: contains(github.event.pull_request.labels.*.name, 'run-e2e')
strategy:
# The order is important for ee to be first, otherwise outputs not work correctly
matrix:
Expand All @@ -218,6 +196,7 @@ jobs:
job-name: ${{ matrix.name }}
secrets: inherit

# TODO: Merge this step with test_unit_api
test_unit:
name: Unit Test
runs-on: ubuntu-latest
Expand Down Expand Up @@ -267,3 +246,21 @@ jobs:
launch_darkly_sdk_key: ${{ secrets.LAUNCH_DARKLY_SDK_KEY }}

- uses: ./.github/actions/validate-openapi

test_e2e_web:
name: Test E2E Web
needs: [get-affected]
if: ${{ contains(fromJson(needs.get-affected.outputs.test-cypress), '@novu/web') }}
uses: ./.github/workflows/reusable-web-e2e.yml
secrets: inherit
with:
ee: true

test_e2e_widget:
name: Test E2E Widget
needs: [get-affected]
uses: ./.github/workflows/reusable-widget-e2e.yml
with:
ee: true
if: ${{ contains(fromJson(needs.get-affected.outputs.test-cypress), '@novu/widget') || contains(fromJson(needs.get-affected.outputs.test-unit), '@novu/notification-center') || contains(fromJson(needs.get-affected.outputs.test-unit), '@novu/ws') }}
secrets: inherit

0 comments on commit c065680

Please sign in to comment.