From 48d10fb4567a920ba5e49a57cb3fbf837b106604 Mon Sep 17 00:00:00 2001 From: sfreeman422 Date: Sun, 22 Mar 2026 07:48:06 -0400 Subject: [PATCH 1/6] Added github actions flow for CI concerns --- .github/workflows/ci.yml | 57 +++++++++++++++++++++++++++++++++++++ packages/backend/Dockerfile | 5 ---- 2 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..8cf77722 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: CI + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + - run: npm ci + - run: npm run lint + + format-check: + name: Format Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + - run: npm ci + - run: npm run format:check + + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + - run: npm ci + - run: npm run build + + test: + name: Test & Coverage + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + - run: npm ci + - name: Run tests + run: npm run test + - name: Enforce 80% coverage + run: npm run test:coverage diff --git a/packages/backend/Dockerfile b/packages/backend/Dockerfile index 39d0ba17..c624fb26 100644 --- a/packages/backend/Dockerfile +++ b/packages/backend/Dockerfile @@ -12,13 +12,8 @@ COPY packages/backend/tsconfig.json packages/backend/ COPY packages/backend/tsconfig.prod.json packages/backend/ COPY packages/backend/src packages/backend/src -# Copy config files for linting -COPY eslint.config.js .prettierrc.js ./ - # Install dependencies and build RUN npm ci -RUN npm run lint -w @mocker/backend -RUN npm run test -w @mocker/backend RUN npm run build:prod -w @mocker/backend FROM node:20-alpine AS release From 3dff8bfa310c75c4231cdbcfa267583bdc888d56 Mon Sep 17 00:00:00 2001 From: sfreeman422 Date: Sun, 22 Mar 2026 07:52:23 -0400 Subject: [PATCH 2/6] Update .github/workflows/ci.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8cf77722..66260529 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,5 @@ jobs: node-version: '20' cache: 'npm' - run: npm ci - - name: Run tests - run: npm run test - name: Enforce 80% coverage run: npm run test:coverage From b6e2f51a8480db0349096f3788635ae9a97d90cf Mon Sep 17 00:00:00 2001 From: sfreeman422 Date: Sun, 22 Mar 2026 07:55:14 -0400 Subject: [PATCH 3/6] Added support for linting spec files --- eslint.config.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eslint.config.js b/eslint.config.js index a0b326c3..25314fb8 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -15,7 +15,9 @@ module.exports = tseslint.config( ecmaVersion: 'latest', sourceType: 'module', parserOptions: { - projectService: true, + projectService: { + allowDefaultProject: ['packages/**/*.spec.ts'], + }, tsconfigRootDir: __dirname, }, globals: { @@ -54,6 +56,7 @@ module.exports = tseslint.config( '@typescript-eslint/unbound-method': 'warn', }, }, + { files: ['**/*.spec.ts'], rules: { From 1b03b3d94b39d08890a22fab5f9674844fe1369e Mon Sep 17 00:00:00 2001 From: sfreeman422 Date: Sun, 22 Mar 2026 07:57:56 -0400 Subject: [PATCH 4/6] Updated to use an ESLint specific tsconfig --- eslint.config.js | 4 +--- packages/backend/tsconfig.eslint.json | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 packages/backend/tsconfig.eslint.json diff --git a/eslint.config.js b/eslint.config.js index 25314fb8..029ca0b1 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -15,9 +15,7 @@ module.exports = tseslint.config( ecmaVersion: 'latest', sourceType: 'module', parserOptions: { - projectService: { - allowDefaultProject: ['packages/**/*.spec.ts'], - }, + projectService: true, tsconfigRootDir: __dirname, }, globals: { diff --git a/packages/backend/tsconfig.eslint.json b/packages/backend/tsconfig.eslint.json new file mode 100644 index 00000000..a8a05124 --- /dev/null +++ b/packages/backend/tsconfig.eslint.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["node_modules", "dist"] +} From 6f21c2bf94c4eb372b82b3036da37c90c82a9028 Mon Sep 17 00:00:00 2001 From: sfreeman422 Date: Sun, 22 Mar 2026 08:01:04 -0400 Subject: [PATCH 5/6] Updated eslint config to properly leverage the right tsconfig --- eslint.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.js b/eslint.config.js index 029ca0b1..6f82ce4d 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -15,7 +15,7 @@ module.exports = tseslint.config( ecmaVersion: 'latest', sourceType: 'module', parserOptions: { - projectService: true, + project: ['packages/backend/tsconfig.eslint.json'], tsconfigRootDir: __dirname, }, globals: { From de57a068fc11aaf75dc6b6fc94a2156a85792451 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Mar 2026 08:22:28 -0400 Subject: [PATCH 6/6] CI: run npm ci once via composite action + artifact sharing (#182) * Initial plan * Refactor CI to use composite action + artifacts to avoid repeated npm ci Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com> Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/4c494880-0851-4259-9bf2-0172fcf671c4 * Fix actions permissions for artifact upload/download in CI workflow Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com> Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/9c6de18d-4d6d-4a01-a0c4-6091c6499711 * Fix: restore execute permissions on node_modules/.bin after artifact download Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com> Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/c08c9005-bef2-4528-b4ab-b197997e8da9 * Fix: tar node_modules to preserve symlinks and permissions across artifact upload/download Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com> Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/95656348-9a9c-4213-a56b-4604864084e8 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com> --- .github/actions/setup/action.yml | 15 +++++++++ .github/workflows/ci.yml | 57 ++++++++++++++++++++++---------- 2 files changed, 55 insertions(+), 17 deletions(-) create mode 100644 .github/actions/setup/action.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 00000000..e64ea34a --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,15 @@ +name: 'Setup Node.js with cached dependencies' +description: 'Sets up Node.js and restores node_modules from the artifact uploaded by the setup job.' + +runs: + using: composite + steps: + - uses: actions/setup-node@v4 + with: + node-version: '20' + - uses: actions/download-artifact@v4 + with: + name: node-modules + path: . + - run: tar -xzf node-modules.tar.gz && rm node-modules.tar.gz + shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66260529..5ed900d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,10 +4,16 @@ on: pull_request: types: [opened, synchronize, reopened] +permissions: + contents: read + jobs: - lint: - name: Lint + setup: + name: Install Dependencies runs-on: ubuntu-latest + permissions: + contents: read + actions: write steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -15,41 +21,58 @@ jobs: node-version: '20' cache: 'npm' - run: npm ci + - run: tar -czf node-modules.tar.gz node_modules + - uses: actions/upload-artifact@v4 + with: + name: node-modules + path: node-modules.tar.gz + retention-days: 1 + + lint: + name: Lint + needs: setup + runs-on: ubuntu-latest + permissions: + contents: read + actions: read + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup - run: npm run lint format-check: name: Format Check + needs: setup runs-on: ubuntu-latest + permissions: + contents: read + actions: read steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: '20' - cache: 'npm' - - run: npm ci + - uses: ./.github/actions/setup - run: npm run format:check build: name: Build + needs: setup runs-on: ubuntu-latest + permissions: + contents: read + actions: read steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: '20' - cache: 'npm' - - run: npm ci + - uses: ./.github/actions/setup - run: npm run build test: name: Test & Coverage + needs: setup runs-on: ubuntu-latest + permissions: + contents: read + actions: read steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: '20' - cache: 'npm' - - run: npm ci + - uses: ./.github/actions/setup - name: Enforce 80% coverage run: npm run test:coverage