Skip to content

Set up GitHub Actions CI pipeline for automated testing and Docker builds#30

Open
Copilot wants to merge 3 commits intomainfrom
copilot/fix-8e01ded9-1cf2-464d-b7c5-2d7a4a91af18
Open

Set up GitHub Actions CI pipeline for automated testing and Docker builds#30
Copilot wants to merge 3 commits intomainfrom
copilot/fix-8e01ded9-1cf2-464d-b7c5-2d7a4a91af18

Conversation

Copy link
Copy Markdown

Copilot AI commented Sep 21, 2025

This PR implements a comprehensive GitHub Actions CI pipeline to automate testing and Docker builds as requested in issue #27.

What's Added

CI Workflow (.github/workflows/ci.yml)

The new workflow provides two main jobs:

Test Job - Runs on every push to main and all pull requests:

  • Sets up Java 21 with Eclipse Temurin distribution
  • Implements Gradle dependency caching for faster subsequent builds
  • Automatically handles gradlew permissions
  • Runs the full test suite with ./gradlew test
  • Builds the application with ./gradlew build

Docker Job - Runs only on pushes to main branch after tests pass:

  • Uses Docker Buildx for advanced build capabilities
  • Authenticates with GitHub Container Registry (ghcr.io) using built-in GITHUB_TOKEN
  • Builds and pushes Docker images with intelligent tagging:
    • latest for main branch
    • Branch-specific tags (main-<sha>)
    • SHA-based tags for precise version tracking
  • Implements Docker layer caching to optimize build performance

Key Benefits

  • Automated Quality Assurance: Every code change is automatically tested before merge
  • Continuous Deployment: Docker images are automatically built and published on main branch updates
  • Performance Optimized: Gradle and Docker caching significantly reduce build times
  • Zero Configuration: Uses GitHub's built-in authentication and registry
  • Multi-Environment Support: Separate workflows for testing (PRs) and deployment (main)

Technical Details

The workflow leverages modern GitHub Actions features including:

  • Dependency caching with actions/cache@v4
  • Docker multi-platform builds with docker/setup-buildx-action@v3
  • Automated container registry authentication
  • Conditional job execution (Docker builds only on main)

The implementation follows CI/CD best practices and provides immediate feedback on code quality while automating the deployment pipeline for the Spring Boot application.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits September 21, 2025 14:50
Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
…ilds

Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
Copilot AI changed the title [WIP] @Preponderous-Software/preponderous-dot-org/issues/27 Set up GitHub Actions CI pipeline for automated testing and Docker builds Sep 21, 2025
@dmccoystephenson dmccoystephenson marked this pull request as ready for review September 21, 2025 16:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Sets up a GitHub Actions CI pipeline to run Gradle tests/builds and build/push Docker images to GHCR, and slightly simplifies the Dockerfile.

  • Adds CI workflow with separate test and Docker build jobs
  • Implements Gradle and Docker layer caching
  • Removes permissive .gradle directory creation from Dockerfile

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

File Description
.github/workflows/ci.yml Adds CI pipeline with test and Docker build/push jobs, caching, and metadata-driven tagging
Dockerfile Removes unnecessary .gradle directory creation and chmod

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread .github/workflows/ci.yml
run: ./gradlew build

docker:
runs-on: ubuntu-latest
Copy link

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

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

The workflow uses GITHUB_TOKEN to push to GHCR but does not explicitly grant packages: write permission. Without explicit permissions, pushes can fail or run with overly permissive defaults; add least-privilege permissions to the docker job: permissions: contents: read, packages: write.

Suggested change
runs-on: ubuntu-latest
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
Comment on lines +35 to +37
- name: Run tests
run: ./gradlew test

Copy link

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

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

Gradle's build task executes tests by default, so running test and then build runs tests twice. Either run only ./gradlew build, or keep the test step and change the build step to ./gradlew build -x test (or use check + assemble) to avoid redundant work.

Suggested change
- name: Run tests
run: ./gradlew test

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
run: ./gradlew test

- name: Build application
run: ./gradlew build
Copy link

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

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

Gradle's build task executes tests by default, so running test and then build runs tests twice. Either run only ./gradlew build, or keep the test step and change the build step to ./gradlew build -x test (or use check + assemble) to avoid redundant work.

Suggested change
run: ./gradlew build
run: ./gradlew build -x test

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
Copy link

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

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

[nitpick] Actions are referenced by mutable tags (e.g., @v4/@v3/@v5); pin them to specific commit SHAs to prevent supply-chain attacks and ensure reproducibility. Apply this to all uses steps in this file (lines 14, 17, 23, 47, 50, 53, 61, 70) by replacing the tag with the corresponding commit SHA from each action's repository.

Copilot uses AI. Check for mistakes.
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.

3 participants