Skip to content

Commit 0ac0f51

Browse files
authored
Merge pull request #294 from TreeBASE/copilot/add-ci-cd-pipeline
Add GitHub Actions CI/CD pipeline for treebase-core with PostgreSQL support
2 parents ca4fb37 + c791c1f commit 0ac0f51

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CI - Build and Test
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
branches: [ main, master, develop ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build-and-test:
12+
name: Build and Test treebase-core
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
contents: read
17+
checks: write
18+
pull-requests: write
19+
20+
services:
21+
postgres:
22+
image: postgres:12
23+
env:
24+
POSTGRES_DB: treebasedb
25+
POSTGRES_USER: treebase_user
26+
POSTGRES_PASSWORD: treebase_pass
27+
options: >-
28+
--health-cmd pg_isready
29+
--health-interval 10s
30+
--health-timeout 5s
31+
--health-retries 5
32+
ports:
33+
- 5432:5432
34+
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v4
38+
39+
- name: Set up JDK 8
40+
uses: actions/setup-java@v4
41+
with:
42+
java-version: '8'
43+
distribution: 'temurin'
44+
cache: 'maven'
45+
46+
- name: Configure database properties for tests
47+
run: |
48+
mkdir -p /tmp/mesquite
49+
cat > treebase-core/src/test/resources/jdbc.properties << EOF
50+
jdbc.driverClassName=org.postgresql.Driver
51+
jdbc.url=jdbc:postgresql://localhost:5432/treebasedb
52+
jdbc.username=treebase_user
53+
jdbc.password=treebase_pass
54+
mesquite.folder_dir=/tmp/mesquite
55+
EOF
56+
57+
- name: Build treebase-core
58+
run: mvn -B clean compile -f treebase-core/pom.xml
59+
60+
- name: Run tests
61+
run: mvn -B test -f treebase-core/pom.xml
62+
63+
- name: Publish Test Report
64+
uses: dorny/test-reporter@v1
65+
if: always()
66+
with:
67+
name: JUnit Test Results
68+
path: treebase-core/target/surefire-reports/*.xml
69+
reporter: java-junit
70+
fail-on-error: true

0 commit comments

Comments
 (0)