Skip to content

Add GitHub Actions CI/CD pipeline for treebase-core with PostgreSQL support#294

Merged
rvosa merged 5 commits intomasterfrom
copilot/add-ci-cd-pipeline
Dec 21, 2025
Merged

Add GitHub Actions CI/CD pipeline for treebase-core with PostgreSQL support#294
rvosa merged 5 commits intomasterfrom
copilot/add-ci-cd-pipeline

Conversation

Copy link
Contributor

Copilot AI commented Dec 21, 2025

Implements automated build and test pipeline for treebase-core module with JUnit test execution and PostgreSQL database integration.

Workflow Configuration

  • Triggers: Push/PR to main/master/develop branches, manual dispatch
  • Environment: Ubuntu latest, Java 8 (Temurin), Maven with dependency caching
  • Security: Explicit minimal GITHUB_TOKEN permissions (contents:read, checks:write, pull-requests:write)
  • Database: PostgreSQL 12 service container for test execution

Pipeline Steps

  1. Set up PostgreSQL database service (treebasedb)
  2. Configure database connection properties for tests
  3. Build treebase-core module
  4. Execute JUnit test suite with database connectivity
  5. Publish test reports (always runs, even on test failure)

Implementation

Created .github/workflows/ci.yml:

PostgreSQL Service

services:
  postgres:
    image: postgres:12
    env:
      POSTGRES_DB: treebasedb
      POSTGRES_USER: treebase_user
      POSTGRES_PASSWORD: treebase_pass
    options: >-
      --health-cmd pg_isready
      --health-interval 10s
      --health-timeout 5s
      --health-retries 5
    ports:
      - 5432:5432

Database Configuration

- name: Configure database properties for tests
  run: |
    mkdir -p /tmp/mesquite
    cat > treebase-core/src/test/resources/jdbc.properties << EOF
    jdbc.driverClassName=org.postgresql.Driver
    jdbc.url=jdbc:postgresql://localhost:5432/treebasedb
    jdbc.username=treebase_user
    jdbc.password=treebase_pass
    mesquite.folder_dir=/tmp/mesquite
    EOF

Build and Test

- name: Build treebase-core
  run: mvn -B clean compile -f treebase-core/pom.xml
  
- name: Run tests
  run: mvn -B test -f treebase-core/pom.xml
  
- name: Publish Test Report
  uses: dorny/test-reporter@v1
  if: always()
  with:
    name: JUnit Test Results
    path: treebase-core/target/surefire-reports/*.xml
    reporter: java-junit

The workflow automatically provisions a PostgreSQL database and configures the JDBC properties required by the test suite, resolving the ${jdbc.driverClassName} configuration issue.

Original prompt

Implement a GitHub Actions CI/CD pipeline that builds and tests treebase-core, which already has junit tests in it.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 21, 2025 14:33
Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com>
Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GitHub Actions CI/CD pipeline for treebase-core Add GitHub Actions CI/CD pipeline for treebase-core Dec 21, 2025
Copilot AI requested a review from rvosa December 21, 2025 14:37
@rvosa
Copy link
Contributor

rvosa commented Dec 21, 2025

@copilot many tests are failing because ${jdbc.driverClassName} is not defined. This project uses postgres as its database. Fix this problem accordingly.

Copilot AI and others added 2 commits December 21, 2025 14:40
Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com>
Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 21, 2025

@copilot many tests are failing because ${jdbc.driverClassName} is not defined. This project uses postgres as its database. Fix this problem accordingly.

Fixed in commit c791c1f. The workflow now:

  1. Sets up a PostgreSQL 12 service container with database treebasedb
  2. Automatically creates jdbc.properties with the PostgreSQL driver configuration:
    • jdbc.driverClassName=org.postgresql.Driver
    • JDBC URL pointing to the containerized PostgreSQL instance
    • Test database credentials
  3. Creates the mesquite directory required by tests

Tests will now have access to a functional PostgreSQL database during CI runs.

Copilot AI changed the title Add GitHub Actions CI/CD pipeline for treebase-core Add GitHub Actions CI/CD pipeline for treebase-core with PostgreSQL support Dec 21, 2025
@rvosa rvosa marked this pull request as ready for review December 21, 2025 14:55
@rvosa rvosa merged commit 0ac0f51 into master Dec 21, 2025
0 of 2 checks passed
@rvosa rvosa deleted the copilot/add-ci-cd-pipeline branch December 21, 2025 14:56
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