Skip to content

Commit 4e1c125

Browse files
committed
Build and release using github actions
1 parent 27f6371 commit 4e1c125

File tree

8 files changed

+322
-16
lines changed

8 files changed

+322
-16
lines changed

.github/workflows/configuration.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Configuration version="" formatVersion="0.4" vcversion="" toolset="">
3+
<title>
4+
</title>
5+
<x86 disabled="no">
6+
<libpq version="y">
7+
<include>d:\postgresql86\include</include>
8+
<lib>d:\postgresql86\lib</lib>
9+
<bin>d:\postgresql86\bin</bin>
10+
</libpq>
11+
<setvcvars>
12+
</setvcvars>
13+
<build_macros>
14+
</build_macros>
15+
<runtime_folder>
16+
</runtime_folder>
17+
</x86>
18+
<x64>
19+
<libpq version="y">
20+
<include>d:\postgresql\include</include>
21+
<lib>d:\postgresql\lib</lib>
22+
<bin>d:\postgresql\bin</bin>
23+
</libpq>
24+
<setvcvars>
25+
</setvcvars>
26+
<build_macros>
27+
</build_macros>
28+
<runtime_folder>
29+
</runtime_folder>
30+
</x64>
31+
<BuildResult>
32+
<Date>03/04/2024 10:49:13</Date>
33+
<VisualStudioVersion>17.0</VisualStudioVersion>
34+
<PlatformToolset>v143</PlatformToolset>
35+
<ToolsVersion>Current</ToolsVersion>
36+
<Platform>arm64</Platform>
37+
</BuildResult>
38+
</Configuration>

.github/workflows/main.yml

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
name: MSBuild
2+
run-name: psql ODBC CI - ${{ github.event.head_commit.message }}
3+
4+
on:
5+
push:
6+
branches: [ "main" ]
7+
tags:
8+
- 'REL-*'
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
env:
13+
# Path to the solution file relative to the root of the project.
14+
SOLUTION_FILE_PATH: .
15+
16+
# Configuration type to build.
17+
# You can convert this to a build matrix if you need coverage of multiple configuration types.
18+
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
19+
BUILD_CONFIGURATION: Release
20+
21+
permissions:
22+
contents: read
23+
24+
jobs:
25+
build_and_test:
26+
runs-on: windows-latest
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
repository: "postgres/postgres.git"
32+
ref: 'master'
33+
- name: 'get meson'
34+
run: |
35+
python -m pip install meson
36+
python -m pip install ninja
37+
- name: Cache Postgres directory
38+
uses: actions/cache@v4
39+
id: cachePostgres
40+
with:
41+
path: d:\postgresql
42+
key: postgresql
43+
- name: Cache Postgres86 directory
44+
uses: actions/cache@v4
45+
id: cachePostgres86
46+
with:
47+
path: d:\postgresql86
48+
key: postgresql86
49+
- name: Cache GNU diffutils for Test on PostgreSQL for Windows
50+
uses: actions/cache@v4
51+
id: cacheDiffutilsZip
52+
with:
53+
path: C:\OTHERBIN\diffutils
54+
key: diffutils-2.8.7-1-bin.zip
55+
env:
56+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
57+
- name: Cache PostgreSQL installer
58+
uses: actions/cache@v4
59+
id: cachePostgresInstaller
60+
with:
61+
path: C:\OTHERBIN\postgresql_install.exe
62+
key: postgresql_installer
63+
- name: Cache pkgconfiglite for Compile using msvc and meson
64+
uses: actions/cache@v4
65+
id: cachePkgConfigLiteZip
66+
with:
67+
path: C:\OTHERBIN\pkgconfiglite
68+
key: pkg-config-lite-0.28-1_bin-win32.zip
69+
env:
70+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
71+
72+
- name: Cache winflexbison for Compile using msvc
73+
uses: actions/cache@v4
74+
id: cacheWinFlexBisonZip
75+
with:
76+
path: C:\OTHERBIN\winflexbison
77+
key: win_flex_bison-2.5.24.zip
78+
env:
79+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
80+
- name: Download GNU diffutils for Test on PostgreSQL for Windows
81+
if: ${{steps.cacheDiffutilsZip.outputs.cache-hit != 'true'}}
82+
uses: suisei-cn/[email protected]
83+
id: downloadDiffutilsZip
84+
with:
85+
retry-times: 5
86+
url: https://zenlayer.dl.sourceforge.net/project/gnuwin32/diffutils/2.8.7-1/diffutils-2.8.7-1-bin.zip
87+
88+
- name: Download pkgconfiglite for Compile using msvc and meson
89+
if: ${{steps.cachePkgConfigLiteZip.outputs.cache-hit != 'true'}}
90+
uses: suisei-cn/[email protected]
91+
id: downloadPkgConfigLiteZip
92+
with:
93+
retry-times: 5
94+
url: http://downloads.sourceforge.net/project/pkgconfiglite/0.28-1/pkg-config-lite-0.28-1_bin-win32.zip
95+
96+
- name: Download winflexbison for Compile using msvc
97+
if: ${{steps.cacheWinFlexBisonZip.outputs.cache-hit != 'true'}}
98+
uses: suisei-cn/[email protected]
99+
id: downloadWinFlexBisonZip
100+
with:
101+
retry-times: 5
102+
url: https://sourceforge.net/projects/winflexbison/files/win_flex_bison-2.5.24.zip
103+
104+
- name: Download postgresql install from EDB
105+
uses: suisei-cn/[email protected]
106+
if: ${{steps.cachePostgresInstaller.outputs.cache-hit != 'true'}}
107+
id: downloadPostgresInstaller
108+
with:
109+
retry-times: 5
110+
url: https://sbp.enterprisedb.com/getfile.jsp?fileid=1258893
111+
target: c:\OTHERBIN
112+
filename: postgresql_install.exe
113+
114+
- name: Extract Diffuntils and add Diffuntils bin directory to the PATH for Test on PostgreSQL for Windows
115+
shell: cmd
116+
run: |
117+
rem MKDIR creates any intermediate directories in the path, if needed.
118+
mkdir "C:\OTHERBIN\diffutils"
119+
rem 7z is provided by Github Actions
120+
7z x diffutils-2.8.7-1-bin.zip -o"C:\OTHERBIN\diffutils"
121+
copy diffutils-2.8.7-1-bin.zip "C:\OTHERBIN\diffutils"
122+
dir "C:\OTHERBIN\diffutils"
123+
rem - man7.org/linux/man-pages/man1/printf.1.html
124+
printf "C:\\OTHERBIN\\diffutils\\bin" >> %GITHUB_PATH%
125+
126+
- name: Extract pkgconfiglite and add pkgconfiglite bin directory to the PATH for Compile using msvc and meson
127+
shell: cmd
128+
run: |
129+
rem MKDIR creates any intermediate directories in the path, if needed.
130+
mkdir "C:\OTHERBIN\pkgconfiglite"
131+
rem 7z is provided by Github Actions
132+
7z x pkg-config-lite-0.28-1_bin-win32.zip -o"C:\OTHERBIN\pkgconfiglite"
133+
copy pkg-config-lite-0.28-1_bin-win32.zip "C:\OTHERBIN\pkgconfiglite"
134+
dir "C:\OTHERBIN\pkgconfiglite"
135+
rem - man7.org/linux/man-pages/man1/printf.1.html
136+
printf "C:\\OTHERBIN\\pkgconfiglite\\pkg-config-lite-0.28-1\\bin" >> %GITHUB_PATH%
137+
138+
# Choco Install winflexbison
139+
# BUT the "crazy-max/ghaction-chocolatey@v2" "install pkgconfiglite" file download often times-out
140+
- name: Extract winflexbison and add the winflexbison directory to the PATH for Compile using msvc
141+
shell: cmd
142+
run: |
143+
rem MKDIR creates any intermediate directories in the path, if needed.
144+
mkdir "C:\OTHERBIN\winflexbison"
145+
rem 7z is provided by Github Actions
146+
7z x win_flex_bison-2.5.24.zip -o"C:\OTHERBIN\winflexbison"
147+
copy win_flex_bison-2.5.24.zip "C:\OTHERBIN\winflexbison"
148+
dir "C:\OTHERBIN\winflexbison"
149+
rem - man7.org/linux/man-pages/man1/printf.1.html
150+
printf "C:\OTHERBIN\\winflexbison" >> %GITHUB_PATH%
151+
- name: 'setup msvc x86'
152+
if: ${{steps.cachePostgres86.outputs.cache-hit != 'true'}}
153+
uses: TheMrMilchmann/setup-msvc-dev@v3
154+
with:
155+
arch: x86
156+
- name: 'build postgresx86'
157+
if: ${{steps.cachePostgres86.outputs.cache-hit != 'true'}}
158+
run: |
159+
meson setup buildx86 --prefix=d:\postgresql86
160+
cd buildx86
161+
ninja -v
162+
ninja -v install
163+
- name: 'setup msvc x64'
164+
if: ${{steps.cachePostgres.outputs.cache-hit != 'true'}}
165+
uses: TheMrMilchmann/setup-msvc-dev@v3
166+
with:
167+
arch: x64
168+
- name : 'build postgres x64'
169+
if: ${{steps.cachePostgres.outputs.cache-hit != 'true'}}
170+
run: |
171+
meson setup build --prefix=d:\postgresql
172+
cd build
173+
ninja
174+
ninja install
175+
- name: install postgresql binary
176+
shell: cmd
177+
run: |
178+
echo on
179+
C:\OTHERBIN\postgresql_install.exe --mode unattended --unattendedmodeui none --superpassword password --enable-components server
180+
- name: start postgresql
181+
shell: cmd
182+
run: |
183+
echo on
184+
sc config "postgresql-x64-14" start= auto
185+
- name: get psqlodbc
186+
uses: actions/checkout@v4
187+
- name: 'setup msvc for psqlodbc'
188+
uses: TheMrMilchmann/setup-msvc-dev@v3
189+
with:
190+
arch: x86
191+
- name: build psqlodbc
192+
shell: powershell
193+
run: |
194+
copy .github\workflows\configuration.xml winbuild
195+
winbuild\BuildAll.ps1
196+
installer\buildInstallers.ps1
197+
- name: test psqlodbc
198+
shell: powershell
199+
run: |
200+
winbuild\regress.ps1 -DsnInfo "SERVER=localhost|DATABASE=contrib_regression|PORT=5432|UID=postgres|PWD=password"
201+
- name: Upload x64 merge module
202+
uses: actions/upload-artifact@v4
203+
with:
204+
name: psqlODBC x64 Merge Module
205+
path: ./installer/x64/*.msm
206+
retention-days: 5
207+
if-no-files-found: error
208+
- name: Upload x64 installer package
209+
uses: actions/upload-artifact@v4
210+
with:
211+
name: psqlODBC x64 Installer
212+
path: ./installer/x64/*.msi
213+
retention-days: 5
214+
if-no-files-found: error
215+
- name: Upload x86 merge module
216+
uses: actions/upload-artifact@v4
217+
with:
218+
name: psqlODBC x86 Merge Module
219+
path: ./installer/x86/*.msm
220+
retention-days: 5
221+
if-no-files-found: error
222+
- name: Upload x86 installer package
223+
uses: actions/upload-artifact@v4
224+
with:
225+
name: psqlODBC x86 Installer
226+
path: ./installer/x86/*.msi
227+
retention-days: 5
228+
if-no-files-found: error
229+
- name: Upload x64 setup
230+
id: x64_setup
231+
uses: actions/upload-artifact@v4
232+
with:
233+
name: psqlODBC x64 Setup
234+
path: ./installer/psqlodbc-setup/bin/Release/psqlodbc-setup.exe
235+
retention-days: 5
236+
if-no-files-found: error
237+
238+
- name: Create Release
239+
if: startsWith(github.ref, 'refs/tags/REL-')
240+
uses: ncipollo/[email protected]
241+
id: create_release
242+
with:
243+
draft: false
244+
prerelease: false
245+
token: ${{secrets.RELEASE_TOKEN}}
246+
artifacts: "./installer/x86/*.msi,./installer/x86/*.msm,./installer/psqlodbc-setup/bin/Release/psqlodbc-setup.exe"

environ.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ ER_ReturnError(PG_ErrorInfo *pgerror,
194194
BOOL partial_ok = ((flag & PODBC_ALLOW_PARTIAL_EXTRACT) != 0);
195195
const char *msg;
196196
UWORD msglen, wrtlen, pcblen;
197-
UInt4 stapos,
197+
UInt4 stapos;
198198

199199
if (!pgerror)
200200
return SQL_NO_DATA_FOUND;

installer/buildInstallers.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ function buildInstaller([string]$CPUTYPE)
278278
}
279279

280280
Write-Host ".`nLinking psqlODBC merge module..."
281-
light -nologo -o $INSTBASE\psqlodbc_$CPUTYPE.msm $INSTBASE\psqlodbcm.wixobj
281+
light -sval -nologo -o $INSTBASE\psqlodbc_$CPUTYPE.msm $INSTBASE\psqlodbcm.wixobj
282282
if ($LASTEXITCODE -ne 0) {
283283
throw "Failed to link merge module"
284284
}
@@ -291,7 +291,7 @@ function buildInstaller([string]$CPUTYPE)
291291
}
292292

293293
Write-Host ".`nLinking psqlODBC installer database..."
294-
light -nologo -ext WixUIExtension -cultures:en-us -o $INSTBASE\psqlodbc_$CPUTYPE.msi $INSTBASE\psqlodbc.wixobj
294+
light -sval -nologo -ext WixUIExtension -cultures:en-us -o $INSTBASE\psqlodbc_$CPUTYPE.msi $INSTBASE\psqlodbc.wixobj
295295
if ($LASTEXITCODE -ne 0) {
296296
throw "Failed to link installer database"
297297
}

psqlodbc.sln

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11

2-
Microsoft Visual Studio Solution File, Format Version 9.00
3-
# Visual Studio 2005
4-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "psqlODBC", "psqlodbc.vcproj", "{C45ECB41-8473-4F11-8186-E5574CFBADCF}"
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34408.163
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "psqlODBC", "psqlodbc.vcxproj", "{C45ECB41-8473-4F11-8186-E5574CFBADCF}"
57
EndProject
68
Global
79
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -17,4 +19,7 @@ Global
1719
GlobalSection(SolutionProperties) = preSolution
1820
HideSolutionNode = FALSE
1921
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {D4D16229-1A47-43D4-B881-F1D072436145}
24+
EndGlobalSection
2025
EndGlobal

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
Copyright (C) 1998 Insight Distribution Systems
8-
Copyright (C) 1998 - 2023 The PostgreSQL Global Development Group
8+
Copyright (C) 1998 - 2024 The PostgreSQL Global Development Group
99

1010
Multibyte support was added by Sankyo Unyu Service, (C) 2001.
1111

0 commit comments

Comments
 (0)