Skip to content

ci: add required ci.yml workflow (closes #46)#82

Merged
don-petry merged 1 commit into
mainfrom
claude/issue-46-20260408-2243
Apr 8, 2026
Merged

ci: add required ci.yml workflow (closes #46)#82
don-petry merged 1 commit into
mainfrom
claude/issue-46-20260408-2243

Conversation

@don-petry

Copy link
Copy Markdown
Contributor

Summary

  • Adds .github/workflows/ci.yml to resolve the compliance finding (issue Compliance: missing-ci.yml #46)
  • Ecosystem detection auto-skips backend/frontend jobs when source trees are absent
  • All actions are SHA-pinned per the org Action Pinning Policy

CI gates included

Backend (Go — runs when go.mod is detected):

  • golangci-lint static analysis
  • go build ./cmd/api/
  • gqlgen validate (GraphQL schema)
  • Unit tests (go test ./... -short)
  • Integration tests (go test -tags=integration ./...)
  • ≥80% line coverage check

Frontend (Node/Expo — runs when package.json is detected):

  • tsc --noEmit type check
  • eslint . --max-warnings 0
  • prettier --check
  • graphql-codegen --check
  • jest --ci --coverage with ≥80% branch and line threshold

Standards compliance

  • permissions: {} at top level with per-job least-privilege scopes (contents: read)
  • concurrency block: group: ci-${{ github.ref }}, cancel-in-progress: true
  • All actions pinned to commit SHAs looked up via gh api (not guessed)
  • Triggers: push + pull_request to main

Closes #46

Generated with Claude Code

Copilot AI review requested due to automatic review settings April 8, 2026 22:45
@coderabbitai

coderabbitai Bot commented Apr 8, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@don-petry has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minutes and 4 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 1 minutes and 4 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: de4d20c3-9794-4c21-89d0-cd022952fa98

📥 Commits

Reviewing files that changed from the base of the PR and between a8fd8b8 and 51242cd.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-46-20260408-2243

Comment @coderabbitai help to get the list of available commands and usage tips.

@don-petry

Copy link
Copy Markdown
Contributor Author

@don-petry — PR #82 is ready for review. Self-review passed: SHA-pinned actions, permissions: {} + per-job least-privilege, concurrency cancel-in-progress, all required CI gates from coding-standards.md §7.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the required GitHub Actions CI workflow (.github/workflows/ci.yml) to satisfy the org compliance requirement from issue #46, with separate backend (Go) and frontend (Node/Expo) gates that are conditionally run based on ecosystem detection.

Changes:

  • Introduces a CI workflow triggered on push/pull_request to main, with permissions: {} and concurrency cancellation.
  • Adds an ecosystem-detection job that conditionally enables backend/frontend jobs.
  • Implements Go (lint/build/gqlgen validate/tests/coverage) and Node (tsc/eslint/prettier/codegen/jest+coverage) gates with SHA-pinned actions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml
Comment on lines +41 to +47
if find . -name 'go.mod' -not -path '*/vendor/*' | grep -q .; then
echo "go=true" >> "$GITHUB_OUTPUT"
else
echo "go=false" >> "$GITHUB_OUTPUT"
fi

if find . -name 'package.json' -not -path '*/node_modules/*' | grep -q .; then

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ecosystem detection currently returns just booleans based on finding any go.mod / package.json anywhere in the repo. This can trigger backend/frontend jobs even when the only match is in an unrelated subdirectory (and the downstream jobs run commands from repo root), causing CI failures. Consider restricting detection to the expected project roots (e.g., markets-api/go.mod, markets-app/package.json) or outputting the detected directory path and using it as working-directory in subsequent jobs.

Suggested change
if find . -name 'go.mod' -not -path '*/vendor/*' | grep -q .; then
echo "go=true" >> "$GITHUB_OUTPUT"
else
echo "go=false" >> "$GITHUB_OUTPUT"
fi
if find . -name 'package.json' -not -path '*/node_modules/*' | grep -q .; then
if [ -f ./go.mod ]; then
echo "go=true" >> "$GITHUB_OUTPUT"
else
echo "go=false" >> "$GITHUB_OUTPUT"
fi
if [ -f ./package.json ]; then

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
Comment on lines +65 to +77
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version-file: go.mod
cache: true

- name: Lint
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6

- name: Build
run: go build ./cmd/api/

- name: Validate GraphQL schema
run: go run github.com/99designs/gqlgen validate

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backend job assumes the Go module is at repo root (go-version-file: go.mod) and runs go build ./cmd/api/ from repo root. Per repo docs, the backend is intended to live under markets-api/, so this will fail once that layout is present. Update the job to run in the backend module directory (e.g., set defaults.run.working-directory: markets-api and point go-version-file at markets-api/go.mod, or compute the module dir from detect outputs).

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
Comment on lines +107 to +126
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: lts/*
cache: npm

- name: Install dependencies
run: npm ci

- name: Type check
run: npx tsc --noEmit

- name: Lint
run: npx eslint . --max-warnings 0

- name: Format check
run: npx prettier --check .

- name: GraphQL codegen check
run: npx graphql-codegen --check

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frontend job runs npm ci / npx ... from repo root, but repo docs describe the Expo app under markets-app/. As written, CI will fail when markets-app/package.json exists because npm ci will be executed in the wrong directory (and setup-node caching will also use the wrong lockfile). Set working-directory: markets-app (and cache-dependency-path: markets-app/package-lock.json if using setup-node cache) or derive the app dir from detect outputs.

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml

- name: Coverage check (≥80% line)
run: |
go test ./... -short -count=1 -coverprofile=coverage.out

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage gate is described in coding-standards.md as go test -coverprofile=coverage.out (no -short). Currently the workflow runs coverage with go test ./... -short ... -coverprofile=coverage.out, which may under-measure coverage compared to the documented CI gate. Align the command with the documented standard (or update the doc/justification if -short is intentionally required).

Suggested change
go test ./... -short -count=1 -coverprofile=coverage.out
go test ./... -count=1 -coverprofile=coverage.out

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
Comment on lines +127 to +128
- name: Test + coverage (≥80% branch and line)
run: npx jest --ci --coverage --coverageThreshold='{"global":{"lines":80,"branches":80}}'

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--coverageThreshold argument includes backslashes: --coverageThreshold='{"global":{"lines":80,"branches":80}}'. In bash, backslashes inside single quotes are literal, so Jest receives a string containing backslashes (invalid JSON) and will likely error. Remove the backslashes so the JSON passed to Jest is {"global":{"lines":80,"branches":80}} without any extra escaping.

Copilot uses AI. Check for mistakes.
Adds the required CI pipeline (coding-standards.md §7) with:
- Ecosystem detection (Go / Node) so jobs skip gracefully on empty trees
- Backend: golangci-lint, go build, gqlgen validate, unit + integration tests, ≥80% line coverage
- Frontend: tsc, eslint, prettier, graphql-codegen check, jest ≥80% branch+line coverage
- SHA-pinned actions, permissions: {} + per-job least-privilege, concurrency cancel

Closes #46

Co-authored-by: don-petry <don-petry@users.noreply.github.com>
@don-petry don-petry force-pushed the claude/issue-46-20260408-2243 branch from f7a4368 to 51242cd Compare April 8, 2026 22:53
@sonarqubecloud

sonarqubecloud Bot commented Apr 8, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

@don-petry don-petry merged commit 4235652 into main Apr 8, 2026
18 of 19 checks passed
@don-petry don-petry deleted the claude/issue-46-20260408-2243 branch April 8, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compliance: missing-ci.yml

2 participants