Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/next' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
czerwonk committed Jan 12, 2024
2 parents 28bf9f1 + 7e5097b commit 0c6c04f
Show file tree
Hide file tree
Showing 1,214 changed files with 37,169 additions and 13,963 deletions.
29 changes: 25 additions & 4 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.2",
"language": "en",
"words": [
"cacheable",
"Springboot",
"tmproj",
"hgignore",
Expand Down Expand Up @@ -399,7 +400,6 @@
"nunito",
"codesee",
"ehlo",
"logrocket",
"backoff",
"isequal",
"Scriptable",
Expand Down Expand Up @@ -501,6 +501,8 @@
"nextjs",
"vanillajs",
"errmsg",
"devcontainer",
"INITDB",
"springboot",
"errmsg",
"shelljs",
Expand All @@ -516,17 +518,36 @@
"Myśliwiec",
"nestframework",
"ryver",
"idempotency",
"IDEMPOTENCY",
"idempotency",
"IDEMPOTENCY",
"Idempotency",
"Retryable",
"RETRYABLE",
"retryable",
"messagebird",
"Datetime",
"pubid",
"simpletexting",
"Simpletexting",
"Zulip",
"zulip",
"tspan",
"maildata"
"maildata",
"brevo",
"Getstream",
"getstream",
"upstash",
"Upstash",
"Krakend",
"ratelimit",
"Ratelimit",
"stdev",
"Stdev",
"openapi",
"headerapikey",
"INITDB",
"isend",
"Idand"
],
"flagWords": [],
"patterns": [
Expand Down
5 changes: 1 addition & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 16, 14, 12, 16-bullseye, 14-bullseye, 12-bullseye, 16-buster, 14-buster, 12-buster
ARG VARIANT=16-bullseye
ARG VARIANT=20-bullseye
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}

# Install MongoDB command line tools if on buster and x86_64 (arm64 not supported)
Expand All @@ -23,6 +23,3 @@ RUN . /etc/os-release \

# [Optional] Uncomment if you want to install more global node modules
RUN su node -c "npm install -g [email protected]"



4 changes: 2 additions & 2 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
# Update 'VARIANT' to pick an LTS version of Node.js: 16, 14, 12.
# Append -bullseye or -buster to pin to an OS version.
# Use -bullseye variants on local arm64/Apple Silicon.
VARIANT: 16-bullseye
VARIANT: 20-bullseye
volumes:
- ..:/workspace:cached

Expand All @@ -21,7 +21,7 @@ services:
# Uncomment the next line to use a non-root user for all processes.
# user: node

# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

db:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ body:
attributes:
label: node version
description: In case of self-hosting or local installation mention the node version. If using our cloud-managed solution, mention NA.
placeholder: 16.0.0
placeholder: 20.0.0
- type: textarea
id: additional-context
validations:
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/docker/build-api/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ runs:
docker tag novu-api ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
docker run --network=host --name api -dit --env NODE_ENV=test ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
docker run --network=host appropriate/curl --retry 10 --retry-delay 5 --retry-connrefused http://localhost:1337/v1/health-check | grep 'ok'
docker run --network=host appropriate/curl --retry 10 --retry-delay 5 --retry-connrefused http://127.0.0.1:1337/v1/health-check | grep 'ok'
echo "IMAGE=ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/docker/build-worker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ runs:
echo "Run image"
docker run --network=host --name worker -dit --env NODE_ENV=test ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
docker run --network=host appropriate/curl --retry 10 --retry-delay 5 --retry-connrefused http://localhost:1342/v1/health-check | grep 'ok'
docker run --network=host appropriate/curl --retry 10 --retry-delay 5 --retry-connrefused http://127.0.0.1:1342/v1/health-check | grep 'ok'
echo "IMAGE=ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/run-api/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ runs:

