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

fix(deps): Bump dependencies #362

Merged
merged 6 commits into from
Jan 20, 2024
Merged
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
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ jobs:
scan:
uses: ./.github/workflows/scan.yml
secrets: inherit

deploy:
needs: [scan]
uses: ./.github/workflows/docker.yml
secrets: inherit
with:
version: 0.0.0-${{ github.sha }}
39 changes: 8 additions & 31 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,12 @@ on:
required: true

jobs:
docker:
runs-on: ubuntu-latest
name: Push docker image
timeout-minutes: 5
steps:
- name: App version
run: echo "Picked the app version ${GITHUB_SHA}"

- name: Checkout
uses: actions/checkout@v3

- name: Install NodeJS and NPM modules
uses: ./.github/actions/npm

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Publish to Registry
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: |
ghcr.io/${{ secrets.DOCKER_USERNAME }}/voice-to-text-bot/voice-to-speech-app:latest
ghcr.io/${{ secrets.DOCKER_USERNAME }}/voice-to-text-bot/voice-to-speech-app:${{ github.sha }}
build-args: APP_VERSION=${{ inputs.version }}
deploy:
uses: ./.github/workflows/docker.yml
secrets: inherit
with:
docker-tag: latest
version: ${{ inputs.version }}

heroku:
runs-on: ubuntu-latest
Expand All @@ -48,7 +24,8 @@ jobs:
strategy:
max-parallel: 1
matrix:
environment: ["Production β", "Production Ω"]
environment: ["Production β"]
# environment: ["Production β", "Production Ω"]
steps:
- name: App version
run: echo "Picked the app version ${GITHUB_SHA}"
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build docker image

on:
workflow_call:
inputs:
docker-tag:
type: string
description: "Extra docker tag"
version:
type: string
description: "Version tag"
required: true
jobs:
docker:
runs-on: ubuntu-latest
name: Push docker image
timeout-minutes: 5
steps:
- name: App version
run: echo "Picked the app version ${GITHUB_SHA}"

- name: Checkout
uses: actions/checkout@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Publish to Registry
if: inputs.docker-tag == ''
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: |
ghcr.io/${{ secrets.DOCKER_USERNAME }}/voice-to-text-bot/voice-to-speech-app:${{ github.sha }}
build-args: APP_VERSION=${{ inputs.version }}

- name: Publish to Registry and extra tag
if: inputs.docker-tag != ''
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: |
ghcr.io/${{ secrets.DOCKER_USERNAME }}/voice-to-text-bot/voice-to-speech-app:${{ inputs.docker-tag }}
ghcr.io/${{ secrets.DOCKER_USERNAME }}/voice-to-text-bot/voice-to-speech-app:${{ github.sha }}
build-args: APP_VERSION=${{ inputs.version }}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.16.1
20.11.0
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package.json
package-lock.json
tsconfig.json
.eslintignore
dist/
assets/
Expand Down
44 changes: 26 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
FROM node:18.16.1

EXPOSE 8080
FROM node:20.11.0 AS builder

ENV NODE_ENV production

ENV NEW_RELIC_NO_CONFIG_FILE true

ARG APP_DIR=/usr/src/app/

RUN mkdir -p $APP_DIR
RUN mkdir -p "$APP_DIR"
WORKDIR $APP_DIR

COPY package.json package-lock.json $APP_DIR
RUN npm pkg delete scripts.prepare
RUN npm ci --omit=dev && npm cache clean --force
COPY package.json package-lock.json tsconfig.json $APP_DIR
RUN npm ci --ignore-scripts && npm cache clean --force

COPY ./src $APP_DIR/src
COPY ./certs $APP_DIR/certs
RUN find "$APP_DIR/src" -type d -name __mocks__ -prune -exec rm -rf {} \;
RUN find "$APP_DIR/src" -type f -name '*.spec.ts' -prune -exec rm -rf {} \;

RUN npm run build

FROM node:20.11.0

EXPOSE 8080

ENV NEW_RELIC_NO_CONFIG_FILE true

ENV NODE_ENV production

ARG APP_VERSION=local
ENV APP_VERSION ${APP_VERSION}

RUN echo ${APP_VERSION}

COPY ./certs $APP_DIR/certs
COPY ./src $APP_DIR/src
COPY ./video-temp $APP_DIR/video-temp
COPY ./init.cjs $APP_DIR
COPY ./tsconfig.json $APP_DIR
ARG APP_DIR=/usr/src/app/

RUN find $APP_DIR/src -type d -name __mocks__ -prune -exec rm -rf {} \;
RUN find $APP_DIR/src -type f -name '*.spec.ts' -prune -exec rm -rf {} \;
RUN mkdir -p "$APP_DIR"
WORKDIR $APP_DIR

RUN npm run build
COPY --from=builder $APP_DIR/package.json $APP_DIR
COPY --from=builder $APP_DIR/package-lock.json $APP_DIR
RUN npm ci --omit=dev --ignore-scripts && npm cache clean --force

RUN find $APP_DIR/src -type f | xargs -L1 rm -f
COPY --from=builder $APP_DIR/dist $APP_DIR/dist

USER node

