add CI pipeline for pull requests (prettier, tsc, lint, unit tests, sonar) #52

Closed
opened 2026-04-10 10:47:18 +00:00 by GuillaumeHemmen · 0 comments

Checklist

  • I have searched existing issues and pull requests to ensure this feature
    has not been requested before
  • I have reviewed the documentation to confirm this feature doesn't already
    exist
  • This feature aligns with the project's goals

Feature Description

Add a Forgejo Actions CI workflow that runs automatically on every pull request
targeting the master branch. The pipeline enforces code quality gates before
merging by running formatting, type-checking, linting, unit tests, and static
analysis.

Problem Statement

Currently there is no automated quality gate on pull requests. This means
formatting regressions, TypeScript errors, lint violations, or failing tests can
be merged undetected.

Proposed Solution

Introduce .forgejo/workflows/pr.yaml with the following jobs (all running on a
Docker runner using a shared Node/Yarn CI image):

Job Command Depends on
prettier yarn qa:prettier:check
tsc yarn qa:tsc:version + yarn qa:tsc
lint yarn qa:lint
unit-testing yarn qa:unit_test + upload test-report.xml / coverage/lcov.info as artifact
sonar SonarQube PR analysis with sonar.pullrequest.* parameters unit-testing

The SonarQube step consumes the Jest artifact (test report + lcov coverage) and
runs a PR-scoped analysis so results are decorated directly on the pull request.

Use Case

Any contributor opening a pull request against master gets immediate feedback
on:

  • Code style (Prettier)
  • Type safety (TypeScript)
  • Code quality rules (ESLint)
  • Test regressions (Jest)
  • Deeper static analysis and coverage trends (SonarQube)

Alternatives Considered

Running checks only on master post-merge (current state via master.yaml)
catches issues too late and forces remediation commits on the main branch.

Examples

# .forgejo/workflows/pr.yaml (excerpt)
on:
  pull_request:
    branches:
      - master

jobs:
  unit-testing:
    runs-on: docker
    steps:
      - uses: actions/checkout@v4
      - run: yarn install
      - run: yarn run qa:unit_test
      - uses: actions/upload-artifact@v3
        with:
          name: jest
          path: |
            test-report.xml
            coverage/lcov.info

  sonar:
    needs: unit-testing
    steps:
      - uses: actions/download-artifact@v3
        with:
          name: jest
      - run: |
          sonar-scanner \
            -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} \
            -Dsonar.pullrequest.branch=${{ github.head_ref }} \
            -Dsonar.pullrequest.base=${{ github.base_ref }}

Implementation Ideas

The workflow file is ready at .forgejo/workflows/pr.yaml. The only
prerequisite is that the SONAR_TOKEN secret is configured in the repository
settings.

Additional Context

  • CI image used: git.van-hemmen.com/actions/sindri:ci-26.8.1
  • SonarQube scanner image:
    git.van-hemmen.com/guillaumehemmen/sonar-scanner:latest
  • Companion workflows already exist for dev and master branches.
## Checklist - [x] I have searched existing issues and pull requests to ensure this feature has not been requested before - [x] I have reviewed the documentation to confirm this feature doesn't already exist - [x] This feature aligns with the project's goals ## Feature Description Add a Forgejo Actions CI workflow that runs automatically on every pull request targeting the `master` branch. The pipeline enforces code quality gates before merging by running formatting, type-checking, linting, unit tests, and static analysis. ## Problem Statement Currently there is no automated quality gate on pull requests. This means formatting regressions, TypeScript errors, lint violations, or failing tests can be merged undetected. ## Proposed Solution Introduce `.forgejo/workflows/pr.yaml` with the following jobs (all running on a Docker runner using a shared Node/Yarn CI image): | Job | Command | Depends on | |----------------|-----------------------------------------------------------------------------------|----------------| | `prettier` | `yarn qa:prettier:check` | | | `tsc` | `yarn qa:tsc:version` + `yarn qa:tsc` | | | `lint` | `yarn qa:lint` | | | `unit-testing` | `yarn qa:unit_test` + upload `test-report.xml` / `coverage/lcov.info` as artifact | | | `sonar` | SonarQube PR analysis with `sonar.pullrequest.*` parameters | `unit-testing` | The SonarQube step consumes the Jest artifact (test report + lcov coverage) and runs a PR-scoped analysis so results are decorated directly on the pull request. ## Use Case Any contributor opening a pull request against `master` gets immediate feedback on: - Code style (Prettier) - Type safety (TypeScript) - Code quality rules (ESLint) - Test regressions (Jest) - Deeper static analysis and coverage trends (SonarQube) ## Alternatives Considered Running checks only on `master` post-merge (current state via `master.yaml`) catches issues too late and forces remediation commits on the main branch. ## Examples ```yaml # .forgejo/workflows/pr.yaml (excerpt) on: pull_request: branches: - master jobs: unit-testing: runs-on: docker steps: - uses: actions/checkout@v4 - run: yarn install - run: yarn run qa:unit_test - uses: actions/upload-artifact@v3 with: name: jest path: | test-report.xml coverage/lcov.info sonar: needs: unit-testing steps: - uses: actions/download-artifact@v3 with: name: jest - run: | sonar-scanner \ -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} \ -Dsonar.pullrequest.branch=${{ github.head_ref }} \ -Dsonar.pullrequest.base=${{ github.base_ref }} ``` ## Implementation Ideas The workflow file is ready at `.forgejo/workflows/pr.yaml`. The only prerequisite is that the `SONAR_TOKEN` secret is configured in the repository settings. ## Additional Context - CI image used: `git.van-hemmen.com/actions/sindri:ci-26.8.1` - SonarQube scanner image: `git.van-hemmen.com/guillaumehemmen/sonar-scanner:latest` - Companion workflows already exist for `dev` and `master` branches.
GuillaumeHemmen changed title from feat: add CI pipeline for pull requests (prettier, tsc, lint, unit tests, sonar) to add CI pipeline for pull requests (prettier, tsc, lint, unit tests, sonar) 2026-04-10 11:10:46 +00:00
GuillaumeHemmen added reference 52-add-CI-pipeline-for-pull-requests 2026-04-10 11:15:21 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openrn/react-native-logging-tools#52
No description provided.