Skip to content

chore: upgrade storybook #3280

chore: upgrade storybook

chore: upgrade storybook #3280

Workflow file for this run

name: Testing Pipeline
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
jobs:
dependency-review:
name: Dependency review
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Dependency Review'
uses: actions/dependency-review-action@v3
spellcheck:
name: Spell check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: streetsidesoftware/cspell-action@v2
get-affected:
name: Get Affected Packages
runs-on: ubuntu-latest
outputs:
test-unit: ${{ steps.get-projects-arrays.outputs.test-unit }}
test-e2e: ${{ steps.get-projects-arrays.outputs.test-e2e }}
test-e2e-ee: ${{ steps.get-projects-arrays.outputs.test-e2e-ee }}
test-cypress: ${{ steps.get-projects-arrays.outputs.test-cypress }}
test-providers: ${{ steps.get-projects-arrays.outputs.test-providers }}
test-packages: ${{ steps.get-projects-arrays.outputs.test-packages }}
test-libs: ${{ steps.get-projects-arrays.outputs.test-libs }}
permissions:
contents: read
packages: write
deployments: write
id-token: write
steps:
# Get current branch name
- name: Get branch name
id: branch-name
uses: tj-actions/[email protected]
# Get base branch name to compare with. Base branch on a PR, "main" branch on pushing.
- name: Get base branch name
id: get-base-branch-name
run: |
if [[ "${{github.event.pull_request.base.ref}}" != "" ]]; then
echo "::set-output name=branch::${{github.event.pull_request.base.ref}}"
else
echo "::set-output name=branch::main"
fi
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup-project
with:
slim: 'true'
# Configure Nx to be able to detect changes between branches when we are in a PR
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: ${{steps.get-base-branch-name.outputs.branch}}
- name: Get affected
id: get-projects-arrays
# When not in a PR and the current branch is main, pass --all flag. Otherwise pass the base branch
run: |
if [[ "${{github.event.pull_request.base.ref}}" == "" && "${{steps.branch-name.outputs.current_branch}}" == "main" ]]; then
echo "Running ALL"
echo "::set-output name=test-unit::$(pnpm run get-affected test:unit --all | tail -n +5)"
echo "::set-output name=test-e2e::$(pnpm run get-affected test:e2e --all | tail -n +5)"
echo "::set-output name=test-e2e-ee::$(pnpm run get-affected test:e2e:ee --all | tail -n +5)"
echo "::set-output name=test-cypress::$(pnpm run get-affected cypress:run --all | tail -n +5)"
echo "::set-output name=test-providers::$(pnpm run get-affected test --all providers | tail -n +5)"
echo "::set-output name=test-packages::$(pnpm run get-affected test --all packages | tail -n +5)"
echo "::set-output name=test-libs::$(pnpm run get-affected test --all libs | tail -n +5)"
else
echo "Running PR origin/${{steps.get-base-branch-name.outputs.branch}}"
echo "::set-output name=test-unit::$(pnpm run get-affected test origin/${{steps.get-base-branch-name.outputs.branch}} | tail -n +5)"
echo "::set-output name=test-e2e::$(pnpm run get-affected test:e2e origin/${{steps.get-base-branch-name.outputs.branch}} | tail -n +5)"
echo "::set-output name=test-e2e-ee::$(pnpm run get-affected test:e2e:ee origin/${{steps.get-base-branch-name.outputs.branch}} | tail -n +5)"
echo "::set-output name=test-cypress::$(pnpm run get-affected cypress:run origin/${{steps.get-base-branch-name.outputs.branch}} | tail -n +5)"
echo "::set-output name=test-providers::$(pnpm run get-affected test origin/${{steps.get-base-branch-name.outputs.branch}} providers | tail -n +5)"
echo "::set-output name=test-packages::$(pnpm run get-affected test origin/${{steps.get-base-branch-name.outputs.branch}} packages | tail -n +5)"
echo "::set-output name=test-libs::$(pnpm run get-affected test origin/${{steps.get-base-branch-name.outputs.branch}} libs | tail -n +5)"
fi
test_web:
name: Test Web Cypress
needs: [ get-affected ]
if: ${{ contains(fromJson(needs.get-affected.outputs.test-cypress), '@novu/web') }}
uses: ./.github/workflows/reusable-web-e2e.yml
secrets: inherit
test_widget:
name: Test Widget Cypress
needs: [ get-affected ]
uses: ./.github/workflows/reusable-widget-e2e.yml
if: ${{ contains(fromJson(needs.get-affected.outputs.test-cypress), '@novu/widget') || contains(fromJson(needs.get-affected.outputs.test-unit), '@novu/notification-center') }}
secrets: inherit
build_docker_api:
name: Build Docker API
runs-on: ubuntu-latest
timeout-minutes: 80
needs: [ get-affected ]
if: ${{ contains(fromJson(needs.get-affected.outputs.test-e2e), '@novu/api') }}
permissions:
contents: read
packages: write
deployments: write
id-token: write
strategy:
matrix:
name: [ 'novu/api', 'novu/api-ee' ]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-project
- uses: ./.github/actions/setup-redis-cluster
- uses: ./.github/actions/docker/build-api
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
fork: ${{ github.event.pull_request.head.repo.fork }}
docker_name: ${{ matrix.name }}
test_providers:
name: Unit Test Providers
runs-on: ubuntu-latest
needs: [get-affected]
if: ${{ fromJson(needs.get-affected.outputs.test-providers)[0] }}
timeout-minutes: 80
steps:
- run: echo '${{ needs.get-affected.outputs.test-providers }}'
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-project
with:
slim: 'true'
- uses: mansagroup/nrwl-nx-action@v3
with:
targets: lint,build,test
parallel: 5
projects: ${{join(fromJson(needs.get-affected.outputs.test-providers), ',')}}
test_packages:
name: Unit Test Packages
runs-on: ubuntu-latest
needs: [get-affected]
if: ${{ fromJson(needs.get-affected.outputs.test-packages)[0] }}
timeout-minutes: 80
permissions:
contents: read
packages: write
deployments: write
id-token: write
steps:
- run: echo '${{ needs.get-affected.outputs.test-packages }}'
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-project
with:
slim: 'true'
- uses: ./.github/actions/setup-redis-cluster
- uses: mansagroup/nrwl-nx-action@v3
env:
LOGGING_LEVEL: 'info'
with:
targets: lint,build,test
projects: ${{join(fromJson(needs.get-affected.outputs.test-packages), ',')}}
test_libs:
name: Unit Test Libs
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 }}'
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-project
- uses: mansagroup/nrwl-nx-action@v3
with:
targets: lint,build,test
projects: ${{join(fromJson(needs.get-affected.outputs.test-libs), ',')}}
test_e2e:
name: Test E2E
runs-on: ubuntu-latest
needs: [get-affected]
if: ${{ fromJson(needs.get-affected.outputs.test-e2e)[0] }}
timeout-minutes: 80
strategy:
# One job for each different project and node version
matrix:
projectName: ${{ fromJson(needs.get-affected.outputs.test-e2e) }}
permissions:
contents: read
packages: write
deployments: write
id-token: write
steps:
- run: echo ${{ matrix.projectName }}
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-project
- uses: ./.github/actions/setup-redis-cluster
- uses: mansagroup/nrwl-nx-action@v3
name: Lint and build
with:
targets: lint,build
projects: ${{matrix.projectName}}
- uses: ./.github/actions/start-localstack
- uses: ./.github/actions/run-worker
if: ${{matrix.projectName != '@novu/worker' }}
with:
launch_darkly_sdk_key: ${{ secrets.LAUNCH_DARKLY_SDK_KEY }}
- uses: mansagroup/nrwl-nx-action@v3
name: Running the E2E tests
env:
LAUNCH_DARKLY_SDK_KEY: ${{ secrets.LAUNCH_DARKLY_SDK_KEY }}
with:
targets: test:e2e
projects: ${{matrix.projectName}}
check_submodule_token:
name: Check if the secret exists or not.
runs-on: ubuntu-latest
outputs:
has_token: ${{ steps.secret-check.outputs.has_token }}
steps:
- name: Check if secret exists
id: secret-check
run: |
if [[ -n "${{ secrets.SUBMODULES_TOKEN }}" ]]; then
echo "::set-output name=has_token::true"
else
echo "::set-output name=has_token::false"
fi
test_e2e_ee:
name: Test E2E EE
runs-on: ubuntu-latest
needs: [get-affected, check_submodule_token]
if: ${{ fromJson(needs.get-affected.outputs.test-e2e-ee)[0] && needs.check_submodule_token.outputs.has_token == 'true' }}
timeout-minutes: 80
strategy:
# One job for each different project and node version
matrix:
projectName: ${{ fromJson(needs.get-affected.outputs.test-e2e-ee) }}
permissions:
contents: read
packages: write
deployments: write
id-token: write
steps:
- run: echo ${{ matrix.projectName }}
- uses: actions/checkout@v3
- uses: ./.github/actions/checkout-submodules
with:
submodule_token: ${{ secrets.SUBMODULES_TOKEN }}
submodule_branch: "next"
- uses: ./.github/actions/setup-project
- uses: ./.github/actions/setup-redis-cluster
- uses: mansagroup/nrwl-nx-action@v3
name: Lint and build
with:
targets: lint,build
projects: ${{matrix.projectName}}
- uses: ./.github/actions/start-localstack
- uses: ./.github/actions/run-worker
if: ${{matrix.projectName == '@novu/api' }}
with:
launch_darkly_sdk_key: ${{ secrets.LAUNCH_DARKLY_SDK_KEY }}
- uses: mansagroup/nrwl-nx-action@v3
name: Running the E2E tests
env:
LAUNCH_DARKLY_SDK_KEY: ${{ secrets.LAUNCH_DARKLY_SDK_KEY }}
GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
CI_EE_TEST: true
with:
targets: test:e2e:ee
projects: ${{matrix.projectName}}
test_unit:
name: Unit Test
runs-on: ubuntu-latest
needs: [get-affected]
if: ${{ fromJson(needs.get-affected.outputs.test-unit)[0] }}
timeout-minutes: 80
strategy:
# One job for each different project and node version
matrix:
projectName: ${{ fromJson(needs.get-affected.outputs.test-unit) }}
permissions:
contents: read
packages: write
deployments: write
id-token: write
steps:
- run: echo ${{ matrix.projectName }}
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-project
with:
# Don't run redis and etc... for other unit tests
slim: ${{ !contains(matrix.projectName, '@novu/api') && !contains(matrix.projectName, '@novu/worker') && !contains(matrix.projectName, '@novu/ws') && !contains(matrix.projectName, '@novu/inbound-mail')}}
- uses: ./.github/actions/setup-redis-cluster
- uses: mansagroup/nrwl-nx-action@v3
name: Lint and build and test
with:
targets: lint,build,test
projects: ${{matrix.projectName}}
validate_swagger:
name: Validate Swagger
runs-on: ubuntu-latest
needs: [get-affected]
if: ${{ fromJson(needs.get-affected.outputs.test-unit)[0] }}
timeout-minutes: 10
permissions:
contents: read
packages: write
deployments: write
id-token: write
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-project
- uses: ./.github/actions/setup-redis-cluster
- uses: ./.github/actions/run-api
with:
launch_darkly_sdk_key: ${{ secrets.LAUNCH_DARKLY_SDK_KEY }}
- uses: ./.github/actions/validate-swagger