TRK-106 - [FIX] Implement CI + SonarQube and Deploy#30
Merged
Conversation
eduardofpaula
approved these changes
Jul 3, 2025
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



PR DESCRIPTION:
This Pull Request significantly upgrades the Continuous Integration/Continuous Deployment (CI/CD) pipeline for the
Track5SEM2023SERVERGo backend project. The changes introduce a more robust, modular, and secure workflow, ensuring higher code quality and controlled deployments. Key enhancements include a pre-validation step for Jira issue linking, clear separation of linting, building, unit testing, and integration testing phases, optimized Go module caching, and a refined deployment strategy.JIRA LINK:
WHAT WAS DONE OR CHANGED:
jira-branch-validationJob:main,sprint-*branches, and internal GitHub PR merge/head refs (pull/<PR_NUMBER>/merge,pull/<PR_NUMBER>/head).lint-and-buildJob:go fmt), dependency management (go mod tidy,go mod download), and application building (go build).unit-testsJob:go test -coverprofile).-tags=integrationflag was removed from this job to ensure it only runs unit tests, allowing integration tests to be handled separately..envfile creation for test environment configuration.coverage.outreport as an artifact.integration-testsJob:go test -tags=integration ./...to specifically target integration tests.unit-tests, ensuring integration tests run only after unit tests pass..envfiles for its environment.actions/cache@v4steps.actions/setup-go@v5withcache: trueandcache-dependency-path: src/go.sumin all relevant jobs (lint-and-build,unit-tests,integration-tests) for efficient and correct caching of Go modules.sonarcloud-analysis,sonarqube-selfhosted):unit-teststo ensure coverage reports are available for analysis.sonar.go.coverage.reportPathsare correctly set tosrc/coverage.out.deployJob Enhancements:sonarcloud-analysis,sonarqube-selfhosted, andintegration-tests, acting as a final quality gate./app/Track-5Sem2025SERVER.pushorpull_requestevents targetingmainor anysprint-*branch.HOW TO TEST:
To validate the CI/CD pipeline changes:
Trigger Workflow:
TRK-XXX-my-feature-branch). Push to this branch.mainbranch or anysprint-Xbranch (e.g.,sprint-101).mainbranch or anysprint-Xbranch.INVALID-999-my-feature). Push to this branch.jira-branch-validationjob behaves as expected (passes for valid/exempt, fails for invalid).Monitor GitHub Actions:
Verify Job Execution and Dependencies:
jira-branch-validationis the first job and its status aligns with the branch name.lint-and-buildruns only afterjira-branch-validationpasses.unit-testsruns only afterlint-and-buildcompletes successfully.integration-testsruns only afterunit-testscompletes successfully.sonarcloud-analysisandsonarqube-selfhostedrun afterunit-tests.deployjob runs only if all preceding quality gates (sonarcloud-analysis,sonarqube-selfhosted, andintegration-tests) pass.Verify Remote Deployment (for
mainandsprint-*pushes/PRs):ssh YOUR_USER@YOUR_SERVER_IP).cd /app/Track-5Sem2025SERVER.git branchandgit log --onelineto confirm the correct branch is checked out and the latest commits are present.Verify Sonar Reports:
CHECKLIST: