Skip to content

Commit d1a1c03

Browse files
committed
Merge branch 'main_ci'
2 parents d276071 + ab73fd1 commit d1a1c03

File tree

383 files changed

+71900
-14024
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

383 files changed

+71900
-14024
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Import-Module BitsTransfer
2+
Install-Package -Force 7Zip4Powershell -ProviderName PowerShellGet
3+
if ($Env:JDK -eq 9)
4+
{
5+
$url = "https://download.java.net/java/GA/jdk9/9.0.4/binaries/openjdk-9.0.4_windows-x64_bin.tar.gz"
6+
$out = "C:\Program Files\Java\jdk9"
7+
Start-BitsTransfer -Source $url -Destination "$out.tar.gz"
8+
Expand-7Zip "$out.tar.gz" "$out"
9+
Expand-7Zip "$out\jdk9.tar" "$out"
10+
Move-Item "$out\jdk-9.0.4\*" "$out"
11+
}
12+
if ($Env:JDK -eq 10)
13+
{
14+
$url = "https://download.java.net/java/GA/jdk10/10/binaries/openjdk-10_windows-x64_bin.tar.gz"
15+
$out = "C:\Program Files\Java\jdk10"
16+
Start-BitsTransfer -Source $url -Destination "$out.tar.gz"
17+
Expand-7Zip "$out.tar.gz" "$out"
18+
Expand-7Zip "$out\jdk10.tar" "$out"
19+
Move-Item "$out\jdk-10\*" "$out"
20+
}