- name: Wait on API
shell: bash
run: wait-on --timeout=180000 http://localhost:1336/v1/health-check
run: wait-on --timeout=180000 http://127.0.0.1:1336/v1/health-check
4 changes: 2 additions & 2 deletions .github/actions/run-backend/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ runs:
NODE_ENV: "test"
PORT: "1336"
TZ: "UTC"
GITHUB_OAUTH_REDIRECT: "http://localhost:1336/v1/auth/github/callback"
GITHUB_OAUTH_REDIRECT: "http://127.0.0.1:1336/v1/auth/github/callback"
LAUNCH_DARKLY_SDK_KEY: ${{ inputs.launch_darkly_sdk_key }}
run: cd apps/api && pnpm start:build &

Expand All @@ -41,4 +41,4 @@ runs:

- name: Wait on API and Worker
shell: bash
run: wait-on --timeout=180000 http://localhost:1336/v1/health-check http://localhost:1342/v1/health-check
run: wait-on --timeout=180000 http://127.0.0.1:1336/v1/health-check http://127.0.0.1:1342/v1/health-check
2 changes: 1 addition & 1 deletion .github/actions/run-worker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ runs:

- name: Wait on worker
shell: bash
run: wait-on --timeout=180000 http://localhost:1342/v1/health-check
run: wait-on --timeout=180000 http://127.0.0.1:1342/v1/health-check
12 changes: 11 additions & 1 deletion .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ inputs:
description: 'Should only install dependencies and checkout code'
required: false
default: 'false'
submodules:
description: 'Should link submodules'
required: false
default: 'false'
outputs:
cypress_cache_hit:
description: 'Did cypress use binary cache'
Expand All @@ -28,7 +32,7 @@ runs:
- uses: actions/setup-node@v3
name: ⚙️ Setup Node Version
with:
node-version: '16.15.1'
node-version: '20.8.1'
cache: 'pnpm'

- name: 💵 Start Redis
Expand Down Expand Up @@ -61,6 +65,12 @@ runs:
shell: bash
run: pnpm install --frozen-lockfile


- name: Link submodules
shell: bash
if: ${{ inputs.submodules == 'true' }}
run: pnpm symlink:submodules

- name: Install wait-on plugin
shell: bash
run: pnpm i -g wait-on
4 changes: 2 additions & 2 deletions .github/actions/start-localstack/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ runs:
do
sleep 1
[[ counter -eq $max_retry ]] && echo "Failed!" && exit 1
aws --endpoint-url=http://localhost:4566 s3 ls
aws --endpoint-url=http://127.0.0.1:4566 s3 ls
echo "Trying again. Try #$counter"
((counter++))
done
docker-compose -f docker-compose.localstack.yml logs --tail="all"
aws --endpoint-url=http://localhost:4566 --cli-connect-timeout 600 s3 mb s3://novu-test
aws --endpoint-url=http://127.0.0.1:4566 --cli-connect-timeout 600 s3 mb s3://novu-test
18 changes: 18 additions & 0 deletions .github/actions/validate-openapi/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Validate OpenAPI

description: Validates the OpenAPI from the API

runs:
using: composite

steps:
- uses: mansagroup/nrwl-nx-action@v3
env:
PORT: '1336'
with:
targets: lint:openapi
projects: '@novu/api'

- name: Kill port for api 1336 for unit tests
shell: bash
run: sudo kill -9 $(sudo lsof -t -i:1336)
20 changes: 0 additions & 20 deletions .github/actions/validate-swagger/action.yml
Original file line number Diff line number Diff line change
@@ -1,20 +0,0 @@
name: Validate Swagger

description: Validates the swagger from the API

runs:
using: composite

steps:
- name: Get swagger json as file
shell: bash
run: |
curl -o swagger.json http://localhost:1336/api-json
- uses: char0n/swagger-editor-validate@v1
with:
definition-file: swagger.json

- name: Kill port for api 1336 for unit tests
shell: bash
run: sudo kill -9 $(sudo lsof -t -i:1336)
2 changes: 1 addition & 1 deletion .github/workflows/community-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20.8.1
- name: Install Octokit
run: npm --prefix .github/workflows/scripts install @octokit/action

