Skip to content

Fix GitHub Actions build by aligning Java runtime and decoupling tests from local PostgreSQL#2

Draft
sayednowshad with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-failing-github-actions-job
Draft

Fix GitHub Actions build by aligning Java runtime and decoupling tests from local PostgreSQL#2
sayednowshad with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-failing-github-actions-job

Conversation

Copilot AI commented Jul 26, 2026

Copy link
Copy Markdown

The build job was failing because CI compiled with JDK 17 while the project targets Java 21. After correcting that mismatch, test execution also depended on a local PostgreSQL instance, which is unavailable in Actions.

  • CI runtime alignment

    • Updated .github/workflows/maven.yml to use Java 21 in actions/setup-java, matching pom.xml (<java.version>21</java.version>).
  • Test isolation from external DB

    • Added com.h2database:h2 as a test-scoped dependency.
    • Added src/test/resources/application.properties with in-memory H2 datasource settings (PostgreSQL compatibility mode) so Spring context tests do not require localhost:5432.
  • Context test configuration cleanup

    • Kept StegoshieldGatewayApplicationTests as a standard @SpringBootTest, relying on test profile datasource config instead of disabling JDBC/JPA autoconfiguration.
# .github/workflows/maven.yml
- name: Set up JDK 21
  uses: actions/setup-java@v4
  with:
    java-version: '21'
    distribution: 'temurin'
    cache: maven

@sayednowshad sayednowshad left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

ok

Copilot AI changed the title [WIP] Fix the failing GitHub Actions job 'build' Fix GitHub Actions build by aligning Java runtime and decoupling tests from local PostgreSQL Jul 26, 2026
Copilot AI requested a review from sayednowshad July 26, 2026 16:24
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.

2 participants