.appveyor/appveyor_mingw.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
set -e
2+
JAVA_HOME="C:\Program Files\Java\jdk$1"
3+
libjvm="$JAVA_HOME\bin\server\jvm.dll"
4+
PATH=$JAVA_HOME/bin:$PATH
5+
javac -version
6+
pacman -S mingw-w64-x86_64-postgresql --noconfirm
7+
pgConfig='C:\msys64\mingw64\bin\pg_config'
8+
"$pgConfig"
9+
cd /c/projects/pljava
10+
mvn clean install \
11+
-Dpgsql.pgconfig="$pgConfig" \
12+
-Dpljava.libjvmdefault="$libjvm" \
13+
-Psaxon-examples -Ppgjdbc-ng --batch-mode \
14+
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
REM a bat file because PowerShell makes a mess of stderr output, and a multiline
2+
REM command intended for CMD in appveyor.yml gets broken up.
3+
4+
IF %SYS%==MINGW (
5+
set pgConfig=C:\msys64\mingw64\bin\pg_config
6+
) ELSE (
7+
set pgConfig=%ProgramFiles%\PostgreSQL\%PG%\bin\pg_config
8+
set libjvm=%JAVA_HOME%/bin/server/jvm.dll
9+
)
10+
11+
IF %SYS%==MINGW (
12+
C:\msys64\usr\bin\env MSYSTEM=MINGW64 ^
13+
C:\msys64\usr\bin\bash -l ^
14+
-c "/c/projects/pljava/.appveyor/appveyor_mingw.sh %JDK%"
15+
) ELSE (
16+
"%pgConfig%"
17+
mvn clean install ^
18+
-Dpgsql.pgconfig="%pgConfig%" ^
19+
-Dpljava.libjvmdefault="%libjvm%" ^
20+
-Psaxon-examples -Ppgjdbc-ng --batch-mode ^
21+
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
22+
)

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*.{c,h,java,xml,ddr,project}]
4+
indent_style = tab
5+
indent_size = tab
6+
tab_width = 4
7+
8+
[*.css]
9+
indent_style = space
10+
indent_size = 2
11+
12+
# Imported from another project with different indentation
13+
[JarX.java]
14+
indent_style = space
15+
indent_size = 2
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Cloudberry PL/Java CI
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
types: [opened, synchronize, reopened, edited]
7+
push:
8+
branches: [ main ]
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
env:
19+
CLOUDBERRY_REPO: apache/cloudberry
20+
CLOUDBERRY_REF: main
21+
COMPOSE_FILE: pljava/concourse/docker/ubuntu22.04/docker-compose.yml
22+
CONTAINER_NAME: cbdb-pljava
23+
24+
jobs:
25+
ci:
26+
name: Build + Smoke (Docker)
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 180
29+
steps:
30+
- name: Free disk space
31+
run: |
32+
sudo rm -rf /usr/share/dotnet || true
33+
sudo rm -rf /opt/ghc || true
34+
sudo rm -rf /usr/local/share/boost || true
35+
sudo rm -rf /usr/local/lib/android || true
36+
sudo rm -rf /opt/hostedtoolcache || true
37+
sudo docker system prune -af || true
38+
df -h
39+
40+
- name: Checkout PL/Java (this repo)
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 1
44+
path: pljava
45+
46+
- name: Checkout Cloudberry source
47+
uses: actions/checkout@v4
48+
with:
49+
repository: ${{ env.CLOUDBERRY_REPO }}
50+
ref: ${{ env.CLOUDBERRY_REF }}
51+
path: cloudberry
52+
submodules: true
53+
54+
- name: Build and start dev container
55+
run: |
56+
docker compose -f ${{ env.COMPOSE_FILE }} down -v || true
57+
docker compose -f ${{ env.COMPOSE_FILE }} up -d
58+
docker exec ${{ env.CONTAINER_NAME }} sudo find /home/gpadmin/workspace/cloudberry -path /home/gpadmin/workspace/cloudberry/.git -prune -o -exec chown gpadmin:gpadmin {} +
59+
docker exec ${{ env.CONTAINER_NAME }} sudo find /home/gpadmin/workspace/pljava -path /home/gpadmin/workspace/pljava/.git -prune -o -exec chown gpadmin:gpadmin {} +
60+
61+
- name: Build Cloudberry + PL/Java and run tests (installcheck)
62+
run: |
63+
docker exec ${{ env.CONTAINER_NAME }} bash -lc "bash /home/gpadmin/workspace/pljava/concourse/docker/ubuntu22.04/scripts/entrypoint.sh"
64+
65+
- name: Collect logs and results
66+
if: always()
67+
run: |
68+
mkdir -p artifacts
69+
docker logs ${{ env.CONTAINER_NAME }} > artifacts/cbdb-pljava.log 2>&1 || true
70+
docker exec ${{ env.CONTAINER_NAME }} bash -lc "source /usr/local/cloudberry-db/cloudberry-env.sh && source /home/gpadmin/workspace/cloudberry/gpAux/gpdemo/gpdemo-env.sh && gpstate -s" > artifacts/gpstate.txt 2>&1 || true
71+
docker exec ${{ env.CONTAINER_NAME }} bash -lc "source /usr/local/cloudberry-db/cloudberry-env.sh && source /home/gpadmin/workspace/cloudberry/gpAux/gpdemo/gpdemo-env.sh && psql -d template1 -c 'select version()'" > artifacts/version.txt 2>&1 || true
72+
73+
# Regression outputs (if present)
74+
if [ -d pljava/gpdb/tests/results ]; then
75+
tar czf artifacts/pljava-regress-results.tar.gz -C pljava gpdb/tests/results || true
76+
fi
77+
ls -la pljava/gpdb/tests/regression.* 2>/dev/null || true
78+
cp -v pljava/gpdb/tests/regression.* artifacts/ 2>/dev/null || true
79+
80+
# Cloudberry demo cluster logs (if present)
81+
if [ -d cloudberry/gpAux/gpdemo ]; then
82+
find cloudberry/gpAux/gpdemo -maxdepth 4 -type d \( -name pg_log -o -name log \) -print 2>/dev/null || true
83+
tar czf artifacts/cloudberry-demo-logs.tar.gz -C cloudberry gpAux/gpdemo 2>/dev/null || true
84+
fi
85+
86+
- name: Summarize installcheck
87+
if: always()
88+
run: |
89+
LOG="pljava/gpdb/tests/results/installcheck.log"
90+
{
91+
echo "## PL/Java installcheck"
92+
if [ -f "$LOG" ]; then
93+
echo ""
94+
echo "- Log: \`$LOG\`"
95+
echo "- Test results dir: \`pljava/gpdb/tests/results/\`"
96+
echo ""
97+
TOTAL=$(grep -E "^[[:space:]]*test .* \\.\\.\\." -c "$LOG" || true)
98+
OK=$(grep -E "^[[:space:]]*test .* \\.\\.\\. ok" -c "$LOG" || true)
99+
FAILED=$(grep -E "^[[:space:]]*test .* \\.\\.\\. FAILED" -c "$LOG" || true)
100+
echo "- Total: $TOTAL"
101+
echo "- ok: $OK"
102+
echo "- FAILED: $FAILED"
103+
echo ""
104+
echo "Last 50 lines:"
105+
echo ""
106+
echo '```'
107+
tail -n 50 "$LOG" || true
108+
echo '```'
109+
else
110+
echo ""
111+
echo "- No \`installcheck.log\` found (build may have failed early)."
112+
fi
113+
} >> "$GITHUB_STEP_SUMMARY"
114+
115+
- name: Upload artifacts
116+
if: always()
117+
uses: actions/upload-artifact@v4
118+
with:
119+
name: logs-and-results
120+
path: |
121+
artifacts/**
122+
pljava/gpdb/tests/results/**
123+
pljava/gpdb/tests/regression.*
124+
if-no-files-found: ignore
125+
retention-days: 7
126+
127+
- name: Cleanup
128+
if: always()
129+
run: |
130+
docker compose -f ${{ env.COMPOSE_FILE }} down -v || true

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/.classpath
22
/.project
33
/.settings
4+
.idea/
45
target/site
56
target/staging
67
target/javadoc-bundle-options
@@ -10,4 +11,9 @@ pljava-so/target/
1011
target/
1112
*.so
1213
*.zip
13-
concourse/secrets/
14+
concourse/secrets/
15+
nar-maven-plugin/
16+
nar-maven-plugin.tar.gz
17+
gpdb/tests/results/
18+
gpdb/tests/regression.*
19+
artifacts/

.travis.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
if: false
2+
language: minimal
3+
os:
4+
- linux
5+
arch:
6+
- amd64
7+
- ppc64le
8+
dist: bionic
9+
env:
10+
- POSTGRESQL_VERSION: 13
11+
JAVA_VERSION: 15
12+
JVM_IMPL: hotspot
13+
MVN_VERSION: 3.5.2
14+
- POSTGRESQL_VERSION: 12
15+
JAVA_VERSION: 14
16+
JVM_IMPL: hotspot
17+
MVN_VERSION: 3.5.2
18+
- POSTGRESQL_VERSION: 12
19+
JAVA_VERSION: 14
20+
JVM_IMPL: openj9
21+
MVN_VERSION: 3.6.3
22+
- POSTGRESQL_VERSION: 12
23+
JAVA_VERSION: 11
24+
JVM_IMPL: hotspot
25+
MVN_VERSION: 3.6.3
26+
- POSTGRESQL_VERSION: 12
27+
JAVA_VERSION: 9
28+
JVM_IMPL: hotspot
29+
MVN_VERSION: 3.6.3
30+
- POSTGRESQL_VERSION: 10
31+
JAVA_VERSION: 14
32+
JVM_IMPL: hotspot
33+
MVN_VERSION: 3.6.3
34+
- POSTGRESQL_VERSION: 9.5
35+
JAVA_VERSION: 14
36+
JVM_IMPL: hotspot
37+
MVN_VERSION: 3.6.3
38+
39+
jobs:
40+
exclude:
41+
- arch: ppc64le
42+
env:
43+
POSTGRESQL_VERSION: 12
44+
JAVA_VERSION: 9
45+
JVM_IMPL: hotspot
46+
MVN_VERSION: 3.6.3
47+
include:
48+
- os: osx
49+
osx_image: xcode11
50+
arch: amd64
51+
env:
52+
- POSTGRESQL_VERSION: 11
53+
JAVA_VERSION: 14
54+
JVM_IMPL: hotspot
55+
MVN_VERSION: 3.6.3
56+
- os: osx
57+
osx_image: xcode11
58+
arch: amd64
59+
env:
60+
- POSTGRESQL_VERSION: 10
61+
JAVA_VERSION: 14
62+
JVM_IMPL: hotspot
63+
MVN_VERSION: 3.6.3
64+
- os: osx
65+
osx_image: xcode11
66+
arch: amd64
67+
env:
68+
- POSTGRESQL_VERSION: 9.5
69+
JAVA_VERSION: 14
70+
JVM_IMPL: hotspot
71+
MVN_VERSION: 3.6.3
72+
73+
cache:
74+
directories:
75+
- $HOME/.m2
76+
77+
before_install: |
78+
javaUrl=https://api.adoptopenjdk.net/v3/binary/latest
79+
javaUrl="$javaUrl/$JAVA_VERSION/ga/${TRAVIS_OS_NAME//osx/mac}"
80+
javaUrl="$javaUrl/${TRAVIS_CPU_ARCH//amd64/x64}/jdk"
81+
javaUrl="$javaUrl/$JVM_IMPL/normal/adoptopenjdk"
82+
83+
installJdk=$(false && which install-jdk.sh) || {
84+
wget https://raw.githubusercontent.com/sormuras/bach/8c457fd6e46bd9f3f575867dd0c9af1d7edfd5b4/install-jdk.sh
85+
installJdk=./install-jdk.sh
86+
87+
printf '%s\n%s\n%s\n%s\n%s\n' \
88+
'--- install-jdk.sh' \
89+
'+++ install-jdk.sh' \
90+
'@@ -257 +257 @@' \
91+
'- target="${workspace}"/$(tar --list ${tar_options} | head -2 | tail -1 | cut -f 2 -d '"'/' -)/Contents/Home" \
92+
'+ target="${workspace}"/$(tar --list ${tar_options} | sed -n '"'/\/bin\/javac/s///p')" \
93+
| patch "$installJdk"
94+
}
95+
96+
[[ $JAVA_VERSION == 9 ]] && certs=--cacerts || unset certs
97+
98+
. "$installJdk" --url "$javaUrl" ${certs+"$certs"}
99+
100+
mvnUrl=https://archive.apache.org/dist/maven/maven-3
101+
mvnUrl="$mvnUrl/$MVN_VERSION/binaries/apache-maven-$MVN_VERSION-bin.tar.gz"
102+
103+
wget --no-verbose "$mvnUrl" && tar xzf "apache-maven-$MVN_VERSION-bin.tar.gz"
104+
mvn="./apache-maven-$MVN_VERSION/bin/mvn"
105+
"$mvn" --version
106+
107+
. .travis/travis_install_postgresql.sh
108+
109+
install: |
110+
"$pgConfig"
111+
112+
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
113+
libjvm_name="libjli.dylib"
114+
else
115+
libjvm_name="libjvm.so"
116+
fi
117+
libjvm=$(find "$JAVA_HOME" -mindepth 2 -name $libjvm_name | head -n 1)
118+
119+
"$mvn" clean install --batch-mode \
120+
-Dpgsql.pgconfig="$pgConfig" \
121+
-Dpljava.libjvmdefault="$libjvm" \
122+
-Psaxon-examples -Ppgjdbc \
123+
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
124+
125+
script: |
126+
packageJar=$(find pljava-packaging -name pljava-pg*.jar -print)
127+
128+
mavenRepo="$HOME/.m2/repository"
129+
130+
saxonVer=$(
131+
find "$mavenRepo/net/sf/saxon/Saxon-HE" -name 'Saxon-HE-*.jar' -print |
132+
sort |
133+
tail -n 1
134+
)
135+
saxonVer=${saxonVer%/*}
136+
saxonVer=${saxonVer##*/}
137+
138+
jdbcJar=$(
139+
find "$mavenRepo/org/postgresql/postgresql" \
140+
-name 'postgresql-*.jar' -print |
141+
sort |
142+
tail -n 1
143+
)
144+
145+
sudo "$JAVA_HOME"/bin/java -Dpgconfig="$pgConfig" -jar "$packageJar"
146+
147+
"$JAVA_HOME"/bin/jshell \
148+
-execution local \
149+
"-J--class-path=$packageJar:$jdbcJar" \
150+
"--class-path=$packageJar" \
151+
"-J--add-modules=java.sql.rowset" \
152+
"-J-Dpgconfig=$pgConfig" \
153+
"-J-DmavenRepo=$mavenRepo" \
154+
"-J-DsaxonVer=$saxonVer" \
155+
CI/integration
156+
: travis wanted something here at the end once

0 commit comments

Comments
 (0)