Expand Down
2 changes: 1 addition & 1 deletion e2e/dm.en.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ let TelegramMessageModel: InjectedTestFn["TelegramMessageModel"];
let testPool: MockPool;
let randomIntFromInterval: InjectedFn["randomIntFromInterval"];
let mockGetBotStatItem: InjectedTestFn["mockGetBotStatItem"];
let host: request.SuperTest<request.Test>;
let host: request.Agent;
let LabelId: InjectedFn["LabelId"];
let sendTelegramMessage: InjectedTestFn["sendTelegramMessage"];
let mockTgReceiveMessage: InjectedTestFn["mockTgReceiveMessage"];
Expand Down
2 changes: 1 addition & 1 deletion e2e/dm.ru.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ let tgMessage: InstanceType<InjectedTestFn["TelegramMessageModel"]>;
let botStat: InstanceType<InjectedTestFn["BotStatRecordModel"]>;
let bot: InstanceType<InjectedFn["TelegramBotModel"]>;
let telegramServer: nock.Scope;
let host: request.SuperTest<request.Test>;
let host: request.Agent;
let randomIntFromInterval: InjectedFn["randomIntFromInterval"];
let testPool: MockPool;
let TelegramMessageModel: InjectedTestFn["TelegramMessageModel"];
Expand Down
2 changes: 1 addition & 1 deletion e2e/donate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ let tgMessage: InstanceType<InjectedTestFn["TelegramMessageModel"]>;
let testLangId: LanguageCode;
let bot: InstanceType<InjectedFn["TelegramBotModel"]>;
let telegramServer: nock.Scope;
let host: request.SuperTest<request.Test>;
let host: request.Agent;
let randomIntFromInterval: InjectedFn["randomIntFromInterval"];
let TelegramMessageModel: InjectedTestFn["TelegramMessageModel"];
let BotCommand: InjectedFn["BotCommand"];
Expand Down
2 changes: 1 addition & 1 deletion e2e/errors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ let stopHandler: VoidPromise = () =>

let testPool: MockPool;
let telegramServer: nock.Scope;
let host: request.SuperTest<request.Test>;
let host: request.Agent;
let bot: InstanceType<InjectedFn["TelegramBotModel"]>;

describe("error cases", () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/group.en.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ let testMessageId = 0;
let testChatId = 0;
let tgMessage: InstanceType<InjectedTestFn["TelegramMessageModel"]>;
let telegramServer: nock.Scope;
let host: request.SuperTest<request.Test>;
let host: request.Agent;
let mockTgReceiveUnexpectedMessage: InjectedTestFn["mockTgReceiveUnexpectedMessage"];
let sendTelegramMessage: InjectedTestFn["sendTelegramMessage"];
let mockUpdateBotStatUsage: InjectedTestFn["mockUpdateBotStatUsage"];
Expand Down
2 changes: 1 addition & 1 deletion e2e/group.ru.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ let converter: InstanceType<InjectedFn["VoiceConverter"]>;
let hostUrl: string;
let bot: InstanceType<InjectedFn["TelegramBotModel"]>;
let telegramServer: nock.Scope;
let host: request.SuperTest<request.Test>;
let host: request.Agent;
let chatType: TgChatType;
let testMessageId = 0;
let testChatId = 0;
Expand Down
2 changes: 1 addition & 1 deletion e2e/health.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const webhookDoNotWait = false;
let hostUrl: string;
let server: InstanceType<InjectedFn["ExpressServer"]>;
let telegramServer: nock.Scope;
let host: request.SuperTest<request.Test>;
let host: request.Agent;
let ExpressServer: InjectedFn["ExpressServer"];
let appVersion: InjectedFn["appVersion"];
let httpsOptions: InjectedFn["httpsOptions"];
Expand Down
2 changes: 1 addition & 1 deletion e2e/ignore.spec-ignored.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ let telegramServer: nock.Scope;
let TelegramMessageModel: InjectedTestFn["TelegramMessageModel"];
let testPool: MockPool;
let randomIntFromInterval: InjectedFn["randomIntFromInterval"];
let host: request.SuperTest<request.Test>;
let host: request.Agent;
let sendTelegramMessage: InjectedTestFn["sendTelegramMessage"];
let BotCommand: InjectedFn["BotCommand"];
let mockGetIgnoredChatsRow: InjectedTestFn["mockGetIgnoredChatsRow"];
Expand Down
2 changes: 1 addition & 1 deletion e2e/lifecycle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ let appVersion: InjectedFn["appVersion"];
let httpsOptions: InjectedFn["httpsOptions"];
let telegramServer: nock.Scope;
let testPool: MockPool;
let host: request.SuperTest<request.Test>;
let host: request.Agent;
let mockTgGetWebHook: InjectedTestFn["mockTgGetWebHook"];
let hostUrl: string;
let bot: InstanceType<InjectedFn["TelegramBotModel"]>;
Expand Down
4 changes: 2 additions & 2 deletions e2e/requests/telegram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const makeTelegramResponse = <D>(result: D) => {
};

export const sendTelegramMessage = (
host: request.SuperTest<request.Test>,
host: request.Agent,
bot: TelegramBotModel,
msg: TelegramMessageModel,
): Promise<void> => {
Expand All @@ -45,7 +45,7 @@ export const sendTelegramMessage = (
};

export const sendTelegramCallbackMessage = (
host: request.SuperTest<request.Test>,
host: request.Agent,
bot: TelegramBotModel,
msg: TelegramMessageModel,
): Promise<void> => {
Expand Down
Loading