Skip to content
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
78 changes: 48 additions & 30 deletions .github/scripts/ciScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = async ({ github, context, core }) => {
const prState = pr.state;

const backendFiles = [];
const backendTests = [];
const mobileFiles = [];
const webFiles = [];

Expand Down Expand Up @@ -33,43 +34,60 @@ module.exports = async ({ github, context, core }) => {

if (fileName.startsWith('apps/backend/')) {
backendFiles.push(fileName);

const relative = fileName.replace('apps/backend/src/', '');
const baseName = relative
.split('/')
.pop()
?.replace(/\.(ts|tsx|js|jsx)$/, '');

if (baseName) {
backendTests.push(`src/__tests__/${baseName}.test.ts`);
}

} else if (fileName.startsWith('apps/mobile/')) {
mobileFiles.push(fileName);
} else if (fileName.startsWith('apps/web/')) {
webFiles.push(fileName);
}
});

console.log({
backendFiles,
mobileFiles,
webFiles
});

core.setOutput(
"backendFiles",
backendFiles
.map(file => file.replace("apps/backend/", ""))
.join(" ")
)

core.setOutput(
"mobileFiles",
mobileFiles
.map(file => file.replace("apps/mobile/", ""))
.join(" ")
)

core.setOutput(
"webFiles",
webFiles
.map(file => file.replace("apps/web/", ""))
.join(" ")
)

core.setOutput("backendChanged", backendFiles.length > 0)
core.setOutput("mobileChanged", mobileFiles.length > 0)
core.setOutput("webChanged", webFiles.length > 0)
console.log({
backendFiles,
backendTests,
mobileFiles,
webFiles
});

core.setOutput(
"backendFiles",
backendFiles
.map(file => file.replace("apps/backend/", ""))
.join(" ")
);

core.setOutput(
"backendTests",
[...new Set(backendTests)].join(" ")
);

core.setOutput(
"mobileFiles",
mobileFiles
.map(file => file.replace("apps/mobile/", ""))
.join(" ")
);

core.setOutput(
"webFiles",
webFiles
.map(file => file.replace("apps/web/", ""))
.join(" ")
);

core.setOutput("backendChanged", backendFiles.length > 0);
core.setOutput("mobileChanged", mobileFiles.length > 0);
core.setOutput("webChanged", webFiles.length > 0);

} catch (error) {
console.error(error);
Expand Down
5 changes: 3 additions & 2 deletions .github/scripts/discordPinReminder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ module.exports = async ({ github, context }) => {
const pr = context.payload.pull_request;
const ignoreUsers = [
'ShantKhatri',
'Harxhit'
'Harxhit',
'blankirigaya'
]
try {
// Only continue if merged
if (!pr || !pr.merged) {
if (!pr || !pr.merged) {
console.log('PR not merged.');
return;
}
Expand Down
3 changes: 2 additions & 1 deletion .github/scripts/unassignIssues.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module.exports = async ({ github, context }) => {

const PROTECTED_ASSIGNEES = [
'ShantKhatri',
'Harxhit'
'Harxhit',
'blankirigaya'
];

// Fetch all open issues (excluding PRs)
Expand Down
47 changes: 45 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ jobs:
if: needs.detect-changes.outputs.backendChanged == 'true'
runs-on: ubuntu-latest

outputs:
backend_lint: ${{ steps.backend_lint.outcome }}
backend_test: ${{ steps.backend_test.outcome }}
backend_typecheck: ${{ steps.backend_typecheck.outcome }}

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd

Expand All @@ -49,21 +54,32 @@ jobs:

- name: Backend lint
id: backend_lint
continue-on-error: true
run: cd apps/backend && pnpm eslint ${{ needs.detect-changes.outputs.backendFiles }}

- name: Backend test
id: backend_test
continue-on-error: true
run: cd apps/backend && pnpm test ${{ needs.detect-changes.outputs.backendFiles }}

- name: Backend typecheck
id: backend_typecheck
continue-on-error: true
run: cd apps/backend && pnpm typecheck ${{ needs.detect-changes.outputs.backendFiles }}

- name: Fail backend if checks failed
if: steps.backend_lint.outcome == 'failure' || steps.backend_test.outcome == 'failure' || steps.backend_typecheck.outcome == 'failure'
run: exit 1

web-ci:
needs: detect-changes
if: needs.detect-changes.outputs.webChanged == 'true'
runs-on: ubuntu-latest

outputs:
web_check: ${{ steps.web_check.outcome }}
web_build: ${{ steps.web_build.outcome }}

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd

Expand All @@ -77,17 +93,27 @@ jobs:

- name: Web check
id: web_check
continue-on-error: true
run: cd apps/web && pnpm check

- name: Web build
id: web_build
continue-on-error: true
run: cd apps/web && pnpm build

- name: Fail web if checks failed
if: steps.web_check.outcome == 'failure' || steps.web_build.outcome == 'failure'
run: exit 1

mobile-ci:
needs: detect-changes
if: needs.detect-changes.outputs.mobileChanged == 'true'
runs-on: ubuntu-latest

outputs:
mobile_lint: ${{ steps.mobile_lint.outcome }}
mobile_test: ${{ steps.mobile_test.outcome }}

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd

Expand All @@ -101,12 +127,18 @@ jobs:

- name: Mobile lint
id: mobile_lint
continue-on-error: true
run: cd apps/mobile && pnpm eslint ${{ needs.detect-changes.outputs.mobileFiles }}

- name: Mobile test
id: mobile_test
continue-on-error: true
run: cd apps/mobile && pnpm test

- name: Fail mobile if checks failed
if: steps.mobile_lint.outcome == 'failure' || steps.mobile_test.outcome == 'failure'
run: exit 1

comment-results:
needs:
- backend-ci
Expand All @@ -128,7 +160,18 @@ jobs:
await script({
github,
context,

backend: '${{ needs.backend-ci.result }}',
web: '${{ needs.web-ci.result }}',
mobile: '${{ needs.mobile-ci.result }}'
});
mobile: '${{ needs.mobile-ci.result }}',

backendLint: '${{ needs.backend-ci.outputs.backend_lint }}',
backendTest: '${{ needs.backend-ci.outputs.backend_test }}',
backendTypecheck: '${{ needs.backend-ci.outputs.backend_typecheck }}',

mobileLint: '${{ needs.mobile-ci.outputs.mobile_lint }}',
mobileTest: '${{ needs.mobile-ci.outputs.mobile_test }}',

webCheck: '${{ needs.web-ci.outputs.web_check }}',
webBuild: '${{ needs.web-ci.outputs.web_build }}'
});