Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8d48e97
Use pgjdbc rather than pgjdbc-ng in CI
jcflack Feb 18, 2025
0ff417f
Factor out and unify the CI jshell script
jcflack Feb 18, 2025
5ca0ad3
Use new JVM options from JEPs 471 and 472
jcflack Feb 19, 2025
6c8f272
More, necessary, GitHub Actions workflow polishing
jcflack Feb 20, 2025
f2894cd
There's a version of bash that can't ${foo,, ?
jcflack Feb 20, 2025
c5f9ae4
Merge chore/JEP472/gha into trackjdk/REL1_6_STABLE/JEP472
jcflack Feb 20, 2025
39504d2
Merge trackjdk/REL1_6_STABLE/JEP472 into REL1_6_STABLE
jcflack Feb 21, 2025
6527185
java.security.manager=disallow to run unenforced
jcflack Feb 21, 2025
a4ce7fc
Restrict trusted CREATE FUNCTION when unenforced
jcflack Feb 21, 2025
94dbf3c
Add pljava.allow_unenforced configuration setting
jcflack Feb 21, 2025
acdb9d7
Hook JVM abort and exit
jcflack Feb 21, 2025
752ba01
Add pljava.allow_unenforced_udt config setting
jcflack Feb 23, 2025
fa82ade
Document unenforced operation
jcflack Feb 24, 2025
a780da7
Defensively copy system properties
jcflack Feb 24, 2025
192e910
Use defensive system-property copies in examples
jcflack Feb 24, 2025
c4e55d5
Handle defaulted properties in FrozenProperties
jcflack Feb 24, 2025
43ab7c3
Add example code to see Java's boot module layer
jcflack Feb 27, 2025
621505f
Java version vs. java.security.manager settings
jcflack Feb 27, 2025
d28e9fa
Mention how to see Java's module resolution log
jcflack Mar 3, 2025
ea0977f
Merge trackjdk/REL1_6_STABLE/JEP486 into REL1_6_STABLE
jcflack Mar 5, 2025
5096830
Assume javadoc-21 form of URLs into Javadoc
jcflack Mar 5, 2025
e8121ee
Likewise update releasenotes-pre1_6
jcflack Mar 5, 2025
f47a840
Reformat some code
jcflack Mar 7, 2025
194a0f8
Merge chore/REL1_6_STABLE/javadoc21 into REL1_6_STABLE
jcflack Mar 8, 2025
4f5d9d8
Enable CI for Windows MSVC in GitHub Actions
jcflack Mar 8, 2025
4752abf
Also enable MinGW-w64 test with PG from pacman
jcflack Mar 8, 2025
00507e2
Re-enable the whole CI matrix
jcflack Mar 8, 2025
9561c13
Merge chore/REL1_6_STABLE/windowsgha into REL1_6_STABLE
jcflack Mar 9, 2025
49ad1b0
Late JEP486 doc and diagnostic message tweaks
jcflack Mar 10, 2025
7d93594
Match implementor non-case-folded form to provider
jcflack Mar 10, 2025
fc16b49
Improve documentation of conditional execution
jcflack Mar 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
288 changes: 288 additions & 0 deletions .github/workflows/ci-lazypg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,288 @@
# This workflow will build and test PL/Java against a version of PostgreSQL
# lazily obtained (either preinstalled in the GitHub Actions runner environment,
# or obtained from a package repository if the runner does not provide one).
# Arrange for the matrix to include a pg version, for cases where one must be
# installed.

name: CI lazy getting PostgreSQL

permissions:
contents: read

on:
push:
branches: [ master, REL1_6_STABLE ]
pull_request:
branches: [ master, REL1_6_STABLE ]

jobs:
build:
if: true

runs-on: ${{ matrix.oscc.os }}
continue-on-error: true
strategy:
matrix:
oscc:
- os: ubuntu-latest
cc: gcc
- os: macos-13
cc: clang
pg: 17
- os: macos-14
cc: clang
pg: 17
- os: windows-latest
cc: msvc
- os: windows-latest
cc: mingw
java: [11, 17, 21, 23]
exclude:
- oscc: {os: windows-latest}
java: 17
- oscc: {os: windows-latest}
java: 23

steps:

- name: Check for JDK preinstalled
id: jdkcheck
shell: bash
env:
JAVAVER: ${{ matrix.java }}
run: |
if
candidate="JAVA_HOME_${JAVAVER}_${RUNNER_ARCH}"
echo -n "Environment contains $candidate? "
[[ -n ${!candidate+set} ]]
then
echo yes
echo >>"$GITHUB_ENV" "JAVA_HOME=${!candidate}"
echo >>"$GITHUB_OUTPUT" java_found=true
elif
candidate="JAVA_HOME_${JAVAVER}_$(tr A-Z a-z <<<${RUNNER_ARCH})"
echo -ne 'no\n'"Environment contains $candidate? "
[[ -n ${!candidate+set} ]]
then
echo yes
echo >>"$GITHUB_ENV" "JAVA_HOME=${!candidate}"
echo >>"$GITHUB_OUTPUT" java_found=true
else
echo -e 'no\n'"only: ${!JAVA_HOME_*}"
echo >>"$GITHUB_OUTPUT" java_found=false
fi

- name: Fetch a JDK
if: ${{ 'false' == steps.jdkcheck.outputs.java_found }}
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b
with:
distribution: temurin
java-version: ${{ matrix.java }}

- name: Compute absolute paths for java and jshell
shell: bash
run: |
if [[ $RUNNER_OS == Windows ]]
then
echo >>"$GITHUB_ENV" "ABS_JAVA=$JAVA_HOME"'\bin\java'
echo >>"$GITHUB_ENV" "ABS_JSHELL=$JAVA_HOME"'\bin\jshell'
else
echo >>"$GITHUB_ENV" "ABS_JAVA=$JAVA_HOME/bin/java"
echo >>"$GITHUB_ENV" "ABS_JSHELL=$JAVA_HOME/bin/jshell"
fi

- name: Set PGCONFIG in environment, getting PostgreSQL if needed (!mingw)
if: ${{ 'mingw' != matrix.oscc.cc }}
shell: bash
env:
PGVER: ${{ matrix.oscc.pg }}
run: |
if [[ $RUNNER_OS == Linux ]]
then
echo >>"$GITHUB_ENV" PGCONFIG=pg_config
elif [[ $RUNNER_OS == Windows ]]
then
echo >>"$GITHUB_ENV" PGCONFIG="$PGBIN"'\pg_config'
elif [[ $RUNNER_OS == macOS ]]
then
echo '::group::brew update'
brew update
echo '::endgroup::'
echo "::group::brew install postgresql@$PGVER"
# HOMEBREW_GITHUB_ACTIONS will suppress the formula's initdb
HOMEBREW_GITHUB_ACTIONS=1 HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 \
brew install postgresql@"$PGVER"
echo '::endgroup::'
pfx=$(brew --prefix postgresql@"$PGVER")
echo >>"$GITHUB_ENV" PGCONFIG="$pfx/bin/pg_config"
fi

- name: Set PGCONFIG in environment, getting gcc and PostgreSQL (mingw)
if: ${{ 'mingw' == matrix.oscc.cc }}
shell: C:\shells\msys2bash.cmd {0}
run: |
pacman -S --noconfirm \
mingw-w64-x86_64-gcc \
mingw-w64-x86_64-postgresql
echo >>"$GITHUB_ENV" PGCONFIG='c:\msys64\mingw64\bin\pg_config'

- name: Report Java, Maven, and PostgreSQL versions
shell: bash
run: |
"$ABS_JAVA" -version
mvn --version
"$PGCONFIG"

- name: Obtain PG development files (Ubuntu, PGDG)
if: ${{ 'Linux' == runner.os }}
run: |
pgver=$("$PGCONFIG" --version)
pgver=${pgver##PostgreSQL }
pgver=${pgver%% *}
pgver=${pgver%.*}
echo '::group::Install PGDG key and repo'
curl -s -S https://www.postgresql.org/media/keys/ACCC4CF8.asc |
gpg --dearmor |
sudo dd of=/etc/apt/trusted.gpg.d/apt.postgresql.org.gpg
echo \
deb \
http://apt.postgresql.org/pub/repos/apt \
"$(lsb_release -cs)-pgdg" \
main |
sudo tee /etc/apt/sources.list.d/pgdg.list
echo '::endgroup::'
echo '::group::apt-get update'
sudo apt-get update
echo '::endgroup::'
echo "::group::apt-get install postgresql-server-dev-$pgver"
sudo apt-get install postgresql-server-dev-"$pgver" libkrb5-dev
echo '::endgroup::'

- name: Confirm PostgreSQL development files are present
shell: python
run: |
from os import getenv
from os.path import join
from re import sub
from subprocess import check_output

pgconfig = getenv('PGCONFIG')

def ask_pg_config(what):
return check_output([pgconfig, '--'+what]).splitlines()[0]

pgch = join(ask_pg_config('includedir-server'), b'pg_config.h')

with open(pgch, 'r') as f:
line = [ln for ln in f if ln.startswith('#define PG_VERSION_STR ')][0]

vers = sub(r'#define PG_VERSION_STR "(.*)"\n', r'\1', line)

print('PostgreSQL development files are present:', vers, sep='\n')

- name: Check out PL/Java
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: pljava

- name: Set plethora of MSVC environment variables (Windows MSVC)
if: ${{ 'Windows' == runner.os && 'msvc' == matrix.oscc.cc }}
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756

- name: Build PL/Java (Windows MSVC)
if: ${{ 'Windows' == runner.os && 'msvc' == matrix.oscc.cc }}
working-directory: pljava
# shell: cmd because of the issue described for ilammy/msvc-dev-cmd
# with Actions bash prepending stuff to the just-carefully-created PATH
shell: cmd
run: |
mvn clean install --batch-mode ^
-Dpgsql.pgconfig="%PGCONFIG%" ^
-Psaxon-examples -Ppgjdbc ^
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn

- name: Build PL/Java (Linux, macOS)
if: ${{ 'Windows' != runner.os }}
working-directory: pljava
run: |
mvn clean install --batch-mode \
-Dpgsql.pgconfig="$PGCONFIG" \
-Psaxon-examples -Ppgjdbc \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn

- name: Build PL/Java (Windows MinGW-w64)
if: ${{ 'Windows' == runner.os && 'mingw' == matrix.oscc.cc }}
working-directory: pljava
shell: C:\shells\msys2bash.cmd {0}
run: |
PATH='/c/msys64/mingw64/bin:'"$PATH"
"$M2"/mvn clean install --batch-mode \
-Dpgsql.pgconfig="$PGCONFIG" \
-Psaxon-examples -Ppgjdbc \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn

- name: Install and test PL/Java
working-directory: pljava
shell: bash
run: |
packageJar=$(find pljava-packaging -name pljava-pg*.jar -print)

mavenRepo="$HOME/.m2/repository"

saxonVer=$(
find "$mavenRepo/net/sf/saxon/Saxon-HE" \
-name 'Saxon-HE-*.jar' -print |
sort |
tail -n 1
)
saxonVer=${saxonVer%/*}
saxonVer=${saxonVer##*/}

jdbcJar=$(
find "$mavenRepo/org/postgresql/postgresql" \
-name 'postgresql-*.jar' -print |
sort |
tail -n 1
)

#
# The runner on a Unix-like OS is running as a non-privileged user, but
# has passwordless sudo available (needed to install the PL/Java files
# into the system directories where the supplied PostgreSQL lives). By
# contrast, on Windows the runner has admin privilege, and can install
# the files without any fuss (but later below, pg_ctl will have to be
# used when starting PostgreSQL; pg_ctl has a Windows-specific ability
# to drop admin privs so postgres will not refuse to start).
#
# The Git for Windows bash environment includes a find command, and the
# things found have unixy paths returned. Make them Windowsy here, with
# a hardcoded assumption they start with /c which should become c: (as
# appears to be the case in the Windows runner currently).
#
echo '::group::Install files from the package jar'
if [[ $RUNNER_OS == Windows ]]
then
pathSep=';'
"$ABS_JAVA" -Dpgconfig="$PGCONFIG" -jar "$packageJar"
function toWindowsPath() {
local p
p="c:${1#/c}"
printf "%s" "${p//\//\\}"
}
jdbcJar="$(toWindowsPath "$jdbcJar")"
mavenRepo="$(toWindowsPath "$mavenRepo")"
else
pathSep=':'
sudo "$ABS_JAVA" -Dpgconfig="$PGCONFIG" -jar "$packageJar"
fi
echo '::endgroup::'

"$ABS_JSHELL" \
-execution local \
"-J--class-path=$packageJar$pathSep$jdbcJar" \
"--class-path=$packageJar" \
"-J--add-modules=java.sql.rowset,jdk.httpserver" \
"-J-Dpgconfig=$PGCONFIG" \
"-J-DmavenRepo=$mavenRepo" \
"-J-DsaxonVer=$saxonVer" \
CI/integration
Loading
Loading