Expand Down
73 changes: 20 additions & 53 deletions .github/workflows/dev-deploy-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,49 +24,10 @@ jobs:
name: ['novu/api-ee', 'novu/api']
uses: ./.github/workflows/reusable-api-e2e.yml
with:
ee: ${{ contains (matrix.name,'ee') }}
submodules: ${{ contains (matrix.name,'ee') }}
submodule_branch: "next"
ee: ${{ contains (matrix.name,'-ee') }}
job-name: ${{ matrix.name }}
secrets: inherit

test_e2e_ee:
name: Test E2E EE
runs-on: ubuntu-latest
timeout-minutes: 80
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/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}}

deploy_dev_api:
if: "!contains(github.event.head_commit.message, 'ci skip')"
# The type of runner that the job will run on
Expand All @@ -84,7 +45,13 @@ jobs:
name: ['novu/api-ee', 'novu/api']
steps:
- uses: actions/checkout@v3
with:
submodules: ${{ contains (matrix.name,'-ee') }}
token: ${{ secrets.SUBMODULES_TOKEN }}
- uses: ./.github/actions/setup-project
with:
submodules: ${{ contains (matrix.name,'-ee') }}

- uses: ./.github/actions/docker/build-api
id: docker_build
with:
Expand All @@ -95,37 +62,37 @@ jobs:
bullmq_secret: ${{ secrets.BULL_MQ_PRO_NPM_TOKEN }}

- name: Checkout cloud infra
if: ${{ contains (matrix.name,'ee') }}
if: ${{ contains (matrix.name,'-ee') }}
uses: actions/checkout@master
with:
repository: novuhq/cloud-infra
token: ${{ secrets.GH_PACKAGES }}
path: cloud-infra

- name: Configure AWS credentials
if: ${{ contains (matrix.name,'ee') }}
if: ${{ contains (matrix.name,'-ee') }}
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-2

- name: Terraform setup
if: ${{ contains (matrix.name,'ee') }}
if: ${{ contains (matrix.name,'-ee') }}
uses: hashicorp/setup-terraform@v1
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
terraform_version: 1.5.5
terraform_wrapper: false

- name: Terraform Init
if: ${{ contains (matrix.name,'ee') }}
working-directory: cloud-infra/terraform/novu
if: ${{ contains (matrix.name,'-ee') }}
working-directory: cloud-infra/terraform/novu/aws
run: terraform init

- name: Terraform get output
if: ${{ contains (matrix.name,'ee') }}
working-directory: cloud-infra/terraform/novu
if: ${{ contains (matrix.name,'-ee') }}
working-directory: cloud-infra/terraform/novu/aws
id: terraform
run: |
echo "api_ecs_container_name=$(terraform output -json api_ecs_container_name | jq -r .)" >> $GITHUB_ENV
Expand All @@ -134,13 +101,13 @@ jobs:
echo "api_task_name=$(terraform output -json api_task_name | jq -r .)" >> $GITHUB_ENV
- name: Download task definition
if: ${{ contains (matrix.name,'ee') }}
if: ${{ contains (matrix.name,'-ee') }}
run: |
aws ecs describe-task-definition --task-definition ${{ env.api_task_name }} \
--query taskDefinition > task-definition.json
- name: Render Amazon ECS task definition
if: ${{ contains (matrix.name,'ee') }}
if: ${{ contains (matrix.name,'-ee') }}
id: render-web-container
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
Expand All @@ -149,7 +116,7 @@ jobs:
image: ${{ steps.docker_build.outputs.image }}

- name: Deploy to Amazon ECS service
if: ${{ contains (matrix.name,'ee') }}
if: ${{ contains (matrix.name,'-ee') }}
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.render-web-container.outputs.task-definition }}
Expand All @@ -158,14 +125,14 @@ jobs:
wait-for-service-stability: true

- name: get-npm-version
if: ${{ contains (matrix.name,'ee') }}
if: ${{ contains (matrix.name,'-ee') }}
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: apps/api

- name: Create Sentry release
if: ${{ contains (matrix.name,'ee') }}
if: ${{ contains (matrix.name,'-ee') }}
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
Expand Down
Loading

0 comments on commit 0c6c04f

Please sign in to comment.