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

Ci #158

Closed
wants to merge 40 commits into from
Closed

Ci #158

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3d3c086
[CI]: add prettier and eslintrc
Behzad-rabiei Jan 28, 2024
77a5cbb
[CI]: run prettier
Behzad-rabiei Jan 28, 2024
67341fd
[CI]: fix lint errors
Behzad-rabiei Jan 28, 2024
c9aba11
[CI]: working on the CI
Behzad-rabiei Jan 28, 2024
434d855
[CI]: working on the CI
Behzad-rabiei Jan 28, 2024
480afa8
[CI]: working on the CI
Behzad-rabiei Jan 28, 2024
20ad045
[CI]: working on the CI
Behzad-rabiei Jan 28, 2024
2a635be
[CI]: working on the CI
Behzad-rabiei Jan 28, 2024
6e98f3f
[CI]: fixed lint errors
Behzad-rabiei Jan 29, 2024
ebaf191
[CI]: fixed lint errors
Behzad-rabiei Jan 29, 2024
8c68e37
[CI]: fixed lint errors
Behzad-rabiei Jan 29, 2024
c35a8eb
[CI]: fixed lint errors
Behzad-rabiei Jan 29, 2024
7402ecb
[CI]: fixed lint errors
Behzad-rabiei Jan 29, 2024
3e370f6
[CI]: fixed lint errors
Behzad-rabiei Jan 29, 2024
653909d
[CI]: fixed lint errors
Behzad-rabiei Jan 29, 2024
22d9b13
[CI]: fixed lint errors
Behzad-rabiei Jan 29, 2024
0f6e00d
[CI]: fixed lint errors
Behzad-rabiei Jan 29, 2024
c537f24
[CI]: fixed test errors
Behzad-rabiei Jan 29, 2024
8c8d262
[CI]: update tests
Behzad-rabiei Jan 29, 2024
8e3a025
[CI]: update tests
Behzad-rabiei Jan 29, 2024
e7228a7
[CI]: update tests
Behzad-rabiei Jan 29, 2024
f0a01c9
[CI]: update tests
Behzad-rabiei Jan 29, 2024
0fc9247
[CI]: update tests
Behzad-rabiei Jan 29, 2024
4d1fdae
[CI]: update tests
Behzad-rabiei Jan 29, 2024
760724e
[CI]: update tests
Behzad-rabiei Jan 29, 2024
f22f7b9
[CI]: update tests
Behzad-rabiei Jan 29, 2024
0a89ec2
[CI]: update tests
Behzad-rabiei Jan 29, 2024
08ab245
[CI]: update tests
Behzad-rabiei Jan 29, 2024
dc652fc
[CI]: update tests
Behzad-rabiei Jan 29, 2024
2082827
[CI]: update tests
Behzad-rabiei Jan 29, 2024
190c652
[CI]: update tests
Behzad-rabiei Jan 29, 2024
9374744
[CI]: update tests
Behzad-rabiei Jan 29, 2024
0439894
[CI]: update tests
Behzad-rabiei Jan 29, 2024
ed29fa4
[CI]: update tests
Behzad-rabiei Jan 29, 2024
751006e
[CI]: update tests
Behzad-rabiei Jan 29, 2024
d69f588
[CI]: update tests
Behzad-rabiei Jan 29, 2024
b730ace
[CI]: update docker
Behzad-rabiei Jan 29, 2024
bcc7216
[CI]: update tests
Behzad-rabiei Jan 29, 2024
c31988f
[CI]: update tests
Behzad-rabiei Jan 29, 2024
e4d8f3e
[CI]: update tests
Behzad-rabiei Jan 29, 2024
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
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.github/
coverage/
dist/
node_modules/

.env
22 changes: 0 additions & 22 deletions .eslintrc.js

This file was deleted.

47 changes: 25 additions & 22 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
{
"env": {
"ES2017": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"plugins": [
"@typescript-eslint",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"prettier/prettier": "error"
}
"env": {
"es2021": true,
"node": true
},
"extends": [
"standard-with-typescript",
"prettier"
],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {},
"ignorePatterns": [
"coverage",
"dist",
"__tests__/",
"jest.config.js",
"*.yml",
"mongo-init.js",
"bable.config.js"
]
}
45 changes: 7 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,10 @@
name: tc-discordBot
---
name: CI Pipeline

on:
push:
pull_request:
on: pull_request

jobs:
test:
strategy:
matrix:
platform: [ubuntu-latest]
node: ['18.x']
name: test/node ${{ matrix.node }}/${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- run: npm install
# - run: npm run test:ci
- run: npm run lint
- run: npm run format
- run: npm run build

# coverage:
# needs: [test]
# name: coverage
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v2
# with:
# node-version: '18'
# - run: npm install
# - run: npm run build
# - uses: paambaati/[email protected]
# env:
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
# with:
# coverageCommand: npm run coverage
ci:
uses: TogetherCrew/operations/.github/workflows/ci.yml@main
secrets:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
12 changes: 12 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Publish

on:
release:
types: [published]

jobs:
ci:
uses: TogetherCrew/operations/.github/workflows/publish.ts.yml@main
secrets:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
Empty file added .prettierignore
Empty file.
22 changes: 0 additions & 22 deletions .prettierrc

This file was deleted.

5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 120,
"trailingComma": "all",
"singleQuote": true
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Maintainability](https://api.codeclimate.com/v1/badges/e1239b895f0ee2569b61/maintainability)](https://codeclimate.com/github/RnDAO/tc-discordBot/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/e1239b895f0ee2569b61/test_coverage)](https://codeclimate.com/github/RnDAO/tc-discordBot/test_coverage)

# tc-discordBot
# tc-discordBot
51 changes: 25 additions & 26 deletions __tests__/fixtures/channel.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,37 @@ import { IChannel } from '@togethercrew.dev/db';
import { Connection } from 'mongoose';

export const channel1: IChannel = {
channelId: '987654321098765432',
name: 'Channel 1',
parentId: null,
permissionOverwrites: [
{
id: '1122334455', // example Snowflake ID for the role or member
type: 0,
allow: 'VIEW_CHANNEL',
deny: 'SEND_MESSAGES',
},
{
id: '9988776655', // another example Snowflake ID for the role or member
type: 1,
allow: 'VIEW_CHANNEL,SEND_MESSAGES',
deny: '',
},
],
channelId: '987654321098765432',
name: 'Channel 1',
parentId: null,
permissionOverwrites: [
{
id: '1122334455', // example Snowflake ID for the role or member
type: 0,
allow: 'VIEW_CHANNEL',
deny: 'SEND_MESSAGES',
},
{
id: '9988776655', // another example Snowflake ID for the role or member
type: 1,
allow: 'VIEW_CHANNEL,SEND_MESSAGES',
deny: '',
},
],
};

export const channel2: IChannel = {
channelId: '234567890123456789',
name: 'Channel 2',
parentId: '987654321098765432',

channelId: '234567890123456789',
name: 'Channel 2',
parentId: '987654321098765432',
};

export const channel3: IChannel = {
channelId: '345678901234567890',
name: 'Channel 3',
parentId: '987654321098765432'
channelId: '345678901234567890',
name: 'Channel 3',
parentId: '987654321098765432',
};

export const insertChannels = async function <Type>(channels: Array<Type>, connection: Connection) {
await connection.models.Channel.insertMany(channels.map((channel) => (channel)));
};
await connection.models.Channel.insertMany(channels.map((channel) => channel));
};
50 changes: 25 additions & 25 deletions __tests__/fixtures/guildMember.fixture.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
import { IGuildMember } from '@togethercrew.dev/db';

export const guildMember1: IGuildMember = {
discordId: '123456789',
username: 'JohnDoe',
roles: ['role1Id', 'role2Id'],
joinedAt: new Date('2023-05-01'),
discriminator: '1',
isBot: false,
avatar: 'a1',
permissions: '137411140513358n',
discordId: '123456789',
username: 'JohnDoe',
roles: ['role1Id', 'role2Id'],
joinedAt: new Date('2023-05-01'),
discriminator: '1',
isBot: false,
avatar: 'a1',
permissions: '137411140513358n',
};

export const guildMember2: IGuildMember = {
discordId: '987654321',
username: 'JaneSmith',
roles: ['role1Id', 'role2Id'],
joinedAt: new Date('2023-05-01'),
discriminator: '2',
isBot: true,
avatar: 'a2',
permissions: '137411140513357n',
discordId: '987654321',
username: 'JaneSmith',
roles: ['role1Id', 'role2Id'],
joinedAt: new Date('2023-05-01'),
discriminator: '2',
isBot: true,
avatar: 'a2',
permissions: '137411140513357n',
};

export const guildMember3: IGuildMember = {
discordId: '555555555',
username: 'AliceJohnson',
roles: ['role2Id', 'role5Id'],
joinedAt: new Date('2023-05-03'),
discriminator: '3',
isBot: false,
avatar: 'a3',
permissions: '137411140513356n',
};
discordId: '555555555',
username: 'AliceJohnson',
roles: ['role2Id', 'role5Id'],
joinedAt: new Date('2023-05-03'),
discriminator: '3',
isBot: false,
avatar: 'a3',
permissions: '137411140513356n',
};
6 changes: 3 additions & 3 deletions __tests__/fixtures/rawInfo.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const rawInfo1: IRawInfo = {
messageId: 'message123',
threadId: 'thread456',
threadName: 'thread789',
channelName: 'c1'
channelName: 'c1',
};

export const rawInfo2: IRawInfo = {
Expand All @@ -29,7 +29,7 @@ export const rawInfo2: IRawInfo = {
messageId: 'message012',
threadId: 'thread345',
threadName: 'Discussion Thread',
channelName: 'c2'
channelName: 'c2',
};

export const rawInfo3: IRawInfo = {
Expand All @@ -45,5 +45,5 @@ export const rawInfo3: IRawInfo = {
messageId: 'message654',
threadId: 'thread321',
threadName: 'Important Announcement',
channelName: 'c3'
channelName: 'c3',
};
22 changes: 11 additions & 11 deletions __tests__/fixtures/role.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ import { IRole } from '@togethercrew.dev/db';
import { Connection } from 'mongoose';

export const role1: IRole = {
roleId: '234567890123456777',
name: 'Role 1',
color: 123456
roleId: '234567890123456777',
name: 'Role 1',
color: 123456,
};

export const role2: IRole = {
roleId: '234567890123456787',
name: 'Role 2',
color: 654321
roleId: '234567890123456787',
name: 'Role 2',
color: 654321,
};

export const role3: IRole = {
roleId: '234567890123456797',
name: 'Role 3',
color: 654321
roleId: '234567890123456797',
name: 'Role 3',
color: 654321,
};

export const insertRoles = async function <Type>(roles: Array<Type>, connection: Connection) {
await connection.models.Role.insertMany(roles.map((role) => (role)));
};
await connection.models.Role.insertMany(roles.map((role) => role));
};
Loading
Loading