Merge pull request #72 from YACReader/azure-pipelines

Set up CI with Azure Pipelines
This commit is contained in:
Luis Ángel San Martín 2019-08-24 11:58:22 +02:00 committed by GitHub
commit 8bb43a7cf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 376 additions and 21 deletions

2
.gitignore vendored
View File

@ -65,3 +65,5 @@ CMakeLists.txt.user*
YACReaderLibrary/YACReaderLibrary\.xcodeproj/
.DS_Store
compressed_archive/libp7zip
c_x86_64.pch

View File

@ -1 +1,2 @@
DisableFormat: true
DisableFormat: true
SortIncludes: false

View File

@ -1,3 +1,3 @@
TEMPLATE = subdirs
SUBDIRS = YACReader YACReaderLibrary
YACReaderLibrary.depends = YACReader
SUBDIRS = YACReader YACReaderLibrary YACReaderLibraryServer
YACReaderLibrary.depends = YACReader

View File

@ -7,7 +7,6 @@ DEPENDPATH += . \
release
DEFINES += NOMINMAX YACREADER
QMAKE_MAC_SDK = macosx10.12
#load default build flags
include (../config.pri)

View File

@ -13,7 +13,6 @@ INCLUDEPATH += . \
./comic_vine/model
DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY
QMAKE_MAC_SDK = macosx10.12
# load default build flags
include (../config.pri)

View File

@ -1 +1,2 @@
DisableFormat: true
DisableFormat: true
SortIncludes: false

View File

@ -11,7 +11,6 @@ INCLUDEPATH += ../YACReaderLibrary \
../YACReaderLibrary/db
DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY QT_NO_DEBUG_OUTPUT
QMAKE_MAC_SDK = macosx10.12
# load default build flags
# do a basic dependency check
include(headless_config.pri)

View File

@ -83,7 +83,14 @@ int main(int argc, char **argv)
app.setApplicationName("YACReaderLibrary");
app.setOrganizationName("YACReader");
app.setApplicationVersion(VERSION);
QString buildNumber = ".0";
#ifdef BUILD_NUMBER
buildNumber = QString(".%1").arg(BUILD_NUMBER);
#endif
app.setApplicationVersion(VERSION + buildNumber);
QTextStream qout(stdout);

View File

@ -0,0 +1,12 @@
steps:
- task: PowerShell@2
inputs:
targetType: inline
script: |
$date = (Get-Date).ToString("yyMMdd")
$previousBuildNumber = $($env:BUILD_BUILDNUMBER)
$buildNumberParts = $($env:BUILD_BUILDNUMBER) -split '\.'
$revision = [int]$buildNumberParts[$buildNumberParts.Length-1]
$newBuildNumber = "$date$revision"
Write-Host "##vso[build.updatebuildnumber]$newBuildNumber"

97
azure-pipelines.yml Normal file
View File

@ -0,0 +1,97 @@
# aka.ms/yaml
# TODO: reuse steps
trigger:
- master
- develop
jobs:
- job: Linux
pool:
vmImage: 'ubuntu-16.04'
steps:
- template: azure-pipelines-build-number.yml
- script: |
sudo add-apt-repository 'deb http://download.opensuse.org/repositories/home:/selmf/xUbuntu_16.04/ /'
sudo add-apt-repository ppa:kubuntu-ppa/backports
sudo apt-get update
sudo apt-get install -y --allow-unauthenticated qt-default qt5-qmake \
qtbase5-dev qtmultimedia5-dev libpoppler-qt5-dev qtscript5-dev \
libqt5opengl5-dev libglu1-mesa-dev libunarr-dev qtdeclarative5-dev
displayName: 'Install dependencies'
- script: |
export DEFINES_VAR=DEFINES+\=\"BUILD_NUMBER=\\\\\\\"$(Build.BuildNumber)\\\\\\\"\"
qmake CONFIG+="unarr" $DEFINES_VAR
make
displayName: 'Build'
- job: MacOS
pool:
vmImage: 'macOS-10.14'
steps:
- template: azure-pipelines-build-number.yml
- script: |
brew install qt
brew link qt --force
brew install create-dmg
brew install clang-format
wget "https://sourceforge.net/projects/p7zip/files/p7zip/16.02/p7zip_16.02_src_all.tar.bz2" -P $(Build.SourcesDirectory)/compressed_archive
tar xjf $(Build.SourcesDirectory)/compressed_archive/p7zip_16.02_src_all.tar.bz2 -C $(Build.SourcesDirectory)/compressed_archive
mv $(Build.SourcesDirectory)/compressed_archive/p7zip_16.02 $(Build.SourcesDirectory)/compressed_archive/libp7zip
displayName: 'Install dependencies'
- script: |
cd $(Build.SourcesDirectory)
find . \( -name '*.h' -or -name '*.cpp' -or -name '*.c' -or -name '*.mm' -or -name '*.m' \) -print0 | xargs -0 clang-format -style=file -i
if [ "$(git diff $(Build.SourceVersion))" != "" ]; then exit 1; fi
displayName: 'Check format'
- script: |
cd $(Build.SourcesDirectory)
VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' )"
./compileOSX.sh $VERSION $(Build.BuildNumber)
displayName: 'Build'
- task: CopyFiles@2
inputs:
contents: '*.dmg'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@1
inputs:
path: $(Build.ArtifactStagingDirectory)
artifactName: Macos $(Build.BuildNumber) dmg
- job: Windows
pool:
vmImage: 'vs2017-win2016'
steps:
- template: azure-pipelines-build-number.yml
- script: |
pip install aqtinstall
mkdir C:\Qt
python -m aqt install -O c:\Qt 5.12.4 windows desktop win64_msvc2017_64
choco install -y wget
choco install innosetup
wget "https://sourceforge.net/projects/sevenzip/files/7-Zip/18.05/7z1805-src.7z" -P $(Build.SourcesDirectory)\compressed_archive
7z x $(Build.SourcesDirectory)\compressed_archive\7z1805-src.7z -o$(Build.SourcesDirectory)\compressed_archive\lib7zip
wget "https://go.microsoft.com/fwlink/?LinkId=746572" -O $(Build.SourcesDirectory)\vc_redist.x64.exe
# 32bit https://go.microsoft.com/fwlink/?LinkId=746571
displayName: 'Install dependencies'
- script: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
set PATH=%PATH%;C:\Qt\Qt5.12.4\5.12.4\msvc2017_64\bin
set DEFINES_VAR=DEFINES+="BUILD_NUMBER=\\\\\\\"$(Build.BuildNumber)\\\\\\\""
qmake CONFIG+="7zip" %DEFINES_VAR%
nmake
displayName: 'Build'
- script: |
set PATH=%PATH%;C:\Qt\Qt5.12.4\5.12.4\msvc2017_64\bin
cd $(Build.SourcesDirectory)\ci\win
.\create_installer.cmd x64 7z $(Build.BuildNumber)
displayName: 'Create installer'
- task: CopyFiles@2
inputs:
sourceFolder: $(Build.SourcesDirectory)\ci\win\Output\
contents: '*'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@1
inputs:
path: $(Build.ArtifactStagingDirectory)
artifactName: Windows 64 $(Build.BuildNumber) 7z Installer

165
ci/win/build_installer.iss Normal file
View File

@ -0,0 +1,165 @@
[Setup]
DefaultGroupName=YACReader
LanguageDetectionMethod=locale
AppName=YACReader
AppVerName=YACReader v{#VERSION}.{#BUILD_NUMBER}
DefaultDirName={pf}\YACReader
OutputBaseFilename=YACReader-v{#VERSION}.{#BUILD_NUMBER}-win{#PLATFORM}-{#COMPRESSED_ARCHIVE_BACKEND}
LicenseFile=COPYING.txt
AlwaysUsePersonalGroup=true
OutputDir=..\Output
ChangesAssociations=true
SetupIconFile=setup.ico
UninstallDisplayIcon=uninstall.ico
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x64
[Registry]
Root: HKCR; SubKey: .cbz; ValueType: string; ValueData: Comic Book (zip); Flags: uninsdeletekey; Tasks: File_association
Root: HKCR; SubKey: Comic Book (zip); ValueType: string; ValueData: Comic Book file; Flags: uninsdeletekey; Tasks: File_association
Root: HKCR; SubKey: Comic Book (zip)\Shell\Open\Command; ValueType: string; ValueData: """{app}\YACReader.exe"" ""%1"""; Flags: uninsdeletevalue; Tasks: File_association
Root: HKCR; Subkey: Comic Book (zip)\DefaultIcon; ValueType: string; ValueData: {app}\YACReader.exe,0; Flags: uninsdeletevalue; Tasks: File_association
Root: HKCR; SubKey: .cbr; ValueType: string; ValueData: Comic Book (rar); Flags: uninsdeletekey; Tasks: File_association
Root: HKCR; SubKey: Comic Book (rar); ValueType: string; ValueData: Comic Book file; Flags: uninsdeletekey; Tasks: File_association
Root: HKCR; SubKey: Comic Book (rar)\Shell\Open\Command; ValueType: string; ValueData: """{app}\YACReader.exe"" ""%1"""; Flags: uninsdeletevalue; Tasks: File_association
Root: HKCR; Subkey: Comic Book (rar)\DefaultIcon; ValueType: string; ValueData: {app}\YACReader.exe,0; Flags: uninsdeletevalue; Tasks: File_association
Root: HKCR; Subkey: .clc; ValueType: string; ValueData: Compressed Library Covers (clc); Flags: uninsdeletekey
Root: HKCR; SubKey: Compressed Library Covers (clc); ValueType: string; ValueData: Compressed Library Covers; Flags: uninsdeletekey
Root: HKCR; Subkey: Compressed Library Covers (clc)\DefaultIcon; ValueType: string; ValueData: {app}\YACReaderLibrary.exe,1; Flags: uninsdeletevalue
Root: HKCR; Subkey: .ydb; ValueType: string; ValueData: Compressed Library Covers (clc); Flags: uninsdeletekey
Root: HKCR; SubKey: YACReader Data Base (ydb); ValueType: string; ValueData: Compressed Library Covers; Flags: uninsdeletekey
Root: HKCR; Subkey: YACReader Data Base (ydb)\DefaultIcon; ValueType: string; ValueData: {app}\YACReaderLibrary.exe,1; Flags: uninsdeletevalue
[Files]
;Qt Frameworks
Source: Qt5Core.dll; DestDir: {app}
Source: Qt5Gui.dll; DestDir: {app}
Source: Qt5Multimedia.dll; DestDir: {app}
Source: Qt5Network.dll; DestDir: {app}
Source: Qt5Qml.dll; DestDir: {app}
Source: Qt5Quick.dll; DestDir: {app}
Source: Qt5Script.dll; DestDir: {app}
Source: Qt5Sql.dll; DestDir: {app}
Source: Qt5Svg.dll; DestDir: {app}
Source: Qt5Widgets.dll; DestDir: {app}
Source: Qt5QuickWidgets.dll; DestDir: {app}
;Qt Angle
Source: D3Dcompiler_47.dll; DestDir: {app}
Source: libEGL.dll; DestDir: {app}
Source: libGLESV2.dll; DestDir: {app}
Source: opengl32sw.dll; DestDir: {app}
;Qt QML
Source: QtQml\*; DestDir: {app}\QtQml\; Flags: recursesubdirs
Source: QtQuick\*; DestDir: {app}\QtQuick\; Flags: recursesubdirs
Source: QtQuick.2\*; DestDir: {app}\QtQuick.2\; Flags: recursesubdirs
Source: QtGraphicalEffects\*; DestDir: {app}\QtGraphicalEffects\; Flags: recursesubdirs
;Qt PlugIns
Source:audio\*; DestDir: {app}\audio\
Source:bearer\*; DestDir: {app}\bearer\
Source:iconengines\*; DestDir: {app}\iconengines\
Source:imageformats\*; DestDir: {app}\imageformats\
Source:mediaservice\*; DestDir: {app}\mediaservice\
Source:platforms\*; DestDir: {app}\platforms\
Source:playlistformats\*; DestDir: {app}\playlistformats\
Source:qmltooling\*; DestDir: {app}\qmltooling\
Source:scenegraph\*; DestDir: {app}\scenegraph\
Source:sqldrivers\qsqlite.dll; DestDir: {app}\sqldrivers\
Source:translations\*; DestDir: {app}\translations\
Source:styles\*; DestDir: {app}\styles\
;Libs
Source: pdfium.dll; DestDir: {app}
Source: qrencode.dll; DestDir: {app}
Source: libeay32.dll; DestDir: {app}
Source: ssleay32.dll; DestDir: {app}
;vcredist
Source: "vc_redist.{#PLATFORM}.exe"; DestDir: {tmp}; Flags: deleteafterinstall
;Utils
;Source: utils\7zip.exe; DestDir: {app}\utils\
Source: utils\7z.dll; DestDir: {app}\utils\
;Bin
Source: YACReader.exe; DestDir: {app}; Permissions: everyone-full
Source: YACReaderLibrary.exe; DestDir: {app}; Permissions: everyone-full; Tasks:
Source: YACReaderLibraryServer.exe; DestDir: {app}; Permissions: everyone-full; Tasks:
;License
Source: README.md; DestDir: {app}; Flags: isreadme
Source: COPYING.txt; DestDir: {app}
;Languages
Source: languages\*; DestDir: {app}\languages\; Flags: recursesubdirs
;Server
Source: server\*; DestDir: {app}\server\; Flags: recursesubdirs
[Dirs]
Name: {app}; Permissions: everyone-full
[CustomMessages]
App=YACReader
AppLibrary=YACReaderLibrary
LaunchYACReaderLibrary=Start YACreaderLibrary after finishing installation
LaunchYACReader=Start YACreader after finishing installation
[Run]
Filename: {tmp}\vc_redist.{#PLATFORM}.exe; \
Parameters: "/q /passive /norestart /Q:a /c:""msiexec /q /i vcredist.msi"""; \
StatusMsg: "Installing VC++ Redistributables..."
Filename: {app}\{cm:AppLibrary}.exe; Description: {cm:LaunchYACReaderLibrary,{cm:AppLibrary}}; Flags: nowait postinstall skipifsilent
Filename: {app}\{cm:App}.exe; Description: {cm:LaunchYACReader,{cm:App}}; Flags: nowait postinstall skipifsilent
[Icons]
Name: {group}\YACReader; Filename: {app}\YACReader.exe; WorkingDir: {app}; IconIndex: 0
Name: {group}\YACReader Library; Filename: {app}\YACReaderLibrary.exe; WorkingDir: {app}; IconIndex: 0
;Name: {group}\YACReader Library Package; Filename: {app}\YACReaderLibrary.exe; WorkingDir: {app}; IconIndex: 0
[Tasks]
Name: File_association; Description: Associate .cbz and .cbr files with YACReader
;Name: StartYACReaderAfterInstall; Description: Run YACReader after install
;Name: StartYACReaderLibraryAfterInstall; Description: Run YACReaderLibrary after install
[ThirdPartySettings]
CompileLogMethod=append
[Code]
var donationPage: TOutputMsgWizardPage;
var URLLabel: TNewStaticText;
procedure URLLabelOnClick(Sender: TObject);
var ErrorCode: Integer;
begin
ShellExec('open', 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5TAMNQCDDMVP8&item_name=YACReader&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
procedure InitializeWizard();
begin
URLLabel := TNewStaticText.Create(WizardForm);
URLLabel.Caption:='Make a DONATION/Haz una DONACIÓN';
URLLabel.Cursor:=crHand;
URLLabel.OnClick:=@URLLabelOnClick;
URLLabel.Parent:=WizardForm;
// Alter Font
URLLabel.Font.Style:=URLLabel.Font.Style + [fsUnderline];
URLLabel.Font.Color:=clBlue;
URLLabel.Top:=250;
URLLabel.Left:=35;
donationPage := CreateOutputMsgPage(wpWelcome,
'Iformation', 'Please read the following information before continuing.',
'YACReader is FREE software. If you like it, please, consider to make a DONATION'#13#13 +
'YACReader es software libre y GRATUITO. Si te gusta, por favor, considera realizar una DONACIÓN'#13#13)
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID=donationPage.ID then URLLabel.Visible:=true else URLLabel.Visible:=false;
end;

View File

@ -0,0 +1,61 @@
@echo off
SET src_path=..\..\..
IF "%1"=="x64" (
SET exe_path=%src_path%\release64
) ELSE (
SET exe_path=%src_path%\release
)
rmdir /S /Q installer_contents
mkdir installer_contents
copy * installer_contents
cd installer_contents
copy %src_path%\COPYING.txt .
copy %src_path%\README.md .
copy %exe_path%\YACReader.exe .
copy %exe_path%\YACReaderLibrary.exe .
copy %exe_path%\YACReaderLibraryServer.exe .
windeployqt --release YACReader.exe
windeployqt --release --qmldir %src_path%\YACReaderLibrary\qml YACReaderLibrary.exe
windeployqt YACReaderLibraryServer.exe
mkdir utils
IF "%2"=="7z" (
copy %src_path%\dependencies\7zip\win\%1\7z.dll .\utils\7z.dll
) ELSE (
copy %src_path%\dependencies\unarr\win\%1\unarr.dll .
)
copy %src_path%\dependencies\qrencode\win\%1\qrencode.dll .
copy %src_path%\dependencies\pdfium\win\%1\pdfium.dll .
copy %src_path%\dependencies\openssl\win\%1\libeay32.dll .
copy %src_path%\dependencies\openssl\win\%1\ssleay32.dll .
xcopy %src_path%\release\server .\server /i /e
xcopy %src_path%\release\languages .\languages /i /e
copy %src_path%\vc_redist.%1.exe .
type %src_path%\common\yacreader_global.h | findstr /R /C:"#define VERSION " > tmp
set /p VERSION= < tmp
set VERSION=%VERSION:#define VERSION "=%
set VERSION=%VERSION:"=%
echo %VERSION%
del
if "%1"=="x86" (
type build_installer.iss | findstr /v ArchitecturesInstallIn64BitMode | findstr /v ArchitecturesAllowed > build_installer.iss
)
iscc /DVERSION=%VERSION% /DPLATFORM=%1 /DCOMPRESSED_ARCHIVE_BACKEND=%2 /DBUILD_NUMBER=%3 build_installer.iss || exit /b
cd ..

BIN
ci/win/setup.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

View File

@ -3,7 +3,7 @@
#include <QStandardPaths>
#define VERSION "9.5.0"
#define VERSION "9.6.0"
#define REMOTE_BROWSE_PERFORMANCE_WORKAROUND "REMOTE_BROWSE_PERFORMANCE_WORKAROUND"

View File

@ -1,8 +1,11 @@
#! /bin/bash
set -e
VERSION=${1:-"9.5.0"}
if [ "$2" == "clean" ]; then
BUILD_NUMBER=${2:-"0"}
if [ "$3" == "clean" ]; then
./cleanOSX.sh
fi
@ -10,19 +13,19 @@ hash qmake 2>/dev/null || { echo >&2 "Qmake command not available. Please add th
echo "Compiling YACReader"
cd YACReader
qmake
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\""
make
cd ..
echo "Compiling YACReaderLibrary"
cd YACReaderLibrary
qmake
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\""
make
cd ..
echo "Compiling YACReaderLibraryServer"
cd YACReaderLibraryServer
qmake
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\""
make
cd ..
@ -35,14 +38,14 @@ cp -R YACReaderLibraryServer/YACReaderLibraryServer.app YACReaderLibraryServer.a
./releaseOSX.sh
echo "Copying to destination folder"
dest="YACReader-$VERSION MacOSX-Intel"
dest="YACReader-$VERSION.$BUILD_NUMBER MacOSX-Intel"
mkdir -p "$dest"
cp -R YACReader.app "${dest}/YACReader.app"
cp -R YACReaderLibrary.app "${dest}/YACReaderLibrary.app"
cp -R YACReaderLibraryServer.app "${dest}/YACReaderLibraryServer"
cp COPYING.txt "${dest}/"
cp README.txt "${dest}/"
cp README.md "${dest}/"
#mkdir -p "${dest}/icons/"
#cp images/db.png "${dest}/icons/"
@ -51,6 +54,7 @@ cp README.txt "${dest}/"
echo "Creating dmg package"
#tar -czf "${dest}".tar.gz "${dest}"
#hdiutil create "${dest}".dmg -srcfolder "./${dest}" -ov
./dependencies/create-dmg/create-dmg --volname "YACReader $VERSION Installer" --volicon icon.icns --window-size 600 403 --icon-size 128 --app-drop-link 485 90 --background background.png --icon YACReader 80 90 --icon YACReaderLibrary 235 90 --eula COPYING.txt --icon YACReaderLibraryServer 470 295 --icon README.txt 120 295 --icon COPYING.txt 290 295 "$dest.dmg" "$dest"
create-dmg --volname "YACReader $VERSION.$BUILD_NUMBER Installer" --volicon icon.icns --window-size 600 403 --icon-size 128 --app-drop-link 485 90 --background background.png --icon YACReader 80 90 --icon YACReaderLibrary 235 90 --eula COPYING.txt --icon YACReaderLibraryServer 470 295 --icon README.md 120 295 --icon COPYING.txt 290 295 "$dest.dmg" "$dest"
echo "Done!"

View File

@ -50,7 +50,13 @@ HelpAboutDialog::HelpAboutDialog(const QString &pathAbout, const QString &pathHe
void HelpAboutDialog::loadAboutInformation(const QString &path)
{
aboutText->setHtml(fileToString(path).arg(VERSION));
QString buildNumber = "0";
#ifdef BUILD_NUMBER
buildNumber = BUILD_NUMBER;
#endif
aboutText->setHtml(fileToString(path).arg(VERSION).arg(buildNumber));
aboutText->moveCursor(QTextCursor::Start);
}
@ -72,4 +78,4 @@ QString HelpAboutDialog::fileToString(const QString &path)
f.close();
return content;
}
}

View File

@ -1 +1,2 @@
DisableFormat: true
DisableFormat: true
SortIncludes: false

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -24,7 +24,7 @@
<h1>General Information</h1>
<p>
YACReader - Yet Another Comic Reader - version %1 <br/>
YACReader - Yet Another Comic Reader - version %1.%2 <br/>
by Luis Ángel San Martín Rodríguez
<h2>Contact</h2>
<ul>

View File

@ -24,7 +24,7 @@
<h1>Información general</h1>
<p>
YACReader - Yet Another Comic Reader - versión %1 <br/>
YACReader - Yet Another Comic Reader - versión %1.%2 <br/>
por Luis Ángel San Martín Rodríguez
<h2>Contacto </h2>
<ul>

View File

@ -1,4 +1,5 @@
#!/bin/bash
set -e
hash macdeployqt 2>/dev/null || { echo >&2 "macdeployqt command not available. Please add the bin subfolder of your Qt installation to the PATH environment variable."; exit 1; }