Skip to content

Evaluate GitHub Actions for CI #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 91 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
1bd55f4
Create two GitHub Actions workflows
jcflack Aug 29, 2020
d90688a
Get -dev on Linux runner. MacOS has it already.
jcflack Aug 30, 2020
29cbff0
Add the install-and-test step
jcflack Aug 31, 2020
8da1d2b
Make sure $pgConfig is not empty
jcflack Aug 30, 2020
31a46c2
Why is the wrong java version used in a sudo?
jcflack Aug 30, 2020
7ee89a6
sudo "$JAVA_HOME"/bin/java ?
jcflack Aug 31, 2020
e990e0d
Add a Build PL/Java (Windows MinGW-w64) step
jcflack Sep 2, 2020
dbd0a0b
Windows tweaks to the install-and-test step
jcflack Sep 1, 2020
e0c627d
The Strawberry PG installation is an impostor
jcflack Sep 2, 2020
25e326d
Munge (or is it unmunge?) pathnames for Windows
jcflack Sep 2, 2020
a77d74b
Merge pull request #2 from mingw-gha
jcflack Sep 2, 2020
f2e96a1
Exclude windows-mingw from the matrix for now
jcflack Sep 2, 2020
a28228f
Update ci-sourcepg.yml and add ci-packagedpg.yml
jcflack Sep 11, 2020
774fae9
Merge branch 'master' into chore/master/gha
jcflack Sep 14, 2020
06f64e8
Add control file in preparation for next release
jcflack Oct 18, 2020
b597a20
Add a Cast annotation
jcflack Oct 20, 2020
a870347
Generalize SQLActionsImpl to Container<annot>
jcflack Oct 22, 2020
19396c8
Generalize processSQLAction to processRepeatable
jcflack Oct 22, 2020
6feac3a
Support @Cast in DDRProcessor
jcflack Oct 24, 2020
ef3796f
Adapt an example to use @Cast
jcflack Oct 24, 2020
d56f715
Have CI also test undeploy actions
jcflack Oct 24, 2020
a0efb99
Examples no longer need SQLActions
jcflack Oct 24, 2020
ee0d156
Whitespace only
jcflack Oct 24, 2020
b574e6d
Remove obsolete imports in examples
jcflack Oct 25, 2020
841bef5
Merge pull request #321 from feature/REL1_6_STABLE/castgen
jcflack Oct 25, 2020
bb88d82
Allow PL/Java's class loader to make magic URLs
jcflack Oct 26, 2020
9b60f13
Add a test of getResourceAsStream
jcflack Oct 26, 2020
919cc76
Add test of ResourceBundle.getBundle
jcflack Oct 27, 2020
8a61323
Merge pull request #323 from bug/REL1_6_STABLE/issue322
jcflack Oct 27, 2020
4f4beec
Add an out= element to the Function annotation
jcflack Oct 29, 2020
f9cebce
Teach SQL generator out= in Function annotation
jcflack Oct 29, 2020
07efa02
Add example functions declaring composite returns
jcflack Oct 29, 2020
06a7a76
Fix nameAndType for no-name case
jcflack Oct 30, 2020
9453414
Merge pull request #325 from feature/REL1_6_STABLE/rowreturn
jcflack Oct 30, 2020
fe5dd3b
Add an Aggregate annotation
jcflack Oct 25, 2020
c6c6821
Generate SQL for the Aggregate annotation
jcflack Oct 30, 2020
4021f3a
Add some example aggregates
jcflack Oct 30, 2020
70217a9
Simplify slightly and improve examples
jcflack Oct 31, 2020
fb27817
Allow Aggregate annotation placed on a method
jcflack Nov 7, 2020
1835657
Merge pull request #326 from feature/REL1_6_STABLE/agg-gen
jcflack Nov 7, 2020
fc96933
Add an Operator annotation
jcflack Oct 31, 2020
8781ffa
Teach SQL generator to produce CREATE OPERATOR
jcflack Nov 4, 2020
ab63d0b
Add Operator annotation in an example
jcflack Nov 1, 2020
1b19870
Allow a shorthand commutator = SELF
jcflack Nov 4, 2020
8bb0ce4
Generate synthetic-function declarations
jcflack Nov 4, 2020
c9f3dab
Teach the runtime about commute/negate info in AS
jcflack Nov 3, 2020
7e94aa1
Allow another shorthand notation, TWIN
jcflack Nov 4, 2020
258a820
Add deployment-time tests
jcflack Nov 5, 2020
db3393f
Add missing bits of Aggregate annotation
jcflack Nov 12, 2020
dbf410f
Mistrust localized punctuation (issue #312)
jcflack Oct 13, 2020
e0cdb54
Change some log levels in ComplexScalar
jcflack Nov 12, 2020
14c85d2
Fix a copy/pasto and other minor doc fixes
jcflack Nov 13, 2020
f358a91
Merge pull request #327 from feature/REL1_6_STABLE/operator
jcflack Nov 13, 2020
3500ea6
Fix some broken doc links
jcflack Nov 15, 2020
05a0604
Better workaround for javac 10 and 11 issue
jcflack Nov 16, 2020
056e4b9
Improve two shouldn't-happen messages
jcflack Nov 16, 2020
7ea30ee
Remove reference to workaround in versions.md
jcflack Nov 16, 2020
155f290
Merge pull request #329 from bug/REL1_6_STABLE/issue328
jcflack Nov 16, 2020
873c698
Split off pre-1.6 release notes in REL1_6_STABLE
jcflack Nov 16, 2020
3aabd42
Update release notes.
jcflack Nov 17, 2020
6d8f8fd
Poke migration-management versions for 1.5.7
jcflack Nov 17, 2020
5ff0d72
Add control file in preparation for next release
jcflack Nov 17, 2020
9706f20
Merge branch 'REL1_5_STABLE' into REL1_6_STABLE
jcflack Nov 17, 2020
77831a5
Update release notes
jcflack Nov 17, 2020
0000d87
Poke migration-management versions for 1.6.1
jcflack Nov 17, 2020
c445975
Add control file in preparation for next release
jcflack Nov 17, 2020
9d24901
Evolve transformXML example with adjust & indent
jcflack Nov 18, 2020
e3d98e9
Add example of XSLT 1.0 calling a Java method
jcflack Nov 20, 2020
5e6955a
Fix copy-pasto in Operator annotation checking
jcflack Nov 20, 2020
faf9883
Function args in REVOKE aren't optional pre-PG10
jcflack Nov 20, 2020
5791fe9
Don't fail reading policy_urls as non-superuser
jcflack Nov 21, 2020
165fe6f
Fix a lint warning
jcflack Nov 21, 2020
e1b1941
Relent on testing MSVC PG 13 in AppVeyor
jcflack Nov 21, 2020
969e888
Merge pull request #332 from bug/REL1_6_STABLE/issue330
jcflack Nov 22, 2020
a5fe818
Merge pull request #333 from feature/REL1_6_STABLE/xsltexamples
jcflack Nov 22, 2020
41d9861
Implement a TrialPolicy
jcflack Nov 21, 2020
206a963
Add TrialPolicy$Permission
jcflack Nov 22, 2020
b03e86f
Old typo, benign but spams the TrialPolicy log
jcflack Nov 22, 2020
d2d03a3
Avoid blocking to log from a non-PG thread
jcflack Nov 23, 2020
3b25cf4
A duplicate line snuck in somehow
jcflack Nov 23, 2020
1d51fcf
Relent also on MinGW PG 13 in AppVeyor
jcflack Nov 24, 2020
6092da7
Add Travis and AppVeyor tests of TrialPolicy
jcflack Nov 24, 2020
bb41b33
Document TrialPolicy
jcflack Nov 25, 2020
700b8b8
Merge pull request #334 from bug/REL1_6_STABLE/issue331
jcflack Nov 25, 2020
2c8d992
Add FALLTHROUGH comments in C switch statements
jcflack Nov 21, 2020
2081148
Two bits of Java lint
jcflack Nov 25, 2020
fd125b0
Merge pull request #335 from chore/REL1_6_STABLE/fallthrough
jcflack Nov 26, 2020
6f75545
Merge branch 'REL1_6_STABLE' into chore/master/gha
jcflack Nov 26, 2020
c404fb4
Port recent updates over to GitHub Actions script
jcflack Nov 26, 2020
4d557c1
In the Actions runner image, 13 is the new 12
jcflack Nov 26, 2020
c8a8227
Precede apt-get install with apt-get update?
jcflack Nov 26, 2020
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
322 changes: 322 additions & 0 deletions .github/workflows/ci-packagedpg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
# This workflow will build and test PL/Java against versions of PostgreSQL
# installed from prebuilt packages.

name: PL/Java CI with PostgreSQL prebuilt packaged versions

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

jobs:
build:
if: false

runs-on: ${{ matrix.oscc.os }}
strategy:
matrix:
oscc:
- os: ubuntu-latest
cc: gcc
- os: macos-latest
cc: clang
- os: windows-latest
cc: msvc
- os: windows-latest
cc: mingw
java: [9, 11, 12, 14, 15-ea]
pgsql: [12, 11, 10, 9.6, 9.5]

steps:

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

- name: Install PostgreSQL
shell: bash
run: echo here a miracle occurs

- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}

