Skip to content

Commit

Permalink
Changes for CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed May 3, 2023
1 parent 4f75057 commit 56f99a1
Show file tree
Hide file tree
Showing 18 changed files with 146 additions and 71 deletions.
34 changes: 26 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@ name: build
on: [push, pull_request]
permissions: read-all
jobs:
build_freebsd:
# FreeBSD support is provided via virtualization on MacOS 12
# See https://github.com/vmactions/freebsd-vm#under-the-hood.
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Building from source
id: build_freebsd
uses: vmactions/freebsd-vm@v0
with:
usesh: true
mem: 4096
# Note that the test scripts require bash
prepare: |
pkg install -y autoconf automake bash gettext git libtool openssl pkgconf
run: |
tests/build.sh
tests/runtests.sh
build_ubuntu:
runs-on: ubuntu-22.04
strategy:
Expand Down Expand Up @@ -33,7 +51,7 @@ jobs:
compiler: 'gcc'
configure_options: '--enable-static-executables=yes --enable-multi-threading-support=no'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install build dependencies
run: |
sudo apt-get -y install autoconf automake autopoint build-essential git libssl-dev libtool pkg-config
Expand Down Expand Up @@ -62,7 +80,7 @@ jobs:
configure_options: '--enable-python3'
python_version: '3'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install build dependencies
run: |
sudo add-apt-repository universe &&
Expand Down Expand Up @@ -91,7 +109,7 @@ jobs:
configure_options: ''
python-version: '3.10'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
Expand Down Expand Up @@ -121,7 +139,7 @@ jobs:
compiler: 'gcc'
configure_options: ''
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install build dependencies
run: |
sudo apt-get -y install autoconf automake autopoint build-essential git libssl-dev libtool pkg-config
Expand All @@ -141,7 +159,7 @@ jobs:
for DIRECTORY in `find . -maxdepth 1 -type d`; do \
(cd ${DIRECTORY} && find . -maxdepth 1 -name \*.gcno -type f -exec gcov -pb {} \;) \
done
- name: Upload coverage data
run: |
git clone https://github.com/codecov/codecov-bash.git ../codecov-bash
/bin/bash ../codecov-bash/codecov -n linux-${{ matrix.architecture }}-gcc-no-optimization -X gcov;
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
name: linux-${{ matrix.architecture }}-gcc-no-optimization
2 changes: 1 addition & 1 deletion .github/workflows/build_shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
compiler: 'gcc'
configure_options: ''
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install build dependencies
run: |
sudo apt-get -y install autoconf automake autopoint build-essential git libssl-dev libtool pkg-config
Expand Down
86 changes: 60 additions & 26 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,77 @@ environment:
VisualStudioVersion: 9.0
platform: Win32
configuration: Release
PYTHON_PATH: "C:\\Python37"
- TARGET: vs2010
BUILD_ENVIRONMENT: msbuild
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
VisualStudioVersion: 10.0
platform: Win32
configuration: VSDebug
configuration: Release
PYTHON_PATH: "C:\\Python37"
- TARGET: vs2012
BUILD_ENVIRONMENT: msbuild
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
VisualStudioVersion: 11.0
platform: x64
platform: Win32
configuration: Release
PYTHON_PATH: "C:\\Python37"
- TARGET: vs2013
BUILD_ENVIRONMENT: msbuild
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
VisualStudioVersion: 12.0
platform: Win32
configuration: Release
PYTHON_PATH: "C:\\Python37"
- TARGET: vs2015
BUILD_ENVIRONMENT: msbuild
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
VisualStudioVersion: 14.0
platform: Win32
configuration: Release
PYTHON_PATH: "C:\\Python38"
- TARGET: vs2017
BUILD_ENVIRONMENT: msbuild
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VisualStudioVersion: 15.0
platform: Win32
configuration: Release
PYTHON_PATH: "C:\\Python38"
- TARGET: vs2019
BUILD_ENVIRONMENT: msbuild
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
VisualStudioVersion: 16.0
platform: Win32
configuration: Release
PYTHON_PATH: "C:\\Python311"
- TARGET: vs2022
BUILD_ENVIRONMENT: msbuild
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
VisualStudioVersion: 17.0
platform: Win32
configuration: Release
PYTHON_PATH: "C:\\Python311"
- TARGET: vs2022-vsdebug
BUILD_ENVIRONMENT: msbuild
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
VisualStudioVersion: 17.0
platform: Win32
configuration: VSDebug
PYTHON_PATH: "C:\\Python311"
- TARGET: vs2022-x64
BUILD_ENVIRONMENT: msbuild
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
VisualStudioVersion: 17.0
platform: x64
configuration: Release
PYTHON_PATH: "C:\\Python311"
- TARGET: vs2022-python
BUILD_ENVIRONMENT: msbuild
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
VisualStudioVersion: 17.0
platform: x64
configuration: Release
PYTHON_PATH: "C:\\Python311-x64"
- TARGET: macos-x64-clang
BUILD_ENVIRONMENT: xcode
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
Expand Down Expand Up @@ -71,14 +108,14 @@ environment:
CFLAGS: "-I/usr/local/include"
LDFLAGS: "-L/usr/local/lib"
CONFIGURE_OPTIONS: "--disable-dependency-tracking --prefix=/usr/local --enable-python --with-pyprefix"
- TARGET: python310
- TARGET: python311
BUILD_ENVIRONMENT: python
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
PYTHON: "C:\\Python310\\python.exe"
- TARGET: python310-x64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
PYTHON: "C:\\Python311\\python.exe"
- TARGET: python311-x64
BUILD_ENVIRONMENT: python
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
PYTHON: "C:\\Python310-x64\\python.exe"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
PYTHON: "C:\\Python311-x64\\python.exe"
- TARGET: macos-tox-py37
BUILD_ENVIRONMENT: python-tox
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
Expand Down Expand Up @@ -150,7 +187,6 @@ environment:
CONFIGURE_OPTIONS: "--enable-static-executables"

install:
- cmd: git clone https://github.com/codecov/codecov-bash.git ..\codecov-bash
- cmd: if [%BUILD_ENVIRONMENT%]==[msbuild] (
git clone https://github.com/libyal/vstools.git ..\vstools )
- sh: if test ${BUILD_ENVIRONMENT} = "python-tox" || test ${BUILD_ENVIRONMENT} = "xcode"; then brew update -q; fi
Expand All @@ -164,33 +200,28 @@ install:
C:\cygwin64\setup-x86_64.exe -qgnNdO -l C:\cygwin64\var\cache\setup -R c:\cygwin64 -s http://cygwin.mirror.constant.com -P gettext-devel -P wget -P zlib-devel -P libssl-devel -P python3-devel )
- cmd: if [%BUILD_ENVIRONMENT%]==[mingw-w64] (
C:\msys64\usr\bin\pacman -S --noconfirm --needed autoconf automake gcc gettext-devel libtool make )
- ps: If ( ( "cygwin64-gcc-no-optimization", "mingw-w64-gcc-no-optimization" ).Contains( $env:TARGET ) ) {
$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile ..\codecov.exe }

build_script:
- ps: If ($env:BUILD_ENVIRONMENT -eq "msbuild" -or ($env:BUILD_ENVIRONMENT -eq "python" -and $isWindows)) {
.\synclibs.ps1;
.\autogen.ps1 }
- ps: If ($env:TARGET -eq "vs2008") {
.\build.ps1 -VisualStudioVersion 2008 -VSToolsOptions "" }
- ps: If ($env:TARGET -eq "vs2010") {
.\build.ps1 -VisualStudioVersion 2010 -VSToolsOptions "--no-python-dll" }
- ps: If ($env:TARGET -eq "vs2012") {
.\build.ps1 -VisualStudioVersion 2012 -VSToolsOptions "--extend-with-x64 --python-path C:\\Python27-x64" }
- ps: If ($env:TARGET -eq "vs2013") {
.\build.ps1 -VisualStudioVersion 2013 -VSToolsOptions "" }
- ps: If ($env:TARGET -eq "vs2015") {
.\build.ps1 -VisualStudioVersion 2015 -VSToolsOptions "" }
- ps: If ($env:TARGET -eq "vs2017") {
.\build.ps1 -VisualStudioVersion 2017 -Platform Win32 -VSToolsOptions "--extend-with-x64 --no-python-dll --with-dokany";
.\build.ps1 -VisualStudioVersion 2017 -Platform x64 -VSToolsOptions "--extend-with-x64 --no-python-dll --with-dokany" }
- ps: If ($env:TARGET -eq "vs2019") {
.\build.ps1 -VisualStudioVersion 2019 -VSToolsOptions "--extend-with-x64 --no-python-dll --with-dokany" }
.\build.ps1 -VisualStudioVersion 2008 -PythonPath $env:PYTHON_PATH -VSToolsOptions "--no-python-dll" }
- ps: If ( ( "vs2010", "vs2012", "vs2013", "vs2015" ).Contains( $env:TARGET ) ) {
.\build.ps1 -VisualStudioVersion $env:TARGET.Substring(2, 4) -Configuration $env:CONFIGURATION -Platform $env:PLATFORM -PythonPath $env:PYTHON_PATH -VSToolsOptions "--extend-with-x64 --no-python-dll" }
- ps: If ( ( "vs2017", "vs2019", "vs2022", "vs2022-vsdebug", "vs2022-x64" ).Contains( $env:TARGET ) ) {
.\build.ps1 -VisualStudioVersion $env:TARGET.Substring(2, 4) -Configuration $env:CONFIGURATION -Platform $env:PLATFORM -PythonPath $env:PYTHON_PATH -VSToolsOptions "--extend-with-x64 --no-python-dll --with-dokany" }
- ps: If ($env:TARGET -eq "vs2022-python") {
.\build.ps1 -VisualStudioVersion $env:TARGET.Substring(2, 4) -Configuration $env:CONFIGURATION -Platform $env:PLATFORM -PythonPath $env:PYTHON_PATH -VSToolsOptions "--extend-with-x64 --python-path $env:PYTHON_PATH --with-dokany" }
- sh: if test ${BUILD_ENVIRONMENT} = "xcode"; then export PATH="/usr/local/opt/gettext/bin:$PATH"; export SED="/usr/local/bin/gsed"; tests/build.sh ${CONFIGURE_OPTIONS}; fi
- cmd: if [%BUILD_ENVIRONMENT%]==[python] (
"%PYTHON%" setup.py bdist_wheel )
- sh: if test ${BUILD_ENVIRONMENT} = "python-tox"; then export PATH="/usr/local/opt/gettext/bin:$PATH"; export SED="/usr/local/bin/gsed"; ./synclibs.sh && ./autogen.sh && ./configure --disable-nls --disable-shared-libs && make >/dev/null && tox -e${TOXENV}; fi
- cmd: if [%BUILD_ENVIRONMENT%]==[cygwin64] (
xcopy /i /q /s C:\projects\libhmac C:\cygwin64\home\appveyor\libhmac &&
C:\cygwin64\bin\bash -e -l -c "cd libhmac && wget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -O './config.guess' && wget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -O './config.sub'" &&
C:\cygwin64\bin\bash -e -l -c "cd libhmac && wget -q 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -O './config.guess' && wget -q 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -O './config.sub'" &&
C:\cygwin64\bin\bash -e -l -c "cd libhmac && tests/build.sh ${CONFIGURE_OPTIONS}" )
- cmd: if [%BUILD_ENVIRONMENT%]==[mingw-w64] (
xcopy /i /q /s C:\projects\libhmac C:\msys64\home\appveyor\libhmac &&
Expand All @@ -208,9 +239,12 @@ test_script:
C:\msys64\usr\bin\bash -l -c "cd libhmac && tests/runtests.sh" )

after_test:
- cmd: if [%TARGET%]==[cygwin64-gcc-no-optimization] (
C:\cygwin64\bin\bash -e -l -c "cd libhmac && for DIRECTORY in `find . -maxdepth 1 -type d`; do (cd ${DIRECTORY} && find . -maxdepth 1 -name \*.gcno -type f -exec gcov -pb {} \;) done" &&
C:\projects\codecov.exe -R \cygwin64\home\appveyor\libhmac --name %TARGET% )
- cmd: if [%TARGET%]==[mingw-w64-gcc-no-optimization] (
copy C:\projects\codecov-bash\codecov C:\msys64\home\appveyor\libhmac\codecov.sh &&
C:\msys64\usr\bin\bash -e -l -c "cd libhmac && chmod a+x ./codecov.sh && ./codecov.sh -n ${TARGET}" )
C:\msys64\usr\bin\bash -e -l -c "cd libhmac && for DIRECTORY in `find . -maxdepth 1 -type d`; do (cd ${DIRECTORY} && find . -maxdepth 1 -name \*.gcno -type f -exec gcov -pb {} \;) done" &&
C:\projects\codecov.exe -R \msys64\home\appveyor\libhmac --name %TARGET% )

artifacts:
- path: dist\*.whl
Expand Down
36 changes: 24 additions & 12 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Script that builds libhmac
#
# Version: 20200130
# Version: 20230411

Param (
[string]$Configuration = ${Env:Configuration},
[string]$Platform = ${Env:Platform},
[string]$PlatformToolset = "",
[string]$PythonPath = "C:\Python37",
[string]$PythonPath = "C:\Python311",
[string]$VisualStudioVersion = "",
[string]$VSToolsOptions = "--extend-with-x64",
[string]$VSToolsPath = "..\vstools"
Expand All @@ -32,7 +32,7 @@ If (-Not (Test-Path ${VSToolsPath}))
{
# PowerShell will raise NativeCommandError if git writes to stdout or stderr
# therefore 2>&1 is added and the output is stored in a variable.
$Output = Invoke-Expression -Command "${Git} clone ${GitUrl} ${VSToolsPath} 2>&1"
$Output = Invoke-Expression -Command "${Git} clone ${GitUrl} ${VSToolsPath} 2>&1" | %{ "$_" }
}
Else
{
Expand All @@ -41,7 +41,7 @@ Else
Try
{
# Make sure vstools are up to date.
$Output = Invoke-Expression -Command "${Git} pull 2>&1"
$Output = Invoke-Expression -Command "${Git} pull 2>&1" | %{ "$_" }
}
Finally
{
Expand All @@ -56,11 +56,11 @@ If (-Not (Test-Path ${MSVSCppConvert}))
}
If (-Not ${VisualStudioVersion})
{
$VisualStudioVersion = "2019"
$VisualStudioVersion = "2022"

Write-Host "Visual Studio version not set defauting to: ${VisualStudioVersion}" -foreground Red
}
If ((${VisualStudioVersion} -ne "2008") -And (${VisualStudioVersion} -ne "2010") -And (${VisualStudioVersion} -ne "2012") -And (${VisualStudioVersion} -ne "2013") -And (${VisualStudioVersion} -ne "2015") -And (${VisualStudioVersion} -ne "2017") -And (${VisualStudioVersion} -ne "2019"))
If ((${VisualStudioVersion} -ne "2008") -And (${VisualStudioVersion} -ne "2010") -And (${VisualStudioVersion} -ne "2012") -And (${VisualStudioVersion} -ne "2013") -And (${VisualStudioVersion} -ne "2015") -And (${VisualStudioVersion} -ne "2017") -And (${VisualStudioVersion} -ne "2019") -And (${VisualStudioVersion} -ne "2022"))
{
Write-Host "Unsupported Visual Studio version: ${VisualStudioVersion}" -foreground Red

Expand All @@ -86,17 +86,25 @@ ElseIf (${VisualStudioVersion} -eq "2015")
}
ElseIf (${VisualStudioVersion} -eq "2017")
{
$Results = Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio\2017\*\MSBuild\15.0\Bin\MSBuild.exe" -Recurse -ErrorAction SilentlyContinue -Force
$Results = Get-ChildItem -Path "C:\Program Files\Microsoft Visual Studio\${VisualStudioVersion}\*\MSBuild\15.0\Bin\MSBuild.exe" -Recurse -ErrorAction SilentlyContinue -Force

If ($Results.Count -eq 0)
{
$Results = Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio\${VisualStudioVersion}\*\MSBuild\15.0\Bin\MSBuild.exe" -Recurse -ErrorAction SilentlyContinue -Force
}
If ($Results.Count -gt 0)
{
$MSBuild = $Results[0].FullName
}
}
ElseIf (${VisualStudioVersion} -eq "2019")
ElseIf (${VisualStudioVersion} -eq "2019" -Or ${VisualStudioVersion} -eq "2022")
{
$Results = Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\*\MSBuild\Current\Bin\MSBuild.exe" -Recurse -ErrorAction SilentlyContinue -Force
$Results = Get-ChildItem -Path "C:\Program Files\Microsoft Visual Studio\${VisualStudioVersion}\*\MSBuild\Current\Bin\MSBuild.exe" -Recurse -ErrorAction SilentlyContinue -Force

If ($Results.Count -eq 0)
{
$Results = Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio\${VisualStudioVersion}\*\MSBuild\Current\Bin\MSBuild.exe" -Recurse -ErrorAction SilentlyContinue -Force
}
If ($Results.Count -gt 0)
{
$MSBuild = $Results[0].FullName
Expand Down Expand Up @@ -127,7 +135,7 @@ Else
{
${Env:PYTHONPATH} = ${VSToolsPath}

Invoke-Expression -Command "& '${Python}' ${MSVSCppConvert} --output-format ${VisualStudioVersion} ${VSToolsOptions} msvscpp\libhmac.sln 2>&1 | %{ '$_' }"
Invoke-Expression -Command "& '${Python}' ${MSVSCppConvert} --output-format ${VisualStudioVersion} ${VSToolsOptions} msvscpp\libhmac.sln 2>&1" | %{ "$_" }
}
}
$VSSolutionFile = "${VSSolutionPath}\libhmac.sln"
Expand Down Expand Up @@ -166,6 +174,10 @@ If (-Not ${PlatformToolset})
{
$PlatformToolset = "v142"
}
ElseIf (${VisualStudioVersion} -eq "2022")
{
$PlatformToolset = "v143"
}
Write-Host "PlatformToolset not set defauting to: ${PlatformToolset}"
}
$MSBuildOptions = "/verbosity:quiet /target:Build /property:Configuration=${Configuration},Platform=${Platform}"
Expand All @@ -176,11 +188,11 @@ If (${PlatformToolset})
}
If (${Env:APPVEYOR} -eq "True")
{
Invoke-Expression -Command "& '${MSBuild}' ${MSBuildOptions} ${VSSolutionFile} /logger:'C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll'";
Invoke-Expression -Command "& '${MSBuild}' ${MSBuildOptions} ${VSSolutionFile} /logger:'C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll' 2>&1" | %{ "$_" }
}
Else
{
Invoke-Expression -Command "& '${MSBuild}' ${MSBuildOptions} ${VSSolutionFile}"
Invoke-Expression -Command "& '${MSBuild}' ${MSBuildOptions} ${VSSolutionFile} 2>&1" | %{ "$_" }
}

Exit ${ExitSuccess}
5 changes: 5 additions & 0 deletions common/config_winapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
#endif

/* Define the size of size_t for WINAPI
* Do not define when pyconfig.h has been included via python.h
*/
#if !defined( HAVE_PYCONFIG_H )

#if !defined( SIZEOF_SIZE_T )
#if __WORDSIZE == 64
#define SIZEOF_SIZE_T 8
Expand All @@ -54,6 +57,8 @@
#endif
#endif

#endif /* !defined( HAVE_PYCONFIG_H ) */

/* Define the size of the wide character for WINAPI
*/
#if !defined( SIZEOF_WCHAR_T )
Expand Down
5 changes: 5 additions & 0 deletions common/types.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ typedef int system_integer_t;
#endif /* defined( WINAPI ) && ( defined( _UNICODE ) || defined( UNICODE ) ) */

/* Fallback for systems without PRI definitions
* Do not define when pyconfig.h has been included via python.h
*/
#if !defined( HAVE_PYCONFIG_H )

#if !defined( PRId8 )
#define PRId8 "d"
#endif
Expand Down Expand Up @@ -216,6 +219,8 @@ typedef int system_integer_t;
#endif
#endif /* !defined( PRIx64 ) */

#endif /* !defined( HAVE_PYCONFIG_H ) */

/* Fallback for systems without printf %jd definition
*/
#if defined( HAVE_PRINTF_JD )
Expand Down
Loading

0 comments on commit 56f99a1

Please sign in to comment.