diff --git a/.github/workflows/windows-binaries.yml b/.github/workflows/windows-binaries.yml new file mode 100644 index 00000000..78343377 --- /dev/null +++ b/.github/workflows/windows-binaries.yml @@ -0,0 +1,211 @@ +# __ __ _ +# ___\ \/ /_ __ __ _| |_ +# / _ \\ /| '_ \ / _` | __| +# | __// \| |_) | (_| | |_ +# \___/_/\_\ .__/ \__,_|\__| +# |_| XML parser +# +# Copyright (c) 2025 Sebastian Pipping +# Licensed under the MIT license: +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to permit +# persons to whom the Software is furnished to do so, subject to the +# following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. + +name: Build Windows binaries + +on: + pull_request: + push: + schedule: + - cron: '0 2 * * 5' # Every Friday at 2am + workflow_dispatch: + +permissions: + contents: read + +jobs: + windows_binaries: + name: Build ${{ matrix.expat_platform }} binaries + strategy: + fail-fast: false + matrix: + include: + - runs-on: windows-2019 + cmake_build_type: Debug + cmake_generator: Visual Studio 16 2019 + cmake_platform: Win32 + expat_char_type: char + expat_dll: libexpatd.dll + expat_platform: win32 + - runs-on: windows-2019 + cmake_build_type: Debug + cmake_generator: Visual Studio 16 2019 + cmake_platform: x64 + expat_char_type: wchar_t + expat_dll: libexpatwd.dll + expat_platform: win64 + defaults: + run: + shell: bash + runs-on: "${{ matrix.runs-on }}" + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2 + + - name: Install Inno Setup + shell: pwsh + run: |- + Invoke-WebRequest -Uri https://files.jrsoftware.org/is/6/innosetup-6.1.2.exe -OutFile D:\\is.exe + Start-Process -FilePath D:\\is.exe -ArgumentList "/VERYSILENT", "/SUPPRESSMSGBOXES", "/NORESTART" -Wait + + - name: 'Add Inno Setup compiler to ${PATH}' + run: |- + echo 'C:\Program Files (x86)\Inno Setup 6' >> "${GITHUB_PATH}" + + - name: Install Innoextract + env: + version: 1.9 + run: |- + set -x + mkdir innoextract + cd innoextract + export PATH="${PATH}:/c/msys64/usr/bin" # for wget + wget -q https://github.com/dscharrer/innoextract/releases/download/${version}/innoextract-${version}-windows.zip + unzip innoextract-${version}-windows.zip + echo "${GITHUB_WORKSPACE}\innoextract" >> "${GITHUB_PATH}" + + - name: Prepare win64 installer + if: "${{ matrix.expat_platform == 'win64' }}" + run: |- + bat_sed_args=( + -e 's,-A Win32,-A x64,g' + -e 's,win32,win64,g' + ) + inno_sed_args=( + -e 's,^OutputDir=win32,OutputDir=win64,' + -e 's,win32bin,win64bin,' + -e 's,win32\\bin,win64\\bin,g' + ) + set -x + cd expat + mkdir win64 + + sed "${bat_sed_args[@]}" win32/build_expat_iss.bat > win64/build_expat_iss.bat + ! grep -i win32 win64/build_expat_iss.bat # i.e. assert success + + sed "${inno_sed_args[@]}" win32/expat.iss > win64/expat.iss + ! grep 'win32\\bin' win64/expat.iss # i.e. assert success + grep win32 win64/expat.iss # purely informational + + - name: Build installer + env: + expat_platform: ${{ matrix.expat_platform }} + run: |- + set -x + cd expat + + cmd < "${expat_platform}"/build_expat_iss.bat + + ls -lh "${expat_platform}"/*.exe + cp -v "${expat_platform}"/expat-*bin-*.*.*.exe /d/expat-installer.exe + + - name: Create .zip file from installer content + env: + expat_platform: ${{ matrix.expat_platform }} + run: |- + export PATH="${PATH}:/c/msys64/usr/bin" # for zip + set -x + + cd "expat/${expat_platform}" + zip_name="$(echo expat-*bin-*.exe | sed 's,\.exe$,.zip,')" + + # Workaround issues with innoextract 1.9 as documented at + # https://github.com/dscharrer/innoextract/issues/178#issue-2505033557 + innoextract -l expat-*bin-*.exe \ + | awk -F'"' '{print $2}' \ + | xargs dirname \ + | sort -u \ + | xargs mkdir -v -p + + innoextract -e expat-*bin-*.exe + + ls -lh app/Bin/ + + ( cd app && zip -9 -r ../"${zip_name}" . ) + + - name: Offer binaries for download + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + with: + name: expat_${{ matrix.expat_platform }}_${{ github.sha }} + path: expat/${{ matrix.expat_platform }}/expat-win*bin-*.*.*.* + if-no-files-found: error + + - name: Run installer + shell: pwsh + run: |- + Start-Process -FilePath D:\\expat-installer.exe -ArgumentList "/VERYSILENT", "/SUPPRESSMSGBOXES", "/NORESTART" -Wait + + - name: Build installed code — Configure + env: + cmake_build_type: ${{ matrix.cmake_build_type }} + cmake_generator: ${{ matrix.cmake_generator }} + cmake_platform: ${{ matrix.cmake_platform }} + expat_char_type: ${{ matrix.expat_char_type }} + run: |- + cmake_args=( + -A "${cmake_platform}" + -G "${cmake_generator}" + -DCMAKE_BUILD_TYPE="${cmake_build_type}" + -DEXPAT_CHAR_TYPE="${expat_char_type}" + -DEXPAT_WARNINGS_AS_ERRORS=ON + -Wdev + -Wdeprecated + ) + set -x + cd '/c/Program Files (x86)/Expat '*/Source + mkdir build + cmake -S . -B build "${cmake_args[@]}" + + - name: Build installed code — Build + env: + cmake_build_type: ${{ matrix.cmake_build_type }} + run: |- + msbuild_args=( + -m + -property:Configuration="${cmake_build_type}" + ) + set -x + cd '/c/Program Files (x86)/Expat '*/Source/build + MSBuild.exe "${msbuild_args[@]}" expat.sln + + - name: Build installed code — Run tests + env: + cmake_build_type: ${{ matrix.cmake_build_type }} + expat_dll: ${{ matrix.expat_dll }} + run: |- + ctest_args=( + --build-config "${cmake_build_type}" + --output-on-failure + --parallel 2 + ) + set -x + cd '/c/Program Files (x86)/Expat '*/Source/build + cp -v "${cmake_build_type}/${expat_dll}" "tests/${cmake_build_type}/" + ctest "${ctest_args[@]}" diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml new file mode 100644 index 00000000..851b2483 --- /dev/null +++ b/.github/workflows/windows-build.yml @@ -0,0 +1,116 @@ +# __ __ _ +# ___\ \/ /_ __ __ _| |_ +# / _ \\ /| '_ \ / _` | __| +# | __// \| |_) | (_| | |_ +# \___/_/\_\ .__/ \__,_|\__| +# |_| XML parser +# +# Copyright (c) 2025 Sebastian Pipping +# Licensed under the MIT license: +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to permit +# persons to whom the Software is furnished to do so, subject to the +# following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. + +name: Build on Windows + +on: + pull_request: + push: + schedule: + - cron: '0 2 * * 5' # Every Friday at 2am + workflow_dispatch: + +permissions: + contents: read + +jobs: + windows_build: + name: Build on Windows (${{ matrix.runs-on }}, ${{ matrix.cmake_platform }}, ${{ matrix.expat_char_type }}) + strategy: + fail-fast: false + matrix: + include: + - runs-on: windows-2019 + cmake_build_type: Debug + cmake_generator: Visual Studio 16 2019 + cmake_platform: Win32 + expat_char_type: char + expat_dll: libexpatd.dll + - runs-on: windows-2022 + cmake_build_type: Debug + cmake_generator: Visual Studio 17 2022 + cmake_platform: x64 + expat_char_type: wchar_t + expat_dll: libexpatwd.dll + defaults: + run: + shell: bash + runs-on: "${{ matrix.runs-on }}" + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2 + + - name: Configure + env: + cmake_build_type: ${{ matrix.cmake_build_type }} + cmake_generator: ${{ matrix.cmake_generator }} + cmake_platform: ${{ matrix.cmake_platform }} + expat_char_type: ${{ matrix.expat_char_type }} + run: |- + cmake_args=( + -A "${cmake_platform}" + -G "${cmake_generator}" + -DCMAKE_BUILD_TYPE="${cmake_build_type}" + -DEXPAT_CHAR_TYPE="${expat_char_type}" + -DEXPAT_WARNINGS_AS_ERRORS=ON + -Wdev + -Wdeprecated + ) + set -x + cd expat + mkdir build + cmake -S . -B build "${cmake_args[@]}" + + - name: Build + env: + cmake_build_type: ${{ matrix.cmake_build_type }} + run: |- + msbuild_args=( + -m + -property:Configuration="${cmake_build_type}" + ) + set -x + cd expat/build + MSBuild.exe "${msbuild_args[@]}" expat.sln + + - name: Run tests + env: + cmake_build_type: ${{ matrix.cmake_build_type }} + expat_dll: ${{ matrix.expat_dll }} + run: |- + ctest_args=( + --build-config "${cmake_build_type}" + --output-on-failure + --parallel 2 + ) + set -x + cd expat/build + cp -v "${cmake_build_type}/${expat_dll}" "tests/${cmake_build_type}/" + ctest "${ctest_args[@]}" diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 8ac58020..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,120 +0,0 @@ -# AppVeyor configuration -# __ __ _ -# ___\ \/ /_ __ __ _| |_ -# / _ \\ /| '_ \ / _` | __| -# | __// \| |_) | (_| | |_ -# \___/_/\_\ .__/ \__,_|\__| -# |_| XML parser -# -# Copyright (c) 2017 José Gutiérrez de la Concha -# Copyright (c) 2017-2023 Sebastian Pipping -# Copyright (c) 2017 Franek Korta -# Licensed under the MIT license: -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to permit -# persons to whom the Software is furnished to do so, subject to the -# following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -# USE OR OTHER DEALINGS IN THE SOFTWARE. - -# scripts that are called at very beginning, before repo cloning -init: -- git config --global core.autocrlf input - -# version format -version: libexpat-{build} - -# set clone depth, clone entire repository history if not defined -clone_depth: 50 - -# clone directory -clone_folder: c:\projects\libexpat - -configuration: Debug - -# AppVeyor pre-installed software: -# https://www.appveyor.com/docs/build-environment/#pre-installed-software -# -# CMake Visual Studio generators: -# https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators -environment: - matrix: - # Visual Studio 2019 Win32 - - GENERATOR: Visual Studio 16 2019 - PLATFORM: Win32 - CMAKE_ARGS: -A Win32 - EXPAT_DLL: libexpatd.dll - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - - # Visual Studio 2019 Win32 XML_UNICODE_WCHAR_T - - GENERATOR: Visual Studio 16 2019 - PLATFORM: Win32 - CMAKE_ARGS: -A Win32 -DEXPAT_CHAR_TYPE=wchar_t - EXPAT_DLL: libexpatwd.dll - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - - # Visual Studio 2019 x64 - - GENERATOR: Visual Studio 16 2019 - PLATFORM: x64 - EXPAT_DLL: libexpatd.dll - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - - # Visual Studio 2019 x64 XML_UNICODE_WCHAR_T - - GENERATOR: Visual Studio 16 2019 - PLATFORM: x64 - CMAKE_ARGS: -DEXPAT_CHAR_TYPE=wchar_t - EXPAT_DLL: libexpatwd.dll - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - - # Visual Studio 2022 Win32 - - GENERATOR: Visual Studio 17 2022 - PLATFORM: Win32 - CMAKE_ARGS: -A Win32 - EXPAT_DLL: libexpatd.dll - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - - # Visual Studio 2022 Win32 XML_UNICODE_WCHAR_T - - GENERATOR: Visual Studio 17 2022 - PLATFORM: Win32 - CMAKE_ARGS: -A Win32 -DEXPAT_CHAR_TYPE=wchar_t - EXPAT_DLL: libexpatwd.dll - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - - # Visual Studio 2022 x64 - - GENERATOR: Visual Studio 17 2022 - PLATFORM: x64 - EXPAT_DLL: libexpatd.dll - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - - # Visual Studio 2022 x64 XML_UNICODE_WCHAR_T - - GENERATOR: Visual Studio 17 2022 - PLATFORM: x64 - CMAKE_ARGS: -DEXPAT_CHAR_TYPE=wchar_t - EXPAT_DLL: libexpatwd.dll - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - -before_build: - - echo Running cmake... - - cd c:\projects\libexpat - - cmake -G"%GENERATOR%" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DEXPAT_WARNINGS_AS_ERRORS=ON %CMAKE_ARGS% expat - -build: - parallel: true # enable MSBuild parallel builds - project: expat.sln # path to Visual Studio solution or project - -test_script: - - cp %CONFIGURATION%\\%EXPAT_DLL% tests\\%CONFIGURATION%\\ - - ctest --build-config %CONFIGURATION% --output-on-failure --parallel 2 diff --git a/expat/Changes b/expat/Changes index 82e2f663..f5f7de12 100644 --- a/expat/Changes +++ b/expat/Changes @@ -20,7 +20,6 @@ !! (needs discussion before pull requests), !! !! - smart ideas on fixing the Autotools CMake files generation issue !! !! without breaking CI (needs discussion before pull requests), !! -!! - the Windows binaries topic (needs requirements engineering first), !! !! - pushing migration from `int` to `size_t` further !! !! including edge-cases test coverage (needs discussion before anything). !! !! !!