Skip to content

Commit

Permalink
A try with MinGW-w64 also enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jcflack committed Mar 7, 2025
1 parent 0098b47 commit adbd04a
Showing 1 changed file with 13 additions and 43 deletions.
56 changes: 13 additions & 43 deletions .github/workflows/ci-lazypg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
# pg: 17
- os: windows-latest
cc: msvc
# - os: windows-latest
# cc: mingw
- os: windows-latest
cc: mingw
java: [21]

steps:
Expand Down Expand Up @@ -86,7 +86,8 @@ jobs:
echo >>"$GITHUB_ENV" "ABS_JSHELL=$JAVA_HOME/bin/jshell"
fi
- name: Set PGCONFIG in environment, installing PostgreSQL if needed
- name: Set PGCONFIG in environment, getting PostgreSQL if needed (!mingw)
if: ${{ 'mingw' != matrix.oscc.cc }}
shell: bash
env:
PGVER: ${{ matrix.oscc.pg }}
Expand All @@ -111,6 +112,13 @@ jobs:
echo >>"$GITHUB_ENV" PGCONFIG="$pfx/bin/pg_config"
fi
- name: Set PGCONFIG in environment, getting PostgreSQL (mingw)
if: ${{ 'mingw' == matrix.oscc.cc }}
shell: C:\shells\msys2bash.cmd {0}
run: |
pacman -S --noconfirm 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: |
Expand Down Expand Up @@ -181,7 +189,7 @@ jobs:
# with Actions bash prepending stuff to the just-carefully-created PATH
shell: cmd
run: |
%M2%\mvn clean install --batch-mode ^
mvn clean install --batch-mode ^
-Dpgsql.pgconfig="%PGCONFIG%" ^
-Psaxon-examples -Ppgjdbc ^
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
Expand All @@ -198,46 +206,8 @@ jobs:
- 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}""'
shell: C:\shells\msys2bash.cmd {0}
run: |
HOME=$( (cd .. && pwd) )
"$M2"/mvn clean install --batch-mode \
-Dpgsql.pgconfig="$PGCONFIG" \
-Psaxon-examples -Ppgjdbc \
Expand Down

0 comments on commit adbd04a

Please sign in to comment.