Skip to content
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

Add Continuous Integration #7

Merged
merged 52 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
8ba62bd
Create main.yml
davecramer Mar 5, 2024
e6acdde
Update main.yml
davecramer Mar 5, 2024
eb7a242
Update main.yml
davecramer Mar 5, 2024
9fadea7
Update main.yml
davecramer Mar 5, 2024
249b20d
Update main.yml
davecramer Mar 5, 2024
de83463
Update main.yml
davecramer Mar 5, 2024
f9fad82
add required packages
davecramer Mar 5, 2024
8268de4
add required packages
davecramer Mar 5, 2024
fce1561
try to build psqlodbc
davecramer Mar 5, 2024
bf87933
add cacheing and fix build error
davecramer Mar 5, 2024
cf1492d
fix build error
davecramer Mar 5, 2024
b4193f4
fix build error
davecramer Mar 5, 2024
878db2f
fix build file error
davecramer Mar 5, 2024
28cc125
update actions
davecramer Mar 5, 2024
93e173f
cache postgres build
davecramer Mar 5, 2024
0ac9d2b
try other directories
davecramer Mar 8, 2024
1c8c6b0
fix build error
davecramer Mar 18, 2024
28e9065
merge upstream
davecramer Mar 18, 2024
61d0320
try to build both x64 and x86
davecramer Mar 20, 2024
250f57d
fix error
davecramer Mar 25, 2024
6d11e62
Merge branch 'master' of github.com:davecramer/psqlodbc
davecramer Mar 25, 2024
6de33f4
build postgresql 86
davecramer Mar 25, 2024
c035560
remove arm64
davecramer Mar 25, 2024
d58fab0
spell winbuild properly
davecramer Mar 25, 2024
544ec21
add verbose to ninja
davecramer Mar 25, 2024
fa15783
move things around
davecramer Mar 25, 2024
2cf7665
use path
davecramer Mar 25, 2024
f98e271
use powershell
davecramer Mar 25, 2024
814db10
use powershell
davecramer Mar 25, 2024
e6545c4
use powershell
davecramer Mar 25, 2024
de40b7a
use powershell
davecramer Mar 25, 2024
624198a
build postgresql on d
davecramer Mar 26, 2024
151b296
print dir
davecramer Mar 26, 2024
f9316d8
use visual studio to build x64
davecramer Mar 26, 2024
00745ee
remove debugging
davecramer Mar 26, 2024
addef4d
try building installer
davecramer Mar 26, 2024
6a52322
fix spelling
davecramer Mar 26, 2024
27f49fa
remove failing build
davecramer Mar 26, 2024
0368c30
move installer up
davecramer Mar 26, 2024
77f0ff0
try push and popd
davecramer Mar 26, 2024
fc2ba3c
build from cur dir
davecramer Mar 26, 2024
ab2e3b0
set environment
davecramer Mar 26, 2024
ad2e4a0
try x86
davecramer Mar 26, 2024
6d216bb
add -sval to stop validation
davecramer Mar 26, 2024
38debd8
try with setup-msvc
davecramer Mar 27, 2024
63a2886
try with setup-msvc
davecramer Mar 27, 2024
a6ee6fb
new workflow
davecramer Mar 28, 2024
4d98d23
build both
davecramer Mar 28, 2024
13b2e2d
build both
davecramer Mar 28, 2024
4420471
upload setup and both mis
davecramer Mar 28, 2024
3e90f51
correct directories
davecramer Mar 28, 2024
c86ac98
remove test.yml
davecramer Mar 28, 2024
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
38 changes: 38 additions & 0 deletions .github/workflows/configuration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration version="" formatVersion="0.4" vcversion="" toolset="">
<title>
</title>
<x86 disabled="no">
<libpq version="y">
<include>d:\postgresql86\include</include>
<lib>d:\postgresql86\lib</lib>
<bin>d:\postgresql86\bin</bin>
</libpq>
<setvcvars>
</setvcvars>
<build_macros>
</build_macros>
<runtime_folder>
</runtime_folder>
</x86>
<x64>
<libpq version="y">
<include>d:\postgresql\include</include>
<lib>d:\postgresql\lib</lib>
<bin>d:\postgresql\bin</bin>
</libpq>
<setvcvars>
</setvcvars>
<build_macros>
</build_macros>
<runtime_folder>
</runtime_folder>
</x64>
<BuildResult>
<Date>03/04/2024 10:49:13</Date>
<VisualStudioVersion>17.0</VisualStudioVersion>
<PlatformToolset>v143</PlatformToolset>
<ToolsVersion>Current</ToolsVersion>
<Platform>arm64</Platform>
</BuildResult>
</Configuration>
192 changes: 192 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
name: MSBuild
run-name: psql ODBC CI - ${{ github.event.head_commit.message }}

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

env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: .

# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release

permissions:
contents: read

jobs:
get_windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
with:
repository: "postgres/postgres.git"
ref: 'master'
- name: 'get meson'
run: |
python -m pip install meson
python -m pip install ninja
- name: Cache Postgres directory
uses: actions/cache@v4
id: cachePostgres
with:
path: d:\postgresql
key: postgresql
- name: Cache Postgres86 directory
uses: actions/cache@v4
id: cachePostgres86
with:
path: d:\postgresql86
key: postgresql86
- name: Cache GNU diffutils for Test on PostgreSQL for Windows
uses: actions/cache@v4
id: cacheDiffutilsZip
with:
path: C:\OTHERBIN\diffutils
key: diffutils-2.8.7-1-bin.zip
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1

- name: Cache pkgconfiglite for Compile using msvc and meson
uses: actions/cache@v4
id: cachePkgConfigLiteZip
with:
path: C:\OTHERBIN\pkgconfiglite
key: pkg-config-lite-0.28-1_bin-win32.zip
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1

- name: Cache winflexbison for Compile using msvc
uses: actions/cache@v4
id: cacheWinFlexBisonZip
with:
path: C:\OTHERBIN\winflexbison
key: win_flex_bison-2.5.24.zip
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
- name: Download GNU diffutils for Test on PostgreSQL for Windows
if: ${{steps.cacheDiffutilsZip.outputs.cache-hit != 'true'}}
uses: suisei-cn/[email protected]
id: downloadDiffutilsZip
with:
retry-times: 1
url: https://zenlayer.dl.sourceforge.net/project/gnuwin32/diffutils/2.8.7-1/diffutils-2.8.7-1-bin.zip

- name: Download pkgconfiglite for Compile using msvc and meson
if: ${{steps.cachePkgConfigLiteZip.outputs.cache-hit != 'true'}}
uses: suisei-cn/[email protected]
id: downloadPkgConfigLiteZip
with:
retry-times: 1
url: http://downloads.sourceforge.net/project/pkgconfiglite/0.28-1/pkg-config-lite-0.28-1_bin-win32.zip

- name: Download winflexbison for Compile using msvc
if: ${{steps.cacheWinFlexBisonZip.outputs.cache-hit != 'true'}}
uses: suisei-cn/[email protected]
id: downloadWinFlexBisonZip
with:
retry-times: 1
url: https://sourceforge.net/projects/winflexbison/files/win_flex_bison-2.5.24.zip

- name: Extract Diffuntils and add Diffuntils bin directory to the PATH for Test on PostgreSQL for Windows
shell: cmd
run: |
rem MKDIR creates any intermediate directories in the path, if needed.
mkdir "C:\OTHERBIN\diffutils"
rem 7z is provided by Github Actions
7z x diffutils-2.8.7-1-bin.zip -o"C:\OTHERBIN\diffutils"
copy diffutils-2.8.7-1-bin.zip "C:\OTHERBIN\diffutils"
dir "C:\OTHERBIN\diffutils"
rem - man7.org/linux/man-pages/man1/printf.1.html
printf "C:\\OTHERBIN\\diffutils\\bin" >> %GITHUB_PATH%

- name: Extract pkgconfiglite and add pkgconfiglite bin directory to the PATH for Compile using msvc and meson
shell: cmd
run: |
rem MKDIR creates any intermediate directories in the path, if needed.
mkdir "C:\OTHERBIN\pkgconfiglite"
rem 7z is provided by Github Actions
7z x pkg-config-lite-0.28-1_bin-win32.zip -o"C:\OTHERBIN\pkgconfiglite"
copy pkg-config-lite-0.28-1_bin-win32.zip "C:\OTHERBIN\pkgconfiglite"
dir "C:\OTHERBIN\pkgconfiglite"
rem - man7.org/linux/man-pages/man1/printf.1.html
printf "C:\\OTHERBIN\\pkgconfiglite\\pkg-config-lite-0.28-1\\bin" >> %GITHUB_PATH%

# Choco Install winflexbison
# BUT the "crazy-max/ghaction-chocolatey@v2" "install pkgconfiglite" file download often times-out
- name: Extract winflexbison and add the winflexbison directory to the PATH for Compile using msvc
shell: cmd
run: |
rem MKDIR creates any intermediate directories in the path, if needed.
mkdir "C:\OTHERBIN\winflexbison"
rem 7z is provided by Github Actions
7z x win_flex_bison-2.5.24.zip -o"C:\OTHERBIN\winflexbison"
copy win_flex_bison-2.5.24.zip "C:\OTHERBIN\winflexbison"
dir "C:\OTHERBIN\winflexbison"
rem - man7.org/linux/man-pages/man1/printf.1.html
printf "C:\\OTHERBIN\\winflexbison" >> %GITHUB_PATH%
- name: 'setup msvc x86'
if: ${{steps.cachePostgres86.outputs.cache-hit != 'true'}}
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x86
- name: 'build postgresx86'
if: ${{steps.cachePostgres86.outputs.cache-hit != 'true'}}
run: |
meson setup buildx86 --prefix=d:\postgresql86
cd buildx86
ninja -v
ninja -v install
- name: 'setup msvc x64'
if: ${{steps.cachePostgres.outputs.cache-hit != 'true'}}
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
- name : 'build postgres x64'
if: ${{steps.cachePostgres.outputs.cache-hit != 'true'}}
run: |
meson setup build --prefix=d:\postgresql
cd build
ninja
ninja install
- name: get psqlodbc
uses: actions/checkout@v4
- name: 'setup msvc for psqlodbc'
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x86
- name: build psqlodbc
shell: powershell
run: |
copy .github\workflows\configuration.xml winbuild
winbuild\BuildAll.ps1
installer\buildInstallers.ps1
- name: Upload x64 installer
uses: actions/upload-artifact@v4
with:
name: psqlODBC x64 Installer
path: ./installer/x64/*.msi
retention-days: 5
if-no-files-found: error
- name: Upload x86 installer
uses: actions/upload-artifact@v4
with:
name: psqlODBC x86 Installer
path: ./installer/x86/*.msi
retention-days: 5
if-no-files-found: error
- name: Upload x64 setup
uses: actions/upload-artifact@v4
with:
name: psqlODBC x64 Setup
path: ./installer/psqlodbc-setup/bin/Release/psqlodbc-setup.exe
retention-days: 5
if-no-files-found: error


34 changes: 0 additions & 34 deletions .github/workflows/msbuild.yml

This file was deleted.

2 changes: 1 addition & 1 deletion environ.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ ER_ReturnError(PG_ErrorInfo *pgerror,
BOOL partial_ok = ((flag & PODBC_ALLOW_PARTIAL_EXTRACT) != 0);
const char *msg;
UWORD msglen, wrtlen, pcblen;
UInt4 stapos,
UInt4 stapos;

if (!pgerror)
return SQL_NO_DATA_FOUND;
Expand Down
4 changes: 2 additions & 2 deletions installer/buildInstallers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ function buildInstaller([string]$CPUTYPE)
}

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

Write-Host ".`nLinking psqlODBC installer database..."
light -nologo -ext WixUIExtension -cultures:en-us -o $INSTBASE\psqlodbc_$CPUTYPE.msi $INSTBASE\psqlodbc.wixobj
light -sval -nologo -ext WixUIExtension -cultures:en-us -o $INSTBASE\psqlodbc_$CPUTYPE.msi $INSTBASE\psqlodbc.wixobj
if ($LASTEXITCODE -ne 0) {
throw "Failed to link installer database"
}
Expand Down
11 changes: 8 additions & 3 deletions psqlodbc.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "psqlODBC", "psqlodbc.vcproj", "{C45ECB41-8473-4F11-8186-E5574CFBADCF}"
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34408.163
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "psqlODBC", "psqlodbc.vcxproj", "{C45ECB41-8473-4F11-8186-E5574CFBADCF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -17,4 +19,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D4D16229-1A47-43D4-B881-F1D072436145}
EndGlobalSection
EndGlobal
12 changes: 9 additions & 3 deletions winbuild/MSProgram-Get.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ function Find-MSBuild
$VisualStudioVersion = "15.0"
} elseif ((Find-VSDir 16) -ne "") { # VC16 is installed
$VisualStudioVersion = "16.0"
} elseif ((Find-VSDir 17) -ne "") { #VC 17 is installed
$VisualStudioVersion = "17.0"
} elseif ("${env:VS140COMNTOOLS}" -ne "") { # VC14 is installed
$VisualStudioVersion = "14.0"
} elseif ("${env:VS120COMNTOOLS}" -ne "") { # VC12 is installed
Expand All @@ -67,7 +69,8 @@ function Find-MSBuild
"14.0" { $toolsout = 14 }
"15.0" { $toolsout = 15 }
"16.0" { $toolsout = 16 }
default { throw "Selected Visual Stuidio is Version ${VisualStudioVersion}. Please use VC10 or later"}
"17.0" { $toolsout = 17 }
default { throw "Selected Visual Studio is Version ${VisualStudioVersion}. Please use VC10 or later"}
}
#
# Determine ToolsVersion
Expand Down Expand Up @@ -112,6 +115,7 @@ function Find-MSBuild
}
} catch {}
if ("$msbuildexe" -eq "") {
Write-Debug "tools version $toolsnum"
if ($toolsnum -gt 14) { # VC15 ~ VC16
$msbuildexe = msbfind_15_xx $toolsnum
} else { # VC10 ~ VC14
Expand Down Expand Up @@ -149,6 +153,7 @@ function Find-MSBuild
"14.0" {$Toolsetv="v140_xp"}
"15.0" {$Toolsetv="v141_xp"}
"16.0" {$Toolsetv="v142"}
"17.0" {$Toolsetv="v143"}
}
}
# avoid a bug of Windows7.1SDK PlatformToolset
Expand Down Expand Up @@ -400,7 +405,7 @@ function find_vs_installation
return $vsdir
}

$vsarray = @{VC15 = "2017"; VC16 = "2019"}
$vsarray = @{VC15 = "2017"; VC16 = "2019"; VC17 = "2022"}
# find VS dir for VC15 ~ VC16
function find_default_msbuild_path
{
Expand All @@ -413,12 +418,13 @@ function find_default_msbuild_path
if ($vsdir -eq "")
{
$toolsnum = [int]$toolsver
if ($env:PROCESSOR_ARCHITECTURE -eq "x86") {
if ($env:PROCESSOR_ARCHITECTURE -eq "x86" -or $env:PROCESSOR_ARCHITECTURE -eq "ARM64") {
$pgmfs = "$env:ProgramFiles"
} else {
$pgmfs = "${env:ProgramFiles(x86)}"
}
$vsverdir = $vsarray["VC$toolsnum"]
Write-Debug "$pgmfs\Microsoft Visual Studio\$vsverdir\*\MSBuild\*\Bin\MSBuild.exe"
$lslist = @(Get-ChildItem "$pgmfs\Microsoft Visual Studio\$vsverdir\*\MSBuild\*\Bin\MSBuild.exe" -ErrorAction SilentlyContinue)
} else {
$lslist = @(Get-ChildItem "$vsdir\MSBuild\*\Bin\MSBuild.exe" -ErrorAction SilentlyContinue)
Expand Down