-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #326 from TogetherCrew/ci
Ci
- Loading branch information
Showing
138 changed files
with
12,732 additions
and
10,551 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
node_modules | ||
logs | ||
*.log | ||
coverage | ||
lib | ||
.idea | ||
.github/ | ||
coverage/ | ||
dist/ | ||
node_modules/ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"overrides": [], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": {} | ||
"rules": {}, | ||
"ignorePatterns": [ | ||
"coverage", | ||
"dist", | ||
"__tests__/", | ||
"jest.config.ts", | ||
"*.yml" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
name: CI Pipeline | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
ci: | ||
uses: TogetherCrew/operations/.github/workflows/ci.yml@main | ||
secrets: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Production CI/CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
ci: | ||
uses: TogetherCrew/operations/.github/workflows/ci.yml@main | ||
secrets: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"printWidth": 120, | ||
"trailingComma": "all", | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"plugins": {}, | ||
"filters": {}, | ||
"rules": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,86 @@ | ||
import { Announcement, IAnnouncement } from '@togethercrew.dev/db'; | ||
import { Types } from 'mongoose'; | ||
|
||
type AnnouncementDataFixture = Array<IAnnouncement['data'][0] & { type: string }> | ||
type AnnouncementFixture = Pick<IAnnouncement, 'title' | 'scheduledAt' | 'draft' | 'community' | 'createdBy' | 'updatedBy'> & { _id: Types.ObjectId, data: AnnouncementDataFixture }; | ||
type AnnouncementDataFixture = Array<IAnnouncement['data'][0] & { type: string }>; | ||
type AnnouncementFixture = Pick< | ||
IAnnouncement, | ||
'title' | 'scheduledAt' | 'draft' | 'community' | 'createdBy' | 'updatedBy' | ||
> & { _id: Types.ObjectId; data: AnnouncementDataFixture }; | ||
|
||
export const generatePublicDiscordAnnouncement = (communityId: Types.ObjectId, platformId: Types.ObjectId, channelIds: string[]): AnnouncementFixture => ({ | ||
_id: new Types.ObjectId(), | ||
title: "Announcement One", | ||
scheduledAt: new Date(), | ||
draft: false, | ||
community: communityId, | ||
data: [{ | ||
platform: platformId, | ||
type: "discord_public", | ||
template: "Hello World", | ||
options: { | ||
channelIds: channelIds, | ||
}, | ||
}], | ||
createdBy: new Types.ObjectId(), | ||
updatedBy: new Types.ObjectId(), | ||
export const generatePublicDiscordAnnouncement = ( | ||
communityId: Types.ObjectId, | ||
platformId: Types.ObjectId, | ||
channelIds: string[], | ||
): AnnouncementFixture => ({ | ||
_id: new Types.ObjectId(), | ||
title: 'Announcement One', | ||
scheduledAt: new Date(), | ||
draft: false, | ||
community: communityId, | ||
data: [ | ||
{ | ||
platform: platformId, | ||
type: 'discord_public', | ||
template: 'Hello World', | ||
options: { | ||
channelIds: channelIds, | ||
}, | ||
}, | ||
], | ||
createdBy: new Types.ObjectId(), | ||
updatedBy: new Types.ObjectId(), | ||
}); | ||
|
||
export const generatePrivateUserDiscordAnnouncement = (communityId: Types.ObjectId, platformId: Types.ObjectId, userIds: any[]): AnnouncementFixture => ({ | ||
_id: new Types.ObjectId(), | ||
title: "Announcement Two", | ||
scheduledAt: new Date(), | ||
draft: false, | ||
community: communityId, | ||
data: [{ | ||
platform: platformId, | ||
type: "discord_private", | ||
template: "Hello api world", | ||
options: { | ||
userIds: userIds, | ||
}, | ||
}], | ||
createdBy: new Types.ObjectId(), | ||
updatedBy: new Types.ObjectId(), | ||
}) | ||
export const generatePrivateUserDiscordAnnouncement = ( | ||
communityId: Types.ObjectId, | ||
platformId: Types.ObjectId, | ||
userIds: any[], | ||
): AnnouncementFixture => ({ | ||
_id: new Types.ObjectId(), | ||
title: 'Announcement Two', | ||
scheduledAt: new Date(), | ||
draft: false, | ||
community: communityId, | ||
data: [ | ||
{ | ||
platform: platformId, | ||
type: 'discord_private', | ||
template: 'Hello api world', | ||
options: { | ||
userIds: userIds, | ||
}, | ||
}, | ||
], | ||
createdBy: new Types.ObjectId(), | ||
updatedBy: new Types.ObjectId(), | ||
}); | ||
|
||
export const generatePrivateRoleDiscordAnnouncement = (communityId: Types.ObjectId, platformId: Types.ObjectId, roleIds: any[]): AnnouncementFixture => ({ | ||
_id: new Types.ObjectId(), | ||
title: "Announcement Three", | ||
scheduledAt: new Date(), | ||
draft: false, | ||
community: communityId, | ||
data: [{ | ||
platform: platformId, | ||
type: "discord_private", | ||
template: "Sample Template", | ||
options: { | ||
roleIds: roleIds, | ||
}, | ||
}], | ||
createdBy: new Types.ObjectId(), | ||
updatedBy: new Types.ObjectId(), | ||
}) | ||
export const generatePrivateRoleDiscordAnnouncement = ( | ||
communityId: Types.ObjectId, | ||
platformId: Types.ObjectId, | ||
roleIds: any[], | ||
): AnnouncementFixture => ({ | ||
_id: new Types.ObjectId(), | ||
title: 'Announcement Three', | ||
scheduledAt: new Date(), | ||
draft: false, | ||
community: communityId, | ||
data: [ | ||
{ | ||
platform: platformId, | ||
type: 'discord_private', | ||
template: 'Sample Template', | ||
options: { | ||
roleIds: roleIds, | ||
}, | ||
}, | ||
], | ||
createdBy: new Types.ObjectId(), | ||
updatedBy: new Types.ObjectId(), | ||
}); | ||
|
||
export const insertAnnouncement = async (announcements: AnnouncementFixture[]) => { | ||
for (const announcement of announcements) { | ||
await Announcement.create(announcement); | ||
} | ||
} | ||
|
||
for (const announcement of announcements) { | ||
await Announcement.create(announcement); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.