@cryptotaxi247 / netdata-1 / commits / 9e575dbec

Add Widnows CI jobs. (#18187)

* Initial Windows CI support. This also adds a proper set of production-focused packaging scripts for working with building Netdata on Windows. * Pivot to using existing tooling and fixing that up as required. * General script cleanup. * Auto-detect location of repository based on script location. This makes the scripts properly independent of the current working directory, allowing them to be more resilient to possible changes in the build environment. * Make dependency handling entirely separate from build. * Remove development-only packages from dependency list. They only waste time in CI, and it’s reasonable to assume that anybody who needs them can install them themselves, just like we do with all other platforms. * Use absolute path for makensis. This way it actually works without needing manual modification of the environment. * Add PowerShell scripts to invoke the build and package scripts. * Clean up build directory handling. * Fix fetching of msys2 installer. * Further cleanup. * Tidy up build output * Provide proper output grouping in GitHub Actions. * Use correct command name for makensis. * Fix installer script path. * Do not try to install MSYS2 using Chocolatey. * Fix CPU architecture check. * Add more detailed messages for MSYS2 install. * Fix release fetching logic. * Further release check logic fixes. * Complete Windows CI support. * Move second update pass into dependency handling script. * Fix handling of icon for Windows installer. * Default to using a working configuration for release builds. And provide a way to pass extra options to CMake without needing to modify the script. * Fix expansion of optionally defined variable.

Austin S. Hemmelgarn committed Jul 18, 2024 at 13:28 UTC 9e575dbec8ff1262918133c021c079ee5b7db9e3
19 files changed +445 -110
.github/workflows/build.yml
+40
@@ -70,6 +70,7 @@ jobs:
70 packaging/cmake/
71 packaging/makeself/
72 packaging/installer/
73 + packaging/windows/
74 packaging/*.sh
75 packaging/*.version
76 packaging/*.checksums
@@ -975,6 +976,7 @@ jobs:
976 }}
977
978 macos-build: # Test building on macOS
979 + name: Test building on macOS
980 runs-on: ${{ matrix.runner }}
981 if: github.event_name != 'workflow_dispatch'
982 needs:
@@ -1045,6 +1047,44 @@ jobs:
1047 && github.repository == 'netdata/netdata'
1048 }}
1049
1050 + windows-build: # Test building on Windows
1051 + name: Test building on Windows
1052 + runs-on: windows-latest
1053 + if: github.event_name != 'workflow_dispatch'
1054 + needs:
1055 + - file-check
1056 + steps:
1057 + - name: Skip Check
1058 + id: skip
1059 + if: needs.file-check.outputs.run != 'true'
1060 + run: Write-Output "SKIPPED"
1061 + - name: Checkout
1062 + uses: actions/checkout@v4
1063 + id: checkout
1064 + if: needs.file-check.outputs.run == 'true'
1065 + with:
1066 + submodules: recursive
1067 + lfs: true
1068 + - name: Set Up Dependencies
1069 + id: deps
1070 + if: needs.file-check.outputs.run == 'true'
1071 + run: ./packaging/windows/install-dependencies.ps1
1072 + - name: Build Netdata
1073 + id: build
1074 + if: needs.file-check.outputs.run == 'true'
1075 + run: ./packaging/windows/build.ps1
1076 + - name: Package Netdata
1077 + id: package
1078 + if: needs.file-check.outputs.run == 'true'
1079 + run: ./packaging/windows/package.ps1
1080 + - name: Upload Installer
1081 + id: upload
1082 + uses: actions/upload-artifact@v4
1083 + with:
1084 + name: windows-x86_64-installer
1085 + path: packaging\windows\netdata-installer.exe
1086 + retention-days: 30
1087 +
1088 updater-check: # Test the generated dist archive using the updater code.
1089 name: Test Generated Distfile and Updater Code
1090 runs-on: ubuntu-latest
packaging/utils/compile-on-windows.sh deleted
-79
@@ -1,79 +0,0 @@
1 -#!/bin/sh
2 -
3 -# On MSYS2, install these dependencies to build netdata:
4 -install_dependencies() {
5 - pacman -S \
6 - git cmake ninja base-devel msys2-devel \
7 - libyaml-devel libzstd-devel libutil-linux libutil-linux-devel \
8 - mingw-w64-x86_64-toolchain mingw-w64-ucrt-x86_64-toolchain \
9 - mingw64/mingw-w64-x86_64-mold ucrt64/mingw-w64-ucrt-x86_64-mold \
10 - msys/gdb ucrt64/mingw-w64-ucrt-x86_64-gdb mingw64/mingw-w64-x86_64-gdb \
11 - msys/zlib-devel mingw64/mingw-w64-x86_64-zlib ucrt64/mingw-w64-ucrt-x86_64-zlib \
12 - msys/libuv-devel ucrt64/mingw-w64-ucrt-x86_64-libuv mingw64/mingw-w64-x86_64-libuv \
13 - liblz4-devel mingw64/mingw-w64-x86_64-lz4 ucrt64/mingw-w64-ucrt-x86_64-lz4 \
14 - openssl-devel mingw64/mingw-w64-x86_64-openssl ucrt64/mingw-w64-ucrt-x86_64-openssl \
15 - protobuf-devel mingw64/mingw-w64-x86_64-protobuf ucrt64/mingw-w64-ucrt-x86_64-protobuf \
16 - msys/pcre2-devel mingw64/mingw-w64-x86_64-pcre2 ucrt64/mingw-w64-ucrt-x86_64-pcre2 \
17 - msys/brotli-devel mingw64/mingw-w64-x86_64-brotli ucrt64/mingw-w64-ucrt-x86_64-brotli \
18 - msys/ccache ucrt64/mingw-w64-ucrt-x86_64-ccache mingw64/mingw-w64-x86_64-ccache \
19 - mingw64/mingw-w64-x86_64-go ucrt64/mingw-w64-ucrt-x86_64-go \
20 - mingw64/mingw-w64-x86_64-nsis
21 -}
22 -
23 -if [ "${1}" = "install" ]
24 -then
25 - install_dependencies || exit 1
26 - exit 0
27 -fi
28 -
29 -BUILD_FOR_PACKAGING="Off"
30 -if [ "${1}" = "package" ]
31 -then
32 - BUILD_FOR_PACKAGING="On"
33 -fi
34 -
35 -export PATH="/usr/local/bin:${PATH}"
36 -
37 -WT_ROOT="$(pwd)"
38 -BUILD_TYPE="Debug"
39 -NULL=""
40 -
41 -if [ -z "${MSYSTEM}" ]; then
42 - build="${WT_ROOT}/build-${OSTYPE}"
43 -else
44 - build="${WT_ROOT}/build-${OSTYPE}-${MSYSTEM}"
45 -fi
46 -
47 -if [ "$USER" = "vk" ]; then
48 - build="${WT_ROOT}/build"
49 -fi
50 -
51 -set -exu -o pipefail
52 -
53 -if [ -d "${build}" ]
54 -then
55 - rm -rf "${build}"
56 -fi
57 -
58 -/usr/bin/cmake -S "${WT_ROOT}" -B "${build}" \
59 - -G Ninja \
60 - -DCMAKE_INSTALL_PREFIX="/opt/netdata" \
61 - -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
62 - -DCMAKE_C_FLAGS="-fstack-protector-all -O0 -ggdb -Wall -Wextra -Wno-char-subscripts -Wa,-mbig-obj -pipe -DNETDATA_INTERNAL_CHECKS=1 -D_FILE_OFFSET_BITS=64 -D__USE_MINGW_ANSI_STDIO=1" \
63 - -DBUILD_FOR_PACKAGING=${BUILD_FOR_PACKAGING} \
64 - -DUSE_MOLD=Off \
65 - -DNETDATA_USER="${USER}" \
66 - -DDEFAULT_FEATURE_STATE=Off \
67 - -DENABLE_H2O=Off \
68 - -DENABLE_ACLK=On \
69 - -DENABLE_CLOUD=On \
70 - -DENABLE_ML=On \
71 - -DENABLE_BUNDLED_JSONC=On \
72 - -DENABLE_BUNDLED_PROTOBUF=Off \
73 - ${NULL}
74 -
75 -ninja -v -C "${build}" || ninja -v -C "${build}" -j 1
76 -
77 -echo
78 -echo "Compile with:"
79 -echo "ninja -v -C \"${build}\" || ninja -v -C \"${build}\" -j 1"
packaging/utils/package-windows.sh deleted
-31
@@ -1,31 +0,0 @@
1 -#!/bin/bash
2 -
3 -export PATH="/usr/local/bin:${PATH}"
4 -
5 -WT_ROOT="$(pwd)"
6 -
7 -if [ -z "${MSYSTEM}" ]; then
8 - build="${WT_ROOT}/build-${OSTYPE}"
9 -else
10 - build="${WT_ROOT}/build-${OSTYPE}-${MSYSTEM}"
11 -fi
12 -
13 -if [ "$USER" = "vk" ]; then
14 - build="${WT_ROOT}/build"
15 -fi
16 -
17 -set -exu -o pipefail
18 -
19 -ninja -v -C "${build}" install
20 -
21 -if [ ! -f "/msys2-installer.exe" ]; then
22 - wget -O /msys2-installer.exe \
23 - "https://github.com/msys2/msys2-installer/releases/download/2024-05-07/msys2-x86_64-20240507.exe"
24 -fi
25 -
26 -NDVERSION=$"$(grep 'CMAKE_PROJECT_VERSION:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)"
27 -NDMAJORVERSION=$"$(grep 'CMAKE_PROJECT_VERSION_MAJOR:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)"
28 -NDMINORVERSION=$"$(grep 'CMAKE_PROJECT_VERSION_MINOR:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)"
29 -
30 -makensis -DCURRVERSION="${NDVERSION}" -DMAJORVERSION="${NDMAJORVERSION}" -DMINORVERSION="${NDMINORVERSION}" "${WT_ROOT}/packaging/utils/installer.nsi"
31 -
packaging/windows/NetdataWhite.ico renamed
packaging/windows/bash_execute.sh renamed
packaging/windows/build.ps1 new
+16
@@ -0,0 +1,16 @@
1 +# Run the build
2 +
3 +#Requires -Version 4.0
4 +
5 +$ErrorActionPreference = "Stop"
6 +
7 +. "$PSScriptRoot\functions.ps1"
8 +
9 +$msysbash = Get-MSYS2Bash "$msysprefix"
10 +$env:CHERE_INVOKING = 'yes'
11 +
12 +& $msysbash -l "$PSScriptRoot\compile-on-windows.sh"
13 +
14 +if ($LastExitcode -ne 0) {
15 + exit 1
16 +}
packaging/windows/clion-msys-mingw64-environment.bat renamed
packaging/windows/clion-msys-msys-environment.bat renamed
packaging/windows/compile-on-windows.sh new
+53
@@ -0,0 +1,53 @@
1 +#!/bin/bash
2 +
3 +repo_root="$(dirname "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd -P)")")"
4 +BUILD_TYPE="Debug"
5 +
6 +if [ -n "${BUILD_DIR}" ]; then
7 + build="${BUILD_DIR}"
8 +elif [ -n "${OSTYPE}" ]; then
9 + if [ -n "${MSYSTEM}" ]; then
10 + build="${repo_root}/build-${OSTYPE}-${MSYSTEM}"
11 + else
12 + build="${repo_root}/build-${OSTYPE}"
13 + fi
14 +elif [ "$USER" = "vk" ]; then
15 + build="${repo_root}/build"
16 +else
17 + build="${repo_root}/build"
18 +fi
19 +
20 +set -exu -o pipefail
21 +
22 +if [ -d "${build}" ]; then
23 + rm -rf "${build}"
24 +fi
25 +
26 +${GITHUB_ACTIONS+echo "::group::Configuring"}
27 +# shellcheck disable=SC2086
28 +/usr/bin/cmake -S "${repo_root}" -B "${build}" \
29 + -G Ninja \
30 + -DCMAKE_INSTALL_PREFIX="/opt/netdata" \
31 + -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
32 + -DCMAKE_C_FLAGS="-fstack-protector-all -O0 -ggdb -Wall -Wextra -Wno-char-subscripts -Wa,-mbig-obj -pipe -DNETDATA_INTERNAL_CHECKS=1 -D_FILE_OFFSET_BITS=64 -D__USE_MINGW_ANSI_STDIO=1" \
33 + -DBUILD_FOR_PACKAGING=On \
34 + -DNETDATA_USER="${USER}" \
35 + -DDEFAULT_FEATURE_STATE=Off \
36 + -DENABLE_H2O=Off \
37 + -DENABLE_ACLK=On \
38 + -DENABLE_CLOUD=On \
39 + -DENABLE_ML=On \
40 + -DENABLE_BUNDLED_JSONC=On \
41 + -DENABLE_BUNDLED_PROTOBUF=Off \
42 + ${EXTRA_CMAKE_OPTIONS:-''}
43 +${GITHUB_ACTIONS+echo "::endgroup::"}
44 +
45 +${GITHUB_ACTIONS+echo "::group::Building"}
46 +ninja -C "${build}" -k 1
47 +${GITHUB_ACTIONS+echo "::endgroup::"}
48 +
49 +if [ -t 1 ]; then
50 + echo
51 + echo "Compile with:"
52 + echo "ninja -v -C \"${build}\" || ninja -v -C \"${build}\" -j 1"
53 +fi
packaging/windows/fetch-msys2-installer.py new
+101
@@ -0,0 +1,101 @@
1 +#!/usr/bin/env python
2 +
3 +'''Fetch the MSYS2 installer.'''
4 +
5 +from __future__ import annotations
6 +
7 +import hashlib
8 +import json
9 +import shutil
10 +import sys
11 +
12 +from pathlib import Path
13 +from tempfile import TemporaryDirectory
14 +from typing import Final
15 +from urllib.request import Request, urlopen
16 +
17 +REPO: Final = 'msys2/msys2-installer'
18 +
19 +
20 +def get_latest_release() -> tuple[str, str]:
21 + '''Get the latest release for the repo.'''
22 + REQUEST: Final = Request(
23 + url=f'https://api.github.com/repos/{REPO}/releases',
24 + headers={
25 + 'Accept': 'application/vnd.github+json',
26 + 'X-GitHub-API-Version': '2022-11-28',
27 + },
28 + method='GET',
29 + )
30 +
31 + print('>>> Fetching release list')
32 +
33 + with urlopen(REQUEST, timeout=15) as response:
34 + if response.status != 200:
35 + print(f'!!! Failed to fetch release list, status={response.status}')
36 + sys.exit(1)
37 +
38 + data = json.load(response)
39 +
40 + data = list(filter(lambda x: x['name'] != 'Nightly Installer Build', data))
41 +
42 + name = data[0]['name']
43 + version = data[0]['tag_name'].replace('-', '')
44 +
45 + return name, version
46 +
47 +
48 +def fetch_release_asset(tmpdir: Path, name: str, file: str) -> Path:
49 + '''Fetch a specific release asset.'''
50 + REQUEST: Final = Request(
51 + url=f'https://github.com/{REPO}/releases/download/{name}/{file}',
52 + method='GET',
53 + )
54 + TARGET: Final = tmpdir / file
55 +
56 + print(f'>>> Downloading {file}')
57 +
58 + with urlopen(REQUEST, timeout=15) as response:
59 + if response.status != 200:
60 + print(f'!!! Failed to fetch {file}, status={response.status}')
61 + sys.exit(1)
62 +
63 + TARGET.write_bytes(response.read())
64 +
65 + return TARGET
66 +
67 +
68 +def main() -> None:
69 + '''Core program logic.'''
70 + if len(sys.argv) != 2:
71 + print(f'{__file__} must be run with exactly one argument.')
72 +
73 + target = Path(sys.argv[1])
74 + tmp_target = target.with_name(f'.{target.name}.tmp')
75 +
76 + name, version = get_latest_release()
77 +
78 + with TemporaryDirectory() as tmpdir:
79 + tmppath = Path(tmpdir)
80 +
81 + installer = fetch_release_asset(tmppath, name, f'msys2-x86_64-{version}.exe')
82 + checksums = fetch_release_asset(tmppath, name, f'msys2-x86_64-{version}.exe.sha256')
83 +
84 + print('>>> Verifying SHA256 checksum')
85 + expected_checksum = checksums.read_text().partition(' ')[0].casefold()
86 + actual_checksum = hashlib.sha256(installer.read_bytes()).hexdigest().casefold()
87 +
88 + if expected_checksum != actual_checksum:
89 + print('!!! Checksum mismatch')
90 + print(f'!!! Expected: {expected_checksum}')
91 + print(f'!!! Actual: {actual_checksum}')
92 + sys.exit(1)
93 +
94 + print(f'>>> Copying to {target}')
95 +
96 + shutil.copy(installer, tmp_target)
97 + tmp_target.replace(target)
98 +
99 +
100 +if __name__ == '__main__':
101 + main()
packaging/windows/functions.ps1 new
+31
@@ -0,0 +1,31 @@
1 +# Functions used by the PowerShell scripts in this directory.
2 +
3 +#Requires -Version 4.0
4 +
5 +function Get-MSYS2Prefix {
6 + if (-Not ($msysprefix)) {
7 + if (Test-Path -Path C:\msys64\usr\bin\bash.exe) {
8 + return "C:\msys64"
9 + } elseif ($env:ChocolateyToolsLocation) {
10 + if (Test-Path -Path "$env:ChocolateyToolsLocation\msys64\usr\bin\bash.exe") {
11 + Write-Host "Found MSYS2 installed via Chocolatey"
12 + Write-Host "This will work for building Netdata, but not for packaging it"
13 + return "$env:ChocolateyToolsLocation\msys64"
14 + }
15 + }
16 + }
17 +
18 + return ""
19 +}
20 +
21 +function Get-MSYS2Bash {
22 + $msysprefix = $args[0]
23 +
24 + if (-Not ($msysprefix)) {
25 + $msysprefix = Get-MSYS2Prefix
26 + }
27 +
28 + Write-Host "Using MSYS2 from $msysprefix"
29 +
30 + return "$msysprefix\usr\bin\bash.exe"
31 +}
packaging/windows/install-dependencies.ps1 new
+84
@@ -0,0 +1,84 @@
1 +# Set up Windows build dependencies.
2 +#
3 +# This script first sees if msys is installed. If so, it just uses it. If not, it tries to bootstrap it with chocolatey or winget.
4 +
5 +#Requires -Version 4.0
6 +
7 +$ErrorActionPreference = "Stop"
8 +
9 +. "$PSScriptRoot\functions.ps1"
10 +
11 +$msysprefix = Get-MSYS2Prefix
12 +
13 +function Check-FileHash {
14 + $file_path = $args[0]
15 +
16 + Write-Host "Checking SHA256 hash of $file_path"
17 +
18 + $actual_hash = (Get-FileHash -Algorithm SHA256 -Path $file_path).Hash.toLower()
19 + $expected_hash = (Get-Content "$file_path.sha256").split()[0]
20 +
21 + if ($actual_hash -ne $expected_hash) {
22 + Write-Host "SHA256 hash mismatch!"
23 + Write-Host "Expected: $expected_hash"
24 + Write-Host "Actual: $actual_hash"
25 + exit 1
26 + }
27 +}
28 +
29 +function Install-MSYS2 {
30 + $repo = 'msys2/msys2-installer'
31 + $uri = "https://api.github.com/repos/$repo/releases"
32 + $headers = @{
33 + 'Accept' = 'application/vnd.github+json'
34 + 'X-GitHub-API-Version' = '2022-11-28'
35 + }
36 + $installer_path = "$env:TEMP\msys2-base.exe"
37 +
38 + if ($env:PROCESSOR_ARCHITECTURE -ne "AMD64") {
39 + Write-Host "We can only install MSYS2 for 64-bit x86 systems, but you appear to have a different processor architecture ($env:PROCESSOR_ARCHITECTURE)."
40 + Write-Host "You will need to install MSYS2 yourself instead."
41 + exit 1
42 + }
43 +
44 + Write-Host "Determining latest release"
45 + $release_list = Invoke-RestMethod -Uri $uri -Headers $headers -TimeoutSec 30
46 +
47 + $release = $release_list[0]
48 + $release_name = $release.name
49 + $version = $release.tag_name.Replace('-', '')
50 + $installer_url = "https://github.com/$repo/releases/download/$release_name/msys2-x86_64-$version.exe"
51 +
52 + Write-Host "Fetching $installer_url"
53 + Invoke-WebRequest $installer_url -OutFile $installer_path
54 + Write-Host "Fetching $installer_url.sha256"
55 + Invoke-WebRequest "$installer_url.sha256" -OutFile "$installer_path.sha256"
56 +
57 + Write-Host "Checking file hash"
58 + Check-FileHash $installer_path
59 +
60 + Write-Host "Installing"
61 + & $installer_path in --confirm-command --accept-messages --root C:/msys64
62 +
63 + return "C:\msys64"
64 +}
65 +
66 +if (-Not ($msysprefix)) {
67 + Write-Host "Could not find MSYS2, attempting to install it"
68 + $msysprefix = Install-MSYS2
69 +}
70 +
71 +$msysbash = Get-MSYS2Bash "$msysprefix"
72 +$env:CHERE_INVOKING = 'yes'
73 +
74 +& $msysbash -l "$PSScriptRoot\msys2-dependencies.sh"
75 +
76 +if ($LastExitcode -ne 0) {
77 + Write-Host "First update attempt failed. This is expected if the msys-runtime package needed updated, trying again."
78 +
79 + & $msysbash -l "$PSScriptRoot\msys2-dependencies.sh"
80 +
81 + if ($LastExitcode -ne 0) {
82 + exit 1
83 + }
84 +}
packaging/windows/installer.nsi renamed
packaging/windows/invoke-msys2.ps1 new
+16
@@ -0,0 +1,16 @@
1 +# Invoke the specified script using MSYS2
2 +
3 +#Requires -Version 4.0
4 +
5 +$ErrorActionPreference = "Stop"
6 +
7 +. "$PSScriptRoot\functions.ps1"
8 +
9 +$msysbash = Get-MSYS2Bash "$msysprefix"
10 +$env:CHERE_INVOKING = 'yes'
11 +
12 +& $msysbash -l $args[0]
13 +
14 +if ($LastExitcode -ne 0) {
15 + exit 1
16 +}
packaging/windows/msys2-dependencies.sh new
+51
@@ -0,0 +1,51 @@
1 +#!/bin/bash
2 +#
3 +# Install the dependencies we need to build Netdata on MSYS2
4 +
5 +. /etc/profile
6 +
7 +set -euo pipefail
8 +
9 +${GITHUB_ACTIONS+echo "::group::Updating MSYS2"}
10 +pacman -Syuu --noconfirm
11 +${GITHUB_ACTIONS+echo "::endgroup::"}
12 +
13 +${GITHUB_ACTIONS+echo "::group::Installing dependencies"}
14 +pacman -S --noconfirm \
15 + base-devel \
16 + cmake \
17 + git \
18 + liblz4-devel \
19 + libutil-linux \
20 + libutil-linux-devel \
21 + libyaml-devel \
22 + libzstd-devel \
23 + mingw64/mingw-w64-x86_64-brotli \
24 + mingw64/mingw-w64-x86_64-go \
25 + mingw64/mingw-w64-x86_64-libuv \
26 + mingw64/mingw-w64-x86_64-lz4 \
27 + mingw64/mingw-w64-x86_64-nsis \
28 + mingw64/mingw-w64-x86_64-openssl \
29 + mingw64/mingw-w64-x86_64-pcre2 \
30 + mingw64/mingw-w64-x86_64-protobuf \
31 + mingw64/mingw-w64-x86_64-zlib \
32 + mingw-w64-ucrt-x86_64-toolchain \
33 + mingw-w64-x86_64-toolchain \
34 + msys2-devel \
35 + msys/brotli-devel \
36 + msys/libuv-devel \
37 + msys/pcre2-devel \
38 + msys/zlib-devel \
39 + ninja \
40 + openssl-devel \
41 + protobuf-devel \
42 + python \
43 + ucrt64/mingw-w64-ucrt-x86_64-brotli \
44 + ucrt64/mingw-w64-ucrt-x86_64-go \
45 + ucrt64/mingw-w64-ucrt-x86_64-libuv \
46 + ucrt64/mingw-w64-ucrt-x86_64-lz4 \
47 + ucrt64/mingw-w64-ucrt-x86_64-openssl \
48 + ucrt64/mingw-w64-ucrt-x86_64-pcre2 \
49 + ucrt64/mingw-w64-ucrt-x86_64-protobuf \
50 + ucrt64/mingw-w64-ucrt-x86_64-zlib
51 +${GITHUB_ACTIONS+echo "::endgroup::"}
packaging/windows/package-windows.sh new
+37
@@ -0,0 +1,37 @@
1 +#!/bin/bash
2 +
3 +repo_root="$(dirname "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd -P)")")"
4 +
5 +if [ -n "${BUILD_DIR}" ]; then
6 + build="${BUILD_DIR}"
7 +elif [ -n "${OSTYPE}" ]; then
8 + if [ -n "${MSYSTEM}" ]; then
9 + build="${repo_root}/build-${OSTYPE}-${MSYSTEM}"
10 + else
11 + build="${repo_root}/build-${OSTYPE}"
12 + fi
13 +elif [ "$USER" = "vk" ]; then
14 + build="${repo_root}/build"
15 +else
16 + build="${repo_root}/build"
17 +fi
18 +
19 +set -exu -o pipefail
20 +
21 +${GITHUB_ACTIONS+echo "::group::Installing"}
22 +ninja -C "${build}" -k 1 install
23 +${GITHUB_ACTIONS+echo "::endgroup::"}
24 +
25 +if [ ! -f "/msys2-installer.exe" ]; then
26 + ${GITHUB_ACTIONS+echo "::group::Fetching MSYS2 installer"}
27 + "${repo_root}/packaging/windows/fetch-msys2-installer.py" /msys2-installer.exe
28 + ${GITHUB_ACTIONS+echo "::endgroup::"}
29 +fi
30 +
31 +${GITHUB_ACTIONS+echo "::group::Packaging"}
32 +NDVERSION=$"$(grep 'CMAKE_PROJECT_VERSION:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)"
33 +NDMAJORVERSION=$"$(grep 'CMAKE_PROJECT_VERSION_MAJOR:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)"
34 +NDMINORVERSION=$"$(grep 'CMAKE_PROJECT_VERSION_MINOR:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)"
35 +
36 +/mingw64/bin/makensis.exe -DCURRVERSION="${NDVERSION}" -DMAJORVERSION="${NDMAJORVERSION}" -DMINORVERSION="${NDMINORVERSION}" "${repo_root}/packaging/windows/installer.nsi"
37 +${GITHUB_ACTIONS+echo "::endgroup::"}
packaging/windows/package.ps1 new
+16
@@ -0,0 +1,16 @@
1 +# Package the build
2 +
3 +#Requires -Version 4.0
4 +
5 +$ErrorActionPreference = "Stop"
6 +
7 +. "$PSScriptRoot\functions.ps1"
8 +
9 +$msysbash = Get-MSYS2Bash "$msysprefix"
10 +$env:CHERE_INVOKING = 'yes'
11 +
12 +& $msysbash -l "$PSScriptRoot\package-windows.sh"
13 +
14 +if ($LastExitcode -ne 0) {
15 + exit 1
16 +}
packaging/windows/protoc.bat renamed
packaging/windows/windows-openssh-to-msys.bat renamed