- name: Report Java, Maven, and PostgreSQL versions (Linux, macOS)
if: ${{ 'Windows' != runner.os }}
run: |
java -version
mvn --version
pg_config # might need attention to the path

- name: Report Java, Maven, and PostgreSQL versions (Windows)
if: ${{ 'Windows' == runner.os }}
run: |
java -version
mvn --version
& "$Env:PGBIN\pg_config" # might need attention to the path

- name: Build PL/Java (Linux, macOS)
if: ${{ 'Windows' != runner.os }}
working-directory: pljava
run: |
pgConfig=pg_config # might need attention to the path
mvn clean install --batch-mode \
-Dpgsql.pgconfig="$pgConfig" \
-Psaxon-examples -Ppgjdbc-ng \
-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
#
# GitHub Actions will allow 'bash' as a shell choice, even on a Windows
# runner, in which case it's the bash from Git for Windows. That isn't the
# same as the msys64\usr\bin\bash that we want; what's more, while both
# rely on a cygwin DLL, they don't rely on the same one, and an attempt
# to exec one from the other leads to a "fatal error - cygheap base
# mismatch". So, the bash we want has to be started by something other
# than the bash we've got. In this case, set shell: to a command that
# will use cmd to start the right bash.
#
# Some of the MinGW magic is set up by the bash profile run at "login", so
# bash must be started with -l. That profile ends with a cd $HOME, so to
# avoid changing the current directory, set HOME=. first (credit for that:
# https://superuser.com/a/806371). As set above, . is really the pljava
# working-directory, so the bash script should start by resetting HOME to
# the path of its parent.
#
# The runner is provisioned with a very long PATH that includes separate
# bin directories for pre-provisioned packages. The MinGW profile replaces
# that with a much shorter path, so mvn and pg_config below must be given
# as absolute paths (using M2 and PGBIN supplied in the environment) or
# they won't be found. As long as mvn itself can be found, it is able
# to find java without difficulty, using the JAVA_HOME that is also in
# the environment.
#
# Those existing variables in the environment are all spelled in Windows
# style with drive letters, colons, and backslashes, rather than the MinGW
# unixy style, but the mingw bash doesn't seem to object.
#
# If you use the runner-supplied bash to examine the environment, you will
# see MSYSTEM=MINGW64 already in it, but that apparently is something the
# runner-supplied bash does. It must be set here before invoking the MinGW
# bash directly.
#
env:
HOME: .
MSYSTEM: MINGW64
shell: 'cmd /C "c:\msys64\usr\bin\bash -l "{0}""'
run: |
HOME=$( (cd .. && pwd) )
pgConfig="$PGBIN"'\pg_config' # might need attention to the path
"$M2"/mvn clean install --batch-mode \
-Dpgsql.pgconfig="$pgConfig' \
-Psaxon-examples -Ppgjdbc-ng \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn

- name: Install and test PL/Java
if: ${{ '9' != matrix.java || 'Windows' != runner.os }}
working-directory: pljava
shell: bash
run: |
pgConfig=pg_config # might need attention to the path

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/com/impossibl/pgjdbc-ng/pgjdbc-ng-all" \
-name 'pgjdbc-ng-all-*.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 Windows runner seems to have an extra pg_config somewhere on the
# path, that reports it was built with MinGW and installed in paths
# containing Strawberry that don't really exist. $PGBIN\pg_config refers
# to a different build made with MSVC, and those directories really
# exist, so specify that one explicitly when running on Windows.
#
# 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).
#
if [[ $RUNNER_OS == Windows ]]
then
pathSep=';'
pgConfig="$PGBIN"'\pg_config'
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 "$JAVA_HOME"/bin/java -Dpgconfig="$pgConfig" -jar "$packageJar"
fi

jshell \
-execution local \
"-J--class-path=$packageJar$pathSep$jdbcJar" \
"--class-path=$packageJar" \
"-J--add-modules=java.sql,java.sql.rowset" \
"-J-Dpgconfig=$pgConfig" \
"-J-Dcom.impossibl.shadow.io.netty.noUnsafe=true" \
"-J-DmavenRepo=$mavenRepo" \
"-J-DsaxonVer=$saxonVer" - <<\ENDJSHELL

boolean succeeding = false; // begin pessimistic

import static java.nio.file.Paths.get
import java.sql.Connection
import org.postgresql.pljava.packaging.Node
import static org.postgresql.pljava.packaging.Node.q
import static org.postgresql.pljava.packaging.Node.stateMachine
import static org.postgresql.pljava.packaging.Node.isVoidResultSet
import static org.postgresql.pljava.packaging.Node.s_isWindows

Path javaLibDir =
get(System.getProperty("java.home"), s_isWindows ? "bin" : "lib")

Path libjvm = (
"Mac OS X".equals(System.getProperty("os.name"))
? Stream.of("libjli.dylib", "jli/libjli.dylib")
.map(s -> javaLibDir.resolve(s))
.filter(Files::exists).findFirst().get()
: javaLibDir.resolve(s_isWindows ? "jvm.dll" : "server/libjvm.so")
);

String vmopts = "-enableassertions:org.postgresql.pljava... -Xcheck:jni"

Node n1 = Node.get_new_node("TestNode1")

if ( s_isWindows )
n1.use_pg_ctl(true)

/*
* Keep a tally of the three types of diagnostic notices that may be
* received, and, independently, how many represent no-good test results
* (error always, but also warning if seen from the tests in the
* examples.jar deployment descriptor).
*/
Map<String,Integer> results =
Stream.of("info", "warning", "error", "ng").collect(
LinkedHashMap<String,Integer>::new,
(m,k) -> m.put(k, 0), (r,s) -> {})

boolean isDiagnostic(Object o, Set<String> whatIsNG)
{
if ( ! ( o instanceof Throwable ) )
return false;
String[] parts = Node.classify((Throwable)o);
String type = parts[0];
results.compute(type, (k,v) -> 1 + v);
if ( whatIsNG.contains(type) )
results.compute("ng", (k,v) -> 1 + v);
return true;
}

try (
AutoCloseable t1 = n1.initialized_cluster();
AutoCloseable t2 = n1.started_server(Map.of(
"client_min_messages", "info",
"pljava.vmoptions", vmopts,
"pljava.libjvm_location", libjvm.toString()
));
)
{
try ( Connection c = n1.connect() )
{
succeeding = true; // become optimistic, will be using &= below

succeeding &= stateMachine(
"create extension no result",
null,

q(c, "create extension pljava")
.flatMap(Node::semiFlattenDiagnostics)
.peek(Node::peek),

// state 1: consume any diagnostics, or to state 2 with same item
(o,p,q) -> isDiagnostic(o, Set.of("error")) ? 1 : -2,

// state 2: must be end of input
(o,p,q) -> null == o
);
}

/*
* Get a new connection; 'create extension' always sets a near-silent
* logging level, and PL/Java only checks once at VM start time, so in
* the same session where 'create extension' was done, logging is
* somewhat suppressed.
*/
try ( Connection c = n1.connect() )
{
succeeding &= stateMachine(
"saxon path examples path",
null,

Node.installSaxonAndExamplesAndPath(c,
System.getProperty("mavenRepo"),
System.getProperty("saxonVer"),
true)
.flatMap(Node::semiFlattenDiagnostics)
.peek(Node::peek),

// states 1,2: diagnostics* then a void result set (saxon install)
(o,p,q) -> isDiagnostic(o, Set.of("error")) ? 1 : -2,
(o,p,q) -> isVoidResultSet(o, 1, 1) ? 3 : false,

// states 3,4: diagnostics* then a void result set (set classpath)
(o,p,q) -> isDiagnostic(o, Set.of("error")) ? 3 : -4,
(o,p,q) -> isVoidResultSet(o, 1, 1) ? 5 : false,

// states 5,6: diagnostics* then void result set (example install)
(o,p,q) -> isDiagnostic(o, Set.of("error", "warning")) ? 5 : -6,
(o,p,q) -> isVoidResultSet(o, 1, 1) ? 7 : false,

// states 7,8: diagnostics* then a void result set (set classpath)
(o,p,q) -> isDiagnostic(o, Set.of("error")) ? 7 : -8,
(o,p,q) -> isVoidResultSet(o, 1, 1) ? 9 : false,

// state 9: must be end of input
(o,p,q) -> null == o
);
}
} catch ( Throwable t )
{
succeeding = false;
throw t;
}

System.out.println(results);
succeeding &= (0 == results.get("ng"));
System.exit(succeeding ? 0 : 1)
ENDJSHELL
Loading