3434# pg: 17
3535 - os : windows-latest
3636 cc : msvc
37- # - os: windows-latest
38- # cc: mingw
37+ - os : windows-latest
38+ cc : mingw
3939 java : [21]
4040
4141 steps :
8686 echo >>"$GITHUB_ENV" "ABS_JSHELL=$JAVA_HOME/bin/jshell"
8787 fi
8888
89- - name : Set PGCONFIG in environment, installing PostgreSQL if needed
89+ - name : Set PGCONFIG in environment, getting PostgreSQL if needed (!mingw)
90+ if : ${{ 'mingw' != matrix.oscc.cc }}
9091 shell : bash
9192 env :
9293 PGVER : ${{ matrix.oscc.pg }}
@@ -111,6 +112,13 @@ jobs:
111112 echo >>"$GITHUB_ENV" PGCONFIG="$pfx/bin/pg_config"
112113 fi
113114
115+ - name : Set PGCONFIG in environment, getting PostgreSQL (mingw)
116+ if : ${{ 'mingw' == matrix.oscc.cc }}
117+ shell : C:\shells\msys2bash.cmd {0}
118+ run : |
119+ pacman -S --noconfirm mingw-w64-x86_64-postgresql
120+ echo >>"$GITHUB_ENV" PGCONFIG='c:\msys64\mingw64\bin\pg_config'
121+
114122 - name : Report Java, Maven, and PostgreSQL versions
115123 shell : bash
116124 run : |
@@ -181,7 +189,7 @@ jobs:
181189 # with Actions bash prepending stuff to the just-carefully-created PATH
182190 shell : cmd
183191 run : |
184- %M2%\ mvn clean install --batch-mode ^
192+ mvn clean install --batch-mode ^
185193 -Dpgsql.pgconfig="%PGCONFIG%" ^
186194 -Psaxon-examples -Ppgjdbc ^
187195 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
@@ -198,46 +206,8 @@ jobs:
198206 - name : Build PL/Java (Windows MinGW-w64)
199207 if : ${{ 'Windows' == runner.os && 'mingw' == matrix.oscc.cc }}
200208 working-directory : pljava
201- #
202- # GitHub Actions will allow 'bash' as a shell choice, even on a Windows
203- # runner, in which case it's the bash from Git for Windows. That isn't the
204- # same as the msys64\usr\bin\bash that we want; what's more, while both
205- # rely on a cygwin DLL, they don't rely on the same one, and an attempt
206- # to exec one from the other leads to a "fatal error - cygheap base
207- # mismatch". So, the bash we want has to be started by something other
208- # than the bash we've got. In this case, set shell: to a command that
209- # will use cmd to start the right bash.
210- #
211- # Some of the MinGW magic is set up by the bash profile run at "login", so
212- # bash must be started with -l. That profile ends with a cd $HOME, so to
213- # avoid changing the current directory, set HOME=. first (credit for that:
214- # https://superuser.com/a/806371). As set above, . is really the pljava
215- # working-directory, so the bash script should start by resetting HOME to
216- # the path of its parent.
217- #
218- # The runner is provisioned with a very long PATH that includes separate
219- # bin directories for pre-provisioned packages. The MinGW profile replaces
220- # that with a much shorter path, so mvn and pg_config below must be given
221- # as absolute paths (using M2 and PGBIN supplied in the environment) or
222- # they won't be found. As long as mvn itself can be found, it is able
223- # to find java without difficulty, using the JAVA_HOME that is also in
224- # the environment.
225- #
226- # Those existing variables in the environment are all spelled in Windows
227- # style with drive letters, colons, and backslashes, rather than the MinGW
228- # unixy style, but the mingw bash doesn't seem to object.
229- #
230- # If you use the runner-supplied bash to examine the environment, you will
231- # see MSYSTEM=MINGW64 already in it, but that apparently is something the
232- # runner-supplied bash does. It must be set here before invoking the MinGW
233- # bash directly.
234- #
235- env :
236- HOME : .
237- MSYSTEM : MINGW64
238- shell : ' cmd /C "c:\msys64\usr\bin\bash -l "{0}""'
209+ shell : C:\shells\msys2bash.cmd {0}
239210 run : |
240- HOME=$( (cd .. && pwd) )
241211 "$M2"/mvn clean install --batch-mode \
242212 -Dpgsql.pgconfig="$PGCONFIG" \
243213 -Psaxon-examples -Ppgjdbc \
0 commit comments