]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Update Windows GitHub Actions
authorWolfgang Stöggl <c72578@yahoo.de>
Tue, 29 Jun 2021 19:16:53 +0000 (21:16 +0200)
committerWolfgang Stöggl <c72578@yahoo.de>
Sun, 4 Jul 2021 05:02:02 +0000 (07:02 +0200)
- Update ci-workflow.yml and add GitHub Actions for Windows builds
  using MSVC and vcpkg. Both, x64 and x86 builds are part of the CI.
  The required vcpkg ports are installed and cached using
  lukka/run-vcpkg@v7
- Add release-windows.yml, which enables building Windows binaries of
  RRDtool. This GitHub action is run automatically upon new tags and
  can be triggered manually. The required .exe and .dll files are
  copied using collect_rrdtool_vcpkg_files.bat and deployed by
  actions/upload-artifact@v2
- Makefile_vcpkg.msc:
  Add include\harfbuzz, which is required for building pango.
Fixes: pango-coverage.h(28): fatal error C1083:
  Cannot open include file: 'hb.h': No such file or directory

.github/workflows/ci-workflow.yml
.github/workflows/release-windows.yml [new file with mode: 0644]
win32/Makefile_vcpkg.msc
win32/collect_rrdtool_vcpkg_files.bat [new file with mode: 0644]

index 4b11aee5db7260700bec8bf57727850811711ebe..63a21ae30fc6cac3f9f3a5dd350931789716de34 100644 (file)
@@ -1,10 +1,19 @@
 ---
-name: Windows MSYS2 x86_64
+name: Windows CI
+
+# yamllint disable rule:line-length
+# yamllint disable-line rule:truthy
 on: [push, pull_request]
 
 jobs:
-  build:
-    runs-on: windows-latest
+  msys2:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        # https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
+        os: [windows-2019]
+        carch: [x86_64]
     defaults:
       run:
         shell: msys2 {0}
@@ -26,3 +35,52 @@ jobs:
       #   with:
       #     name: test-suite.log
       #     path: tests/test-suite.log
+  MSVC:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        # https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
+        os: [windows-2019]
+        triplet: [x64-windows, x86-windows]
+        include:
+          - os: windows-2019
+            triplet: x64-windows
+            # https://github.com/microsoft/vcpkg/commit/b361c2eefa3966cb7cec45275aff32e90430aaa6
+            vcpkgCommitId: 'b361c2eefa3966cb7cec45275aff32e90430aaa6'
+            vcpkgPackages: 'cairo expat fontconfig freetype gettext glib libpng libxml2 pango pcre zlib'
+            configuration: 'x64'
+            nmake_configuration: 'USE_64BIT=1'
+          - os: windows-2019
+            triplet: x86-windows
+            vcpkgCommitId: 'b361c2eefa3966cb7cec45275aff32e90430aaa6'
+            vcpkgPackages: 'cairo expat fontconfig freetype gettext glib libpng libxml2 pango pcre zlib'
+            configuration: 'x86'
+            nmake_configuration: ''
+    defaults:
+      run:
+        shell: cmd
+    env:
+      buildDir: '${{ github.workspace }}/build/'
+    steps:
+      - uses: actions/checkout@v1
+        with:
+          submodules: true
+
+      # Restore from cache the previously built ports. If cache-miss, download and build vcpkg (aka "bootstrap vcpkg").
+      - name: Restore from cache and install vcpkg
+        # Download and build vcpkg.
+        uses: lukka/run-vcpkg@v7
+        with:
+          setupOnly: false
+          # Location of vcpkg in the Git repository.
+          vcpkgDirectory: '${{ github.workspace }}/vcpkg'
+          vcpkgGitCommitId: '${{ matrix.vcpkgCommitId}}'
+          vcpkgTriplet: ${{ matrix.triplet }}
+          vcpkgArguments: '${{ matrix.vcpkgPackages }}'
+          # Ensure the vcpkg artifacts are cached, they are generated in the 'CMAKE_BINARY_DIR/vcpkg_installed' directory.
+          additionalCachedPaths: ${{ env.buildDir }}/vcpkg_installed
+      - name: Build ${{ matrix.configuration }}
+        run: |
+          call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.configuration }}
+          nmake -f win32\Makefile_vcpkg.msc ${{ matrix.nmake_configuration }}
diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml
new file mode 100644 (file)
index 0000000..8d9af3f
--- /dev/null
@@ -0,0 +1,69 @@
+---
+name: Release Windows
+
+# yamllint disable rule:line-length
+# yamllint disable-line rule:truthy
+on:
+  push:
+    tags:
+      - '*'
+  workflow_dispatch:
+
+defaults:
+  run:
+    shell: cmd
+
+jobs:
+  MSVC:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        # https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
+        os: [windows-2019]
+        triplet: [x64-windows, x86-windows]
+        include:
+          - os: windows-2019
+            triplet: x64-windows
+            # https://github.com/microsoft/vcpkg/commit/b361c2eefa3966cb7cec45275aff32e90430aaa6
+            vcpkgCommitId: 'b361c2eefa3966cb7cec45275aff32e90430aaa6'
+            vcpkgPackages: 'cairo expat fontconfig freetype gettext glib libpng libxml2 pango pcre zlib'
+            configuration: 'x64'
+            nmake_configuration: 'USE_64BIT=1'
+          - os: windows-2019
+            triplet: x86-windows
+            vcpkgCommitId: 'b361c2eefa3966cb7cec45275aff32e90430aaa6'
+            vcpkgPackages: 'cairo expat fontconfig freetype gettext glib libpng libxml2 pango pcre zlib'
+            configuration: 'x86'
+            nmake_configuration: ''
+    env:
+      buildDir: '${{ github.workspace }}/build/'
+    steps:
+      - uses: actions/checkout@v1
+        with:
+          submodules: true
+
+      # Restore from cache the previously built ports. If cache-miss, download and build vcpkg (aka "bootstrap vcpkg").
+      - name: Restore from cache and install vcpkg
+        # Download and build vcpkg.
+        uses: lukka/run-vcpkg@v7
+        with:
+          setupOnly: false
+          # Location of vcpkg in the Git repository.
+          vcpkgDirectory: '${{ github.workspace }}/vcpkg'
+          vcpkgGitCommitId: '${{ matrix.vcpkgCommitId}}'
+          vcpkgTriplet: ${{ matrix.triplet }}
+          vcpkgArguments: '${{ matrix.vcpkgPackages }}'
+          # Ensure the vcpkg artifacts are cached, they are generated in the 'CMAKE_BINARY_DIR/vcpkg_installed' directory.
+          additionalCachedPaths: ${{ env.buildDir }}/vcpkg_installed
+      - name: Build ${{ matrix.configuration }}
+        run: |
+          call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.configuration }}
+          nmake -f win32\Makefile_vcpkg.msc ${{ matrix.nmake_configuration }}
+      - name: Collect files
+        run: |
+          win32\collect_rrdtool_vcpkg_files.bat ${{ matrix.configuration }}
+      - uses: actions/upload-artifact@v2
+        with:
+          name: deploy-rrdtool-MSVC-${{ matrix.configuration }}
+          path: win32/nmake_release_${{ matrix.configuration }}_vcpkg/rrdtool-*-${{ matrix.configuration }}_vcpkg/
index cbd0a17001c9349e80c0df01a2ac88c2ded210e2..065420b98fde82eb1bbc94da906c7f62cea49919 100644 (file)
@@ -27,6 +27,7 @@ CPPFLAGS = $(CPPFLAGS) /TC /EHsc /O2 /Zi /Fd$(TOP)/win32/vc.pdb \
         /I $(ARCH_PATH)\include \\r
         /I $(ARCH_PATH)\include\cairo \\r
         /I $(ARCH_PATH)\include\pango-1.0 \\r
+        /I $(ARCH_PATH)\include\harfbuzz \\r
         /I $(ARCH_PATH)\include\glib-2.0 \\r
         /I $(ARCH_PATH)\lib\glib-2.0\include \\r
         /I $(ARCH_PATH)\include\libxml2\r
diff --git a/win32/collect_rrdtool_vcpkg_files.bat b/win32/collect_rrdtool_vcpkg_files.bat
new file mode 100644 (file)
index 0000000..cdac9a8
--- /dev/null
@@ -0,0 +1,67 @@
+@ echo off\r
+REM This script collects the built .exe and .dll files required for running RRDtool.\r
+REM It is supposed to be run after an MSVC build using nmake and libraries from vcpkg.\r
+REM Wolfgang Stöggl <c72578@yahoo.de>, 2017-2021.\r
+\r
+REM Run the batch file with command line parameter x64 or x86\r
+if "%1"=="" (\r
+  echo Command line parameter required: x64 or x86\r
+  echo e.g.: %~nx0 x64\r
+  exit /b\r
+)\r
+echo configuration: %1\r
+\r
+REM The script is located in the subdirectory win32\r
+echo %~dp0\r
+pushd %~dp0\r
+SET base_dir=..\r
+\r
+REM Read current version of RRDtool\r
+SET /p version=<%base_dir%\VERSION\r
+echo RRDtool version: %version%\r
+\r
+SET release_dir=%base_dir%\win32\nmake_release_%1_vcpkg\rrdtool-%version%-%1_vcpkg\\r
+echo release_dir: %release_dir%\r
+\r
+if exist %base_dir%\win32\nmake_release_%1_vcpkg rmdir %base_dir%\win32\nmake_release_%1_vcpkg /s /q\r
+mkdir %release_dir%\r
+\r
+REM use xcopy instead of copy. xcopy creates directories if necessary and outputs the copied file\r
+REM /Y Suppresses prompting to confirm that you want to overwrite an existing destination file.\r
+REM /D xcopy copies all Source files that are newer than existing Destination files\r
+\r
+xcopy /Y /D %base_dir%\win32\librrd-8.dll %release_dir%\r
+xcopy /Y /D %base_dir%\win32\rrdcgi.exe %release_dir%\r
+xcopy /Y /D %base_dir%\win32\rrdtool.exe %release_dir%\r
+xcopy /Y /D %base_dir%\win32\rrdupdate.exe %release_dir%\r
+\r
+REM The following part needs to be checked and maintained after an update to a new vcpkg version\r
+REM Names of dlls can change over time, which has happened in the past\r
+REM e.g. glib-2.dll -> glib-2.0-0.dll, expat.dll -> libexpat.dll\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\brotlicommon.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\brotlidec.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\bz2.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\cairo-2.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\libexpat.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\libffi.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\fontconfig-1.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\freetype.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\fribidi-0.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\gio-2.0-0.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\glib-2.0-0.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\gmodule-2.0-0.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\gobject-2.0-0.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\harfbuzz.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\iconv-2.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\intl-8.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\libpng16.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\libxml2.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\lzma.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\pango-1.0-0.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\pangocairo-1.0-0.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\pangoft2-1.0-0.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\pangowin32-1.0-0.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\pcre.dll %release_dir%\r
+xcopy /Y /D %base_dir%\vcpkg\installed\%1-windows\bin\zlib1.dll %release_dir%\r
+\r
+popd\r