Skip to content

Setup Initial CI/CD Pipeline via GitHub Actions #102

Description

@annikaholmqvist94

Description
We need to implement a continuous integration (CI) and continuous delivery (CD) workflow to automate our testing and build processes. Currently, we lack an automated way to verify that new code doesn't break existing functionality or violate our architectural standards.

The initial focus will be on the CI part: ensuring the project builds, stays formatted, and passes all tests on every Pull Request.

Proposed Architecture
We will use GitHub Actions with a workflow file located in .github/workflows/main.yml.

Scope of Work
Environment Setup: Define a runner (e.g., ubuntu-latest) and configure the required JDK/runtime environment.

Build Automation: Implement a step to compile the backend code (e.g., ./mvnw clean compile ).

Automated Testing: Add a step to run all unit and integration tests automatically on every push and pull_request to the main branch.

Artifact Handling: (Optional) Configure the workflow to upload the build artifact (JAR/WAR file) if the tests pass.

Environment Variables: Configure the pipeline to handle secrets and environment variables required for tests (e.g., database connection strings for integration tests).

Required Files
.github/workflows/ci.yml: The main workflow definition.

.env.example: Updated to ensure the CI environment knows which variables to mock.

README.md: Updated with a "Build Status" badge.

Checklist
[ x ] Create .github/workflows/ directory.

[ x ] Implement ci.yml with Build and Test jobs.

[ x ] Configure caching for dependencies (Maven/Gradle/npm) to speed up builds.

[ x ] Add variables from .env file in githubs secrets.

[ x ] Ensure the pipeline fails if any test fails.

[ x ] Verify that the pipeline runs successfully on a test Pull Request.

[ x ] Upload artifact only when merge to main.

Expected Outcome
Every Pull Request will automatically trigger a build and test suite. Merging will be blocked if the CI pipeline fails, ensuring a stable and working main branch at all times.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions