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 Apr 15, 2023
1 parent e23d6f7 commit 53bdda9
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 53 deletions.
30 changes: 24 additions & 6 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 pkgconf
run: |
tests/build.sh
tests/runtests.sh
build_ubuntu:
runs-on: ubuntu-22.04
strategy:
Expand All @@ -21,7 +39,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 libtool pkg-config
Expand All @@ -48,7 +66,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 libtool pkg-config
Expand All @@ -68,7 +86,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 libtool pkg-config
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Files to ignore by git
#
# Version: 20200912
# Version: 20230405

# Generic auto-generated build files
*~
Expand Down Expand Up @@ -82,6 +82,7 @@ stamp-h[1-9]
/m4/ltsugar.m4
/m4/ltversion.m4
/m4/nls.m4
/m4/pkg.m4
/m4/po.m4
/m4/printf-posix.m4
/m4/progtest.m4
Expand Down
65 changes: 45 additions & 20 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,70 @@ 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: macos-x64-clang
BUILD_ENVIRONMENT: xcode
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
Expand Down Expand Up @@ -80,7 +110,6 @@ environment:
LDFLAGS: "--coverage"

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 @@ -91,30 +120,23 @@ 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 )
- 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" }
- 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%]==[cygwin64] (
xcopy /i /q /s C:\projects\libcnotify C:\cygwin64\home\appveyor\libcnotify &&
C:\cygwin64\bin\bash -e -l -c "cd libcnotify && 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 libcnotify && 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 libcnotify && tests/build.sh ${CONFIGURE_OPTIONS}" )
- cmd: if [%BUILD_ENVIRONMENT%]==[mingw-w64] (
xcopy /i /q /s C:\projects\libcnotify C:\msys64\home\appveyor\libcnotify &&
Expand All @@ -132,7 +154,10 @@ test_script:
C:\msys64\usr\bin\bash -l -c "cd libcnotify && tests/runtests.sh" )

after_test:
- cmd: if [%TARGET%]==[cygwin64-gcc-no-optimization] (
C:\cygwin64\bin\bash -e -l -c "cd libcnotify && 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\libcnotify --name %TARGET% )
- cmd: if [%TARGET%]==[mingw-w64-gcc-no-optimization] (
copy C:\projects\codecov-bash\codecov C:\msys64\home\appveyor\libcnotify\codecov.sh &&
C:\msys64\usr\bin\bash -e -l -c "cd libcnotify && chmod a+x ./codecov.sh && ./codecov.sh -n ${TARGET}" )
C:\msys64\usr\bin\bash -e -l -c "cd libcnotify && 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\libcnotify --name %TARGET% )

4 changes: 2 additions & 2 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# Script to generate ./configure using the autotools
#
# Version: 20220709
# Version: 20230405

EXIT_SUCCESS=0;
EXIT_FAILURE=1;
Expand Down Expand Up @@ -133,7 +133,7 @@ else
exit $?;
fi

${ACLOCAL} --force -I m4;
${ACLOCAL} --force --install -I m4;
if test $? -ne 0;
then
exit $?;
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 libcnotify
#
# 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\libcnotify.sln 2>&1 | %{ '$_' }"
Invoke-Expression -Command "& '${Python}' ${MSVSCppConvert} --output-format ${VisualStudioVersion} ${VSToolsOptions} msvscpp\libcnotify.sln 2>&1" | %{ "$_" }
}
}
$VSSolutionFile = "${VSSolutionPath}\libcnotify.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
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ([2.71])

AC_INIT(
[libcnotify],
[20230107],
[20230415],
[joachim.metz@gmail.com])

AC_CONFIG_SRCDIR(
Expand Down
Loading

0 comments on commit 53bdda9

Please sign in to comment.