Skip to content
Snippets Groups Projects
Commit a25ca0f8 authored by hluk's avatar hluk
Browse files

Appveyor: Use bash

parent b239ada0
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ image: ...@@ -6,6 +6,7 @@ image:
cache: cache:
- usr - usr
- downloads
# Build and test only once for a pull request. # Build and test only once for a pull request.
skip_branch_with_pr: true skip_branch_with_pr: true
...@@ -18,13 +19,13 @@ environment: ...@@ -18,13 +19,13 @@ environment:
SNORETOAST_VERSION: 0.7.0 SNORETOAST_VERSION: 0.7.0
matrix: matrix:
- QTDIR: C:\Qt\5.15\msvc2019_64 - QTDIR: /c/Qt/5.15/msvc2019_64
CMAKE_GENERATOR: Visual Studio 16 2019 CMAKE_GENERATOR: Visual Studio 16 2019
CMAKE_GENERATOR_ARCH: x64 CMAKE_GENERATOR_ARCH: x64
BUILD_SUB_DIR: Release BUILD_SUB_DIR: Release
# https://wiki.qt.io/Qt_5.15_Tools_and_Versions # https://wiki.qt.io/Qt_5.15_Tools_and_Versions
# https://www.appveyor.com/docs/windows-images-software/#tools # https://www.appveyor.com/docs/windows-images-software/#tools
OPENSSL_PATH: C:\OpenSSL-v111-Win64\bin OPENSSL_PATH: /c/OpenSSL-v111-Win64/bin
LIBSSL: libssl-1_1-x64.dll LIBSSL: libssl-1_1-x64.dll
LIBCRYPTO: libcrypto-1_1-x64.dll LIBCRYPTO: libcrypto-1_1-x64.dll
...@@ -32,16 +33,17 @@ environment: ...@@ -32,16 +33,17 @@ environment:
build: build:
install: install:
- utils\appveyor\install.bat - ps: $env:Path = "C:\Program Files\Git\bin;$env:Path"
- bash utils/appveyor/install.sh
before_build: before_build:
- utils\appveyor\before_build.bat - bash utils/appveyor/before_build.sh
build_script: build_script:
- utils\appveyor\build_script.bat - bash utils/appveyor/build_script.sh
after_build: after_build:
- utils\appveyor\after_build.bat - bash utils/appveyor/after_build.sh
artifacts: artifacts:
- path: 'copyq-*-setup.exe' - path: 'copyq-*-setup.exe'
......
@echo on
git describe --tags --always HEAD > _git_tag.tmp || goto :error
set /p AppVersion=<_git_tag.tmp
del _git_tag.tmp
set Source=%APPVEYOR_BUILD_FOLDER%
set Name=copyq-%AppVersion%
set Destination=%APPVEYOR_BUILD_FOLDER%\%Name%
set BuildRoot=%APPVEYOR_BUILD_FOLDER%\build
set Executable=%Destination%\copyq.exe
set Build=%BuildRoot%\%BUILD_SUB_DIR%
set BuildPlugins=%BuildRoot%\plugins\%BUILD_SUB_DIR%
set KF5_FULLVER=%KF5_VERSION%.%KF5_PATCH%
set INSTALL_PREFIX=%cd%\usr\kf-%KF5_FULLVER%-%CMAKE_GENERATOR_ARCH%
mkdir "%Destination%"
cmake --install build/ --config Release --prefix "%Destination%" --verbose || goto :error
dir /s %QTDIR%\bin\
xcopy /F "%INSTALL_PREFIX%\bin\KF5*.dll" "%Destination%" || goto :error
xcopy /F "%INSTALL_PREFIX%\bin\snoretoast.exe" "%Destination%" || goto :error
xcopy /F "%Source%\AUTHORS" "%Destination%" || goto :error
xcopy /F "%Source%\LICENSE" "%Destination%" || goto :error
xcopy /F "%Source%\README.md" "%Destination%" || goto :error
mkdir "%Destination%\themes"
xcopy /F "%Source%\shared\themes\*" "%Destination%\themes" || goto :error
mkdir "%Destination%\translations"
xcopy /F "%BuildRoot%\src\*.qm" "%Destination%\translations" || goto :error
mkdir "%Destination%\plugins"
xcopy /F "%BuildPlugins%\*.dll" "%Destination%\plugins" || goto :error
xcopy /F "%OPENSSL_PATH%\%LIBCRYPTO%" "%Destination%" || goto :error
xcopy /F "%OPENSSL_PATH%\%LIBSSL%" "%Destination%" || goto :error
%QTDIR%\bin\windeployqt --version
%QTDIR%\bin\windeployqt --help
%QTDIR%\bin\windeployqt ^
--no-system-d3d-compiler ^
--no-angle ^
--no-opengl-sw ^
--no-quick^
"%Destination%\KF5ConfigCore.dll"^
"%Destination%\KF5Notifications.dll"^
"%Executable%" || goto :error
REM Create and upload portable zip file.
7z a "%Name%.zip" -r "%Destination%" || goto :error
appveyor PushArtifact "%Name%.zip" -DeploymentName "CopyQ Portable" || goto :error
REM This works with minGW, not msvc.
REM objdump -x "%Destination%\KF5Notifications.dll" | findstr /C:"DLL Name"
REM objdump -x "%Destination%\copyq.exe" | findstr /C:"DLL Name"
REM Note: Following removes system-installed dlls to verify required libs are included.
del C:\Windows\System32\libcrypto-* || goto :error
del C:\Windows\System32\libssl-* || goto :error
del C:\Windows\SysWOW64\libcrypto-* || goto :error
del C:\Windows\SysWOW64\libssl-* || goto :error
set OldPath=%PATH%
set PATH=%Destination%
set QT_FORCE_STDERR_LOGGING=1
set COPYQ_TESTS_RERUN_FAILED=1
"%Executable%" --help || goto :error
"%Executable%" --version || goto :error
"%Executable%" --info || goto :error
"%Executable%" tests || goto :error
REM Take a screenshot of the main window and notifications.
start "" "%Executable%"
"%Executable%" show || "%Executable%" show || "%Executable%" show || goto :error
"%Executable%" popup TEST MESSAGE || goto :error
"%Executable%" notification^
.title Test^
.message Message...^
.button OK cmd data^
.button Close cmd data || goto :error
"%Executable%" screenshot > screenshot.png || goto :error
"%Executable%" exit || goto :error
set PATH=%OldPath%
appveyor PushArtifact screenshot.png -DeploymentName "Screenshot of the main window with notifications"
choco install -y InnoSetup || goto :error
"C:\ProgramData\chocolatey\bin\ISCC.exe" "/O%APPVEYOR_BUILD_FOLDER%" "/DAppVersion=%AppVersion%" "/DRoot=%Destination%" "/DSource=%Source%" "%Source%\Shared\copyq.iss" || goto :error
:error
exit /b %errorlevel%
#!/usr/bin/bash
set -exo pipefail
# shellcheck disable=SC1091
source utils/appveyor/env.sh
Source=$APPVEYOR_BUILD_FOLDER
Destination=$APPVEYOR_BUILD_FOLDER/$APP
Executable=$Destination/copyq.exe
BuildPlugins=$BUILD_PATH/plugins/$BUILD_SUB_DIR
mkdir -p "$Destination"
cmake --install "$BUILD_PATH" --config Release --prefix "$Destination" --verbose
cp -v "$INSTALL_PREFIX/bin/KF5"*.dll "$Destination"
cp -v "$INSTALL_PREFIX/bin/snoretoast.exe" "$Destination"
cp -v "$Source/AUTHORS" "$Destination"
cp -v "$Source/LICENSE" "$Destination"
cp -v "$Source/README.md" "$Destination"
mkdir -p "$Destination/themes"
cp -v "$Source/shared/themes/"* "$Destination/themes"
mkdir -p "$Destination/translations"
cp -v "$BUILD_PATH/src/"*.qm "$Destination/translations"
mkdir -p "$Destination/plugins"
cp -v "$BuildPlugins/"*.dll "$Destination/plugins"
cp -v "$OPENSSL_PATH/$LIBCRYPTO" "$Destination"
cp -v "$OPENSSL_PATH/$LIBSSL" "$Destination"
"$QTDIR/bin/windeployqt" --help
"$QTDIR/bin/windeployqt" \
--no-system-d3d-compiler \
--no-angle \
--no-opengl-sw \
--no-quick \
"$Destination/KF5ConfigCore.dll" \
"$Destination/KF5Notifications.dll" \
"$Executable"
# Create and upload portable zip file.
7z a "$APP.zip" -r "$Destination"
appveyor PushArtifact "$APP.zip" -DeploymentName "CopyQ Portable"
# This works with minGW, not msvc.
# objdump -x "$Destination/KF5Notifications.dll" | grep -F "DLL Name"
# objdump -x "$Destination/copyq.exe" | grep -F "DLL Name"
# Note: Following removes system-installed dlls to verify required libs are included.
rm -vf /c/Windows/System32/libcrypto-*
rm -vf /c/Windows/System32/libssl-*
rm -vf /c/Windows/SysWOW64/libcrypto-*
rm -vf /c/Windows/SysWOW64/libssl-*
OldPath=$PATH
export PATH=$Destination
export QT_FORCE_STDERR_LOGGING=1
export COPYQ_TESTS_RERUN_FAILED=1
"$Executable" --help
"$Executable" --version
"$Executable" --info
"$Executable" tests
# Take a screenshot of the main window and notifications.
"$Executable" &
"$Executable" show
"$Executable" popup TEST MESSAGE
"$Executable" notification \
.title Test \
.message Message... \
.button OK cmd data \
.button Close cmd data
"$Executable" screenshot > screenshot.png
"$Executable" exit
wait
export PATH=$OldPath
appveyor PushArtifact screenshot.png -DeploymentName "Screenshot of the main window with notifications"
choco install -y InnoSetup
cmd " /c C:/ProgramData/chocolatey/bin/ISCC.exe /O$APPVEYOR_BUILD_FOLDER /DAppVersion=$APP_VERSION /DRoot=$Destination /DSource=$Source $Source/Shared/copyq.iss"
@echo on
%QTDIR%\bin\qmake --version
set kf5_build=%APPVEYOR_BUILD_FOLDER%\utils\appveyor\kf5_build.bat
set snoretoast_build=%APPVEYOR_BUILD_FOLDER%\utils\appveyor\snoretoast_build.bat
set KF5_FULLVER=%KF5_VERSION%.%KF5_PATCH%
set INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%\usr\kf-%KF5_FULLVER%-%CMAKE_GENERATOR_ARCH%
set CMAKE_PREFIX=%INSTALL_PREFIX%\lib\cmake
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX%;%INSTALL_PREFIX%\share\ECM\cmake
mkdir %INSTALL_PREFIX%
set PATH=%PATH%;%INSTALL_PREFIX%\bin
mkdir dependencies
cd dependencies || goto :error
if not exist %CMAKE_PREFIX%\libsnoretoast %snoretoast_build%
if not exist %INSTALL_PREFIX%\share\ECM %kf5_build% extra-cmake-modules
if not exist %CMAKE_PREFIX%\KF5Config %kf5_build% kconfig
if not exist %CMAKE_PREFIX%\KF5WindowSystem %kf5_build% kwindowsystem
if not exist %CMAKE_PREFIX%\KF5CoreAddons %kf5_build% kcoreaddons
if not exist %CMAKE_PREFIX%\KF5Notifications-ignore %kf5_build% knotifications
REM appveyor PushArtifact "%cd%\..\build\knotifications\CMakeFiles\CMakeError.log"
REM appveyor PushArtifact "%cd%\..\build\knotifications\CMakeFiles\CMakeOutput.log"
cd ..
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release^
-G "%CMAKE_GENERATOR%" -A "%CMAKE_GENERATOR_ARCH%"^
-DCMAKE_PREFIX_PATH="%CMAKE_PREFIX_PATH%"^
-DCMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION=.^
-DWITH_TESTS=ON || goto :error
:error
exit /b %errorlevel%
#!/usr/bin/bash
set -exo pipefail
# shellcheck disable=SC1091
source utils/appveyor/env.sh
build=$APPVEYOR_BUILD_FOLDER/utils/appveyor/kf5_build.sh
export PATH=$PATH:$INSTALL_PREFIX/bin
"$build" snoretoast "v$SNORETOAST_VERSION" "$SNORETOAST_BASE_URL"
"$build" extra-cmake-modules
"$build" kconfig "" "" "-DKCONFIG_USE_GUI=OFF"
"$build" kwindowsystem
"$build" kcoreaddons
"$build" knotifications
# Create and upload dependencies zip file.
7z a "$APP-dependencies.zip" -r "$INSTALL_PREFIX"
appveyor PushArtifact "$APP-dependencies.zip" -DeploymentName "CopyQ Dependencies"
cmake -B"$BUILD_PATH" -DCMAKE_BUILD_TYPE=Release \
-G "$CMAKE_GENERATOR" -A "$CMAKE_GENERATOR_ARCH" \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-DCMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION=. \
-DWITH_TESTS=ON
@echo on
cmake --build build/ --config Release || goto :error
:error
exit /b %errorlevel%
#!/usr/bin/bash
set -exo pipefail
cmake --build build/ --config Release
#!/usr/bin/bash
set -exu
export PATH=$QTDIR/bin:$PATH
export KF5_FULLVER=$KF5_VERSION.$KF5_PATCH
export INSTALL_PREFIX=$APPVEYOR_BUILD_FOLDER/usr/kf-$KF5_FULLVER-$CMAKE_GENERATOR_ARCH
export DEPENDENCY_PATH=$APPVEYOR_BUILD_FOLDER/dependencies
export DOWNLOADS_PATH=$APPVEYOR_BUILD_FOLDER/downloads
export DEPENDENCY_BUILD_PATH=$DEPENDENCY_PATH/build
export BUILD_PATH=$APPVEYOR_BUILD_FOLDER/build
export CMAKE_PREFIX=$INSTALL_PREFIX/lib/cmake
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX:$INSTALL_PREFIX/share/ECM/cmake":$QTDIR/lib/cmake
export SNORETOAST_BASE_URL=https://invent.kde.org/libraries/snoretoast/-/archive/v$SNORETOAST_VERSION
export KF5_BASE_URL=https://download.kde.org/stable/frameworks/$KF5_VERSION
APP_VERSION=$(git describe --tags --always HEAD)
export APP_VERSION
export APP=copyq-$APP_VERSION
mkdir -p "$INSTALL_PREFIX"
mkdir -p "$DEPENDENCY_PATH"
mkdir -p "$DOWNLOADS_PATH"
@echo on
set PATH=%QTDIR%\bin;%PATH%
set CMAKE_PREFIX_PATH=%QTDIR%\lib\cmake
dir %QTDIR%\bin || goto :error
dir %QTDIR%\lib\cmake || goto :error
dir "%OPENSSL_PATH%" || goto :error
dir "%OPENSSL_PATH%\%LIBCRYPTO%" || goto :error
dir "%OPENSSL_PATH%\%LIBSSL%" || goto :error
REM Note: Following removes sh.exe from PATH so that CMake can generate MinGW Makefile.
if DEFINED MINGW_PATH set PATH=%MINGW_PATH%\bin;%PATH:C:\Program Files\Git\usr\bin;=%
:error
exit /b %errorlevel%
#!/usr/bin/bash
set -exo pipefail
# shellcheck disable=SC1091
source utils/appveyor/env.sh
ls "$QTDIR/bin"
ls "$QTDIR/lib/cmake"
ls "$OPENSSL_PATH"
ls "$OPENSSL_PATH/$LIBCRYPTO"
ls "$OPENSSL_PATH/$LIBSSL"
"$QTDIR/bin/qmake" --version
@echo on
curl -LO https://download.kde.org/stable/frameworks/%KF5_VERSION%/%1-%KF5_FULLVER%.zip || goto :error
cmake -E tar xf %1-%KF5_FULLVER%.zip --format=zip
cd %1-%KF5_FULLVER% || goto :error
for %%p in (%APPVEYOR_BUILD_FOLDER%\utils\appveyor\patches\%1\*.patch) do call :apply_patch %%p || goto :error
cmake -H. -B../build/%1 -DCMAKE_BUILD_TYPE=Release^
-G "%CMAKE_GENERATOR%" -A "%CMAKE_GENERATOR_ARCH%"^
-DKCONFIG_USE_GUI=OFF^
-DCMAKE_PREFIX_PATH="%CMAKE_PREFIX_PATH%"^
-DCMAKE_INSTALL_PREFIX="%INSTALL_PREFIX%" || goto :error
cmake --build ../build/%1 --config Release --target install || goto :error
cd ..
goto:eof
:error
exit /b %errorlevel%
:apply_patch
C:\msys64\usr\bin\patch -p1 < %~1 || goto :error
goto:eof
#!/usr/bin/bash
set -exo pipefail
name=$1
version=${2:-$KF5_FULLVER}
base_url=${3:-$KF5_BASE_URL}
if [[ $# -gt 3 ]]; then
shift 3
extra_cmake_args=("$@")
else
extra_cmake_args=()
fi
pkg=$DOWNLOADS_PATH/$name-$version.zip
url=$base_url/$name-$version.zip
patch_dir=$APPVEYOR_BUILD_FOLDER/utils/appveyor/patches/$name
state_old=$INSTALL_PREFIX/$name-state
state_new=$DEPENDENCY_PATH/$name-state-new
shopt -s nullglob
function get_new_state() {
echo "URL=$url"
echo "CMAKE_GENERATOR=$CMAKE_GENERATOR"
echo "CMAKE_GENERATOR_ARCH=$CMAKE_GENERATOR_ARCH"
echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH"
echo "EXTRA_CMAKE_ARGS=${extra_cmake_args[*]}"
echo | md5sum "$patch_dir"/*.patch
}
# Omit rebuilding if already cached.
get_new_state > "$state_new"
if diff "$state_old" "$state_new"; then
exit
fi
(
cd "$DEPENDENCY_PATH"
# Retry downloading package.
for retry in $(seq 5); do
if cmake -E tar xf "$pkg" --format=zip; then
break
fi
rm -f "$pkg"
if [[ $retry -gt 0 ]]; then
sleep $((retry * 15))
fi
curl -L -o "$pkg" "$url"
done
cd "$name-$version"
for patch in "$patch_dir"/*.patch; do
patch -p1 < "$patch"
done
cmake -B"$DEPENDENCY_BUILD_PATH/$name" -DCMAKE_BUILD_TYPE=Release \
-G "$CMAKE_GENERATOR" -A "$CMAKE_GENERATOR_ARCH" \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
"${extra_cmake_args[@]}"
cmake --build "$DEPENDENCY_BUILD_PATH/$name" --config Release --target install
)
mv "$state_new" "$state_old"
@echo on
set bin=snoretoast-v%SNORETOAST_VERSION%
curl -LO https://invent.kde.org/libraries/snoretoast/-/archive/v%SNORETOAST_VERSION%/%bin%.zip || goto :error
cmake -E tar xf %bin%.zip --format=zip || goto :error
cd %bin% || goto :error
cmake -H. -B../build/%bin% -DCMAKE_BUILD_TYPE=Release^
-G "%CMAKE_GENERATOR%" -A "%CMAKE_GENERATOR_ARCH%"^
-DCMAKE_PREFIX_PATH="%CMAKE_PREFIX_PATH%"^
-DCMAKE_INSTALL_PREFIX="%INSTALL_PREFIX%" || goto :error
cmake --build ../build/%bin% --config Release --target install || goto :error
cd ..
goto:eof
:error
exit /b %errorlevel%
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment