Skip to content

Commit

Permalink
Merge branch 'next' into chore/worker-add-swc
Browse files Browse the repository at this point in the history
  • Loading branch information
abrl91 committed Apr 24, 2024
2 parents d14e8a6 + eaafa05 commit 0807380
Show file tree
Hide file tree
Showing 350 changed files with 13,914 additions and 1,568 deletions.
18 changes: 16 additions & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,21 @@
"zulip",
"uuidv",
"Vonage",
"HeaderNavNew",
"reshard",
"hstack",
"runtimes",
"cafebabe"
"cafebabe",
"Markunread",
"Fira",
"Roboto",
"Raleway",
"Icann",
"limitbar",
"eazy",
"Maizzle",
"MJML",
"localstorage"
],
"flagWords": [],
"patterns": [
Expand Down Expand Up @@ -683,6 +696,7 @@
"apps/api/src/.env.test",
"apps/ws/src/.env.test",
"apps/ws/src/.example.env",
"apps/web/playwright.config.ts",
".cspell.json",
"package.json",
"package-lock.json",
Expand All @@ -704,6 +718,6 @@
"angular.json",
"ng-package.json",
"libs/shared/src/types/timezones/timezones.types.ts",
"*.riv",
"*.riv"
]
}
18 changes: 11 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
### What change does this PR introduce?
### What changed? Why was the change needed?
<!-- Also include any relevant links, such as Linear tickets, Slack discussions, or design documents. -->

<!-- Explain here the changes your PR introduces and text to help us understand the context of this change. -->
### Screenshots
<!-- If the changes are visual, include screenshots or screencasts. -->

### Why was this change needed?
<details>
<summary><strong>Expand for optional sections</strong></summary>

<!-- If your PR fixes an open issue, use `Closes #999` to link your PR with the issue. #999 stands for the issue number you are fixing, Example: Closes #31 -->
### Related enterprise PR
<!-- A link to a dependent pull request -->

### Other information (Screenshots)
### Special notes for your reviewer
<!-- Specific instructions or considerations you want to highlight for the reviewer. -->

<!-- Add notes or any other information here -->
<!-- Also add all the screenshots which support your changes -->
</details>
11 changes: 11 additions & 0 deletions .github/actions/cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Cache
description: GitHub Action to expose GitHub runtime to the workflow
runs:
using: composite
steps:
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Env
shell: bash
run: |
env|sort
17 changes: 16 additions & 1 deletion .github/actions/docker/build-api/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ inputs:
docker_name:
description: 'Name for docker image'
required: true
environment:
required: false
type: string

bullmq_secret:
description: 'Bullmq secret api token'
Expand All @@ -39,6 +42,7 @@ runs:

# TODO Removed when migrated to action matrix for each build type
- uses: ./.github/actions/free-space
- uses: ./.github/actions/cache

- uses: crazy-max/ghaction-setup-docker@v2
with:
Expand All @@ -58,7 +62,13 @@ runs:
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: 'image=moby/buildkit:v0.12.4'
driver-opts: 'image=moby/buildkit:v0.13.1'

- name: Prepare
shell: bash
run: |
service=${{ matrix.name }}
echo "SERVICE_NAME=$(basename "${service//-/-}")" >> $GITHUB_ENV
- name: Login To Registry
shell: bash
Expand All @@ -82,6 +92,11 @@ runs:
IMAGE_TAG: ${{ github.sha }}
GH_ACTOR: ${{ github.actor }}
GH_PASSWORD: ${{ inputs.github_token }}
DOCKER_BUILD_ARGUMENTS: >
--cache-from type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-${{ inputs.environment }}
--cache-to type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-${{ inputs.environment }},mode=max
--platform=linux/amd64 --provenance=false
--output=type=image,name=ghcr.io/novuhq/${{ inputs.docker_name }},push-by-digest=true,name-canonical=true
run: |
set -x
cd apps/api && pnpm run docker:build
Expand Down
17 changes: 16 additions & 1 deletion .github/actions/docker/build-worker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ inputs:
docker_name:
description: 'Name for docker image'
required: true
environment:
required: false
type: string

bullmq_secret:
description: 'Bullmq secret api token'
Expand All @@ -39,6 +42,7 @@ runs:

# TODO Removed when migrated to action matrix for each build type
- uses: ./.github/actions/free-space
- uses: ./.github/actions/cache

- uses: crazy-max/ghaction-setup-docker@v2
with:
Expand All @@ -58,7 +62,13 @@ runs:
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: 'image=moby/buildkit:v0.12.4'
driver-opts: 'image=moby/buildkit:v0.13.1'

- name: Prepare
shell: bash
run: |
service=${{ matrix.name }}
echo "SERVICE_NAME=$(basename "${service//-/-}")" >> $GITHUB_ENV
- name: Login To Registry
shell: bash
Expand All @@ -82,6 +92,11 @@ runs:
IMAGE_TAG: ${{ github.sha }}
GH_ACTOR: ${{ github.actor }}
GH_PASSWORD: ${{ inputs.github_token }}
DOCKER_BUILD_ARGUMENTS: >
--cache-from type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-${{ inputs.environment }}
--cache-to type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-${{ inputs.environment }},mode=max
--platform=linux/amd64 --provenance=false
--output=type=image,name=ghcr.io/novuhq/${{ inputs.docker_name }},push-by-digest=true,name-canonical=true
run: |
set -x
cd apps/worker && pnpm run docker:build
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/dev-deploy-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ jobs:
with:
tag: dev
push: 'true'
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GH_PACKAGES }}
docker_name: ${{ matrix.name }}
bullmq_secret: ${{ secrets.BULL_MQ_PRO_NPM_TOKEN }}
environment: dev

- name: Checkout cloud infra
if: ${{ contains (matrix.name,'-ee') }}
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/dev-deploy-inbound-mail.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ jobs:
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: 'image=moby/buildkit:v0.12.4'
driver-opts: 'image=moby/buildkit:v0.13.1'

- name: Prepare
shell: bash
run: |
service=${{ matrix.name }}
echo "SERVICE_NAME=$(basename "${service//-/-}")" >> $GITHUB_ENV
- name: Set Bull MQ Env variable for EE
shell: bash
Expand All @@ -81,9 +87,14 @@ jobs:
IMAGE_TAG: ${{ github.sha }}
GH_ACTOR: ${{ github.actor }}
GH_PASSWORD: ${{ secrets.GH_PACKAGES }}
DOCKER_BUILD_ARGUMENTS: >
--cache-from type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-dev
--cache-to type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-dev,mode=max
--platform=linux/amd64 --provenance=false
--output=type=image,name=ghcr.io/novuhq/${{ matrix.name }},push-by-digest=true,name-canonical=true
run: |
echo $GH_PASSWORD | docker login ghcr.io -u $GH_ACTOR --password-stdin
cd apps/inbound-mail && pnpm --silent --workspace-root pnpm-context -- apps/inbound-mail/Dockerfile | BULL_MQ_PRO_NPM_TOKEN=${BULL_MQ_PRO_NPM_TOKEN} docker buildx build --secret id=BULL_MQ_PRO_NPM_TOKEN --build-arg PACKAGE_PATH=apps/inbound-mail - -t novu-inbound-mail --load --platform=linux/amd64,linux/arm64 --provenance=false
cd apps/inbound-mail && pnpm --silent --workspace-root pnpm-context -- apps/inbound-mail/Dockerfile | BULL_MQ_PRO_NPM_TOKEN=${BULL_MQ_PRO_NPM_TOKEN} docker buildx build --secret id=BULL_MQ_PRO_NPM_TOKEN --build-arg PACKAGE_PATH=apps/inbound-mail - -t novu-inbound-mail --load $DOCKER_BUILD_ARGUMENTS
docker tag novu-inbound-mail ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:dev
docker tag novu-inbound-mail ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dev-deploy-worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
github_token: ${{ secrets.GH_PACKAGES }}
docker_name: ${{ matrix.name }}
bullmq_secret: ${{ secrets.BULL_MQ_PRO_NPM_TOKEN }}
environment: dev

deploy_dev_workers:
needs: build_dev_worker
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/dev-deploy-ws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ jobs:
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: 'image=moby/buildkit:v0.12.4'
driver-opts: 'image=moby/buildkit:v0.13.1'

- name: Prepare
shell: bash
run: |
service=${{ matrix.name }}
echo "SERVICE_NAME=$(basename "${service//-/-}")" >> $GITHUB_ENV
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down Expand Up @@ -118,9 +124,14 @@ jobs:
IMAGE_TAG: ${{ github.sha }}
GH_ACTOR: ${{ github.actor }}
GH_PASSWORD: ${{ secrets.GH_PACKAGES }}
DOCKER_BUILD_ARGUMENTS: >
--cache-from type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-dev
--cache-to type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-dev,mode=max
--platform=linux/amd64 --provenance=false
--output=type=image,name=ghcr.io/novuhq/${{ matrix.name }},push-by-digest=true,name-canonical=true
run: |
echo $GH_PASSWORD | docker login ghcr.io -u $GH_ACTOR --password-stdin
BULL_MQ_PRO_NPM_TOKEN=${BULL_MQ_PRO_NPM_TOKEN} docker buildx build -t ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG --platform=linux/amd64,linux/arm64 --provenance=false --load --secret id=BULL_MQ_PRO_NPM_TOKEN -f apps/ws/Dockerfile .
BULL_MQ_PRO_NPM_TOKEN=${BULL_MQ_PRO_NPM_TOKEN} docker buildx build -t ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG --load --secret id=BULL_MQ_PRO_NPM_TOKEN -f apps/ws/Dockerfile . $DOCKER_BUILD_ARGUMENTS
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://127.0.0.1:1340/v1/health-check | grep 'ok'
docker tag ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:dev
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/prod-deploy-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ jobs:
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: 'image=moby/buildkit:v0.12.4'
driver-opts: 'image=moby/buildkit:v0.13.1'

- name: Prepare
shell: bash
run: |
service=${{ matrix.name }}
echo "SERVICE_NAME=$(basename "${service//-/-}")" >> $GITHUB_ENV
- name: Set Bull MQ Env variable for EE
if: contains(matrix.name, 'ee')
Expand All @@ -80,9 +86,14 @@ jobs:
IMAGE_TAG: ${{ github.sha }}
GH_ACTOR: ${{ github.actor }}
GH_PASSWORD: ${{ secrets.GH_PACKAGES }}
DOCKER_BUILD_ARGUMENTS: >
--cache-from type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-prod
--cache-to type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-prod,mode=max
--platform=linux/amd64,linux/arm64 --provenance=false
--output=type=image,name=ghcr.io/novuhq/${{ matrix.name }},push-by-digest=true,name-canonical=true
run: |
echo $GH_PASSWORD | docker login ghcr.io -u $GH_ACTOR --password-stdin
cd apps/api && pnpm --silent --workspace-root pnpm-context -- apps/api/Dockerfile | BULL_MQ_PRO_NPM_TOKEN=${BULL_MQ_PRO_NPM_TOKEN} docker buildx build --secret id=BULL_MQ_PRO_NPM_TOKEN --build-arg PACKAGE_PATH=apps/api - -t novu-api --load --platform=linux/amd64,linux/arm64 --provenance=false
cd apps/api && pnpm --silent --workspace-root pnpm-context -- apps/api/Dockerfile | BULL_MQ_PRO_NPM_TOKEN=${BULL_MQ_PRO_NPM_TOKEN} docker buildx build --secret id=BULL_MQ_PRO_NPM_TOKEN --build-arg PACKAGE_PATH=apps/api - -t novu-api --load $DOCKER_BUILD_ARGUMENTS
docker tag novu-api ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:latest
docker tag novu-api ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:prod
docker tag novu-api ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/prod-deploy-inbound-mail.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ jobs:
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: 'image=moby/buildkit:v0.12.4'
driver-opts: 'image=moby/buildkit:v0.13.1'

- name: Prepare
shell: bash
run: |
service=${{ matrix.name }}
echo "SERVICE_NAME=$(basename "${service//-/-}")" >> $GITHUB_ENV
- name: Set Bull MQ Env variable for EE
if: contains(matrix.name, 'ee')
Expand All @@ -70,9 +76,14 @@ jobs:
IMAGE_TAG: ${{ github.sha }}
GH_ACTOR: ${{ github.actor }}
GH_PASSWORD: ${{ secrets.GH_PACKAGES }}
DOCKER_BUILD_ARGUMENTS: >
--cache-from type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-prod
--cache-to type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-prod,mode=max
--platform=linux/amd64,linux/arm64 --provenance=false
--output=type=image,name=ghcr.io/novuhq/${{ matrix.name }},push-by-digest=true,name-canonical=true
run: |
echo $GH_PASSWORD | docker login ghcr.io -u $GH_ACTOR --password-stdin
cd apps/inbound-mail && pnpm --silent --workspace-root pnpm-context -- apps/inbound-mail/Dockerfile | BULL_MQ_PRO_NPM_TOKEN=${BULL_MQ_PRO_NPM_TOKEN} docker buildx build --secret id=BULL_MQ_PRO_NPM_TOKEN --build-arg PACKAGE_PATH=apps/inbound-mail - -t novu-inbound-mail --load --platform=linux/amd64,linux/arm64 --provenance=false
cd apps/inbound-mail && pnpm --silent --workspace-root pnpm-context -- apps/inbound-mail/Dockerfile | BULL_MQ_PRO_NPM_TOKEN=${BULL_MQ_PRO_NPM_TOKEN} docker buildx build --secret id=BULL_MQ_PRO_NPM_TOKEN --build-arg PACKAGE_PATH=apps/inbound-mail - -t novu-inbound-mail --load $DOCKER_BUILD_ARGUMENTS
docker tag novu-inbound-mail ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:latest
docker tag novu-inbound-mail ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:prod
docker tag novu-inbound-mail ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/prod-deploy-worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ jobs:
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: 'image=moby/buildkit:v0.12.4'
driver-opts: 'image=moby/buildkit:v0.13.1'

- name: Prepare
shell: bash
run: |
service=${{ matrix.name }}
echo "SERVICE_NAME=$(basename "${service//-/-}")" >> $GITHUB_ENV
- name: Set Bull MQ Env variable for EE
if: contains(matrix.name, 'ee')
Expand All @@ -80,9 +86,14 @@ jobs:
IMAGE_TAG: ${{ github.sha }}
GH_ACTOR: ${{ github.actor }}
GH_PASSWORD: ${{ secrets.GH_PACKAGES }}
DOCKER_BUILD_ARGUMENTS: >
--cache-from type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-prod
--cache-to type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-prod,mode=max
--platform=linux/amd64,linux/arm64 --provenance=false
--output=type=image,name=ghcr.io/novuhq/${{ matrix.name }},push-by-digest=true,name-canonical=true
run: |
echo $GH_PASSWORD | docker login ghcr.io -u $GH_ACTOR --password-stdin
cd apps/worker && pnpm --silent --workspace-root pnpm-context -- apps/worker/Dockerfile | BULL_MQ_PRO_NPM_TOKEN=${BULL_MQ_PRO_NPM_TOKEN} docker buildx build --secret id=BULL_MQ_PRO_NPM_TOKEN --build-arg PACKAGE_PATH=apps/worker - -t novu-worker --load --platform=linux/amd64,linux/arm64 --provenance=false
cd apps/worker && pnpm --silent --workspace-root pnpm-context -- apps/worker/Dockerfile | BULL_MQ_PRO_NPM_TOKEN=${BULL_MQ_PRO_NPM_TOKEN} docker buildx build --secret id=BULL_MQ_PRO_NPM_TOKEN --build-arg PACKAGE_PATH=apps/worker - -t novu-worker --load $DOCKER_BUILD_ARGUMENTS
docker tag novu-worker ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:latest
docker tag novu-worker ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:prod
docker tag novu-worker ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/prod-deploy-ws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ jobs:
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: 'image=moby/buildkit:v0.12.4'
driver-opts: 'image=moby/buildkit:v0.13.1'

- name: Prepare
shell: bash
run: |
service=${{ matrix.name }}
echo "SERVICE_NAME=$(basename "${service//-/-}")" >> $GITHUB_ENV
- name: Build, tag, and push image to Amazon ECR
id: build-image
Expand All @@ -74,9 +80,14 @@ jobs:
IMAGE_TAG: ${{ github.sha }}
GH_ACTOR: ${{ github.actor }}
GH_PASSWORD: ${{ secrets.GH_PACKAGES }}
DOCKER_BUILD_ARGUMENTS: >
--cache-from type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-prod
--cache-to type=registry,ref=ghcr.io/novuhq/cache:build-cache-${{ env.SERVICE_NAME }}-prod,mode=max
--platform=linux/amd64,linux/arm64 --provenance=false
--output=type=image,name=ghcr.io/novuhq/${{ matrix.name }},push-by-digest=true,name-canonical=true
run: |
echo $GH_PASSWORD | docker login ghcr.io -u $GH_ACTOR --password-stdin
BULL_MQ_PRO_NPM_TOKEN=${BULL_MQ_PRO_NPM_TOKEN} docker buildx build --secret id=BULL_MQ_PRO_NPM_TOKEN -t ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG --load --platform=linux/amd64,linux/arm64 --provenance=false -f apps/ws/Dockerfile .
BULL_MQ_PRO_NPM_TOKEN=${BULL_MQ_PRO_NPM_TOKEN} docker buildx build --secret id=BULL_MQ_PRO_NPM_TOKEN -t ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG --load -f apps/ws/Dockerfile . $DOCKER_BUILD_ARGUMENTS
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://127.0.0.1:1340/v1/health-check | grep 'ok'
docker tag ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:prod
Expand Down

0 comments on commit 0807380

Please sign in to comment.