Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create and deploy a Nuget package #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions CrashRpt2.autopkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
configurations {
Toolset {
key : "PlatformToolset";
choices: { v120, v140, v141 };
};

Platform {
key : "Platform";
choices: { Win32, x64 };
};
}

nuget {
nuspec {
id = CrashRpt2.CPP;
version : appveyor_build_version; // replaced by appveyor deploy script
title: CrashRpt2.CPP;
authors: {Oleg Krivtsov, QbProg};
requireLicenseAcceptance:false;
summary: @"CrashRpt is a free open-source library designed for intercepting exceptions in your C++ program";
description: @"This package corresponds to the github repo with fixes and new features collected from various places. It is not bound to any third-party online service and can be freely configured, including the email address to receive crash reports.";
projectUrl: "https://github.com/QbProg/crashrpt2";
licenseUrl: "https://github.com/QbProg/crashrpt2/blob/master/License.txt";
iconUrl: "http://crashrpt.sourceforge.net/images/logo.png";
releaseNotes: @"Nuget package may be incomplete, e.g. does not contain language files yet";
copyright: Copyright 2019;
tags: { CrashRpt2, CrashRpt };
};

files {

#defines {
CRASHRPT_VER = 1500;
};

include: {
include/CrashRpt.h
};

("Win32,x64", "v120,v140,v141") => {
[${0},${1}] {
lib: { ${0}\${1}\lib\CrashRpt${CRASHRPT_VER}.lib };
symbols: {${0}\${1}\bin\CrashRpt${CRASHRPT_VER}.pdb};
bin: { ${0}\${1}\bin\CrashRpt${CRASHRPT_VER}.dll,
${0}\${1}\bin\CrashSender${CRASHRPT_VER}.exe,
${0}\${1}\bin\crashrpt_lang.ini
};
}
}
};

targets {
Defines += "_LATER";
}

}
82 changes: 54 additions & 28 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '{build}'
version: '1.5.{build}'

branches:
only:
Expand All @@ -7,46 +7,72 @@ branches:

clone_folder: c:\projects\crashrpt2
image:
- Visual Studio 2017
- Visual Studio 2015
- Visual Studio 2013
- Visual Studio 2015
- Visual Studio 2017
configuration:
- RelWithDebInfo
platform:
- x64
- Win32
environment:
matrix:
- arch: Win32
- arch: Win64

matrix:
exclude:
- platform: x64
arch: Win32
- platform: Win32
arch: Win64
fast_finish: false

init:
- echo %APPVEYOR_BUILD_WORKER_IMAGE%
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( set vs=Visual Studio 15 2017)
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" ( set vs=Visual Studio 14 2015)
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" ( set vs=Visual Studio 12 2013)
- if "%arch%"=="Win64" ( set generator="%vs% Win64" )
- if "%arch%"=="Win32" ( set generator="%vs%" )
- echo %arch%
- echo %generator%

- ps: |
$ms = @{ "2013"=("12","v120"); "2015"=("14","v140"); "2017"=("15","v141") }
$key = $env:APPVEYOR_BUILD_WORKER_IMAGE -replace "Visual Studio "
$env:generator = "Visual Studio $($ms[$key][0]) $key"
if ($env:PLATFORM -Match "64") { $env:generator += " Win64" }
$env:outputpath = "$env:PLATFORM/$($($ms[$key][1]))"
echo $key $env:generator $env:outputpath
$env:api = "https://ci.appveyor.com/api"
$env:apiproj = "$env:api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG"
# deploy only for last job of the build
if (((Irm $env:apiproj).build.jobs | Select-Object -Last 1).jobId -eq $env:APPVEYOR_JOB_ID) { $env:dodeploy = "true" }
before_build:
- cmd: |-
mkdir build
cd build
cmake --version
cmake .. -G %generator%
- ps: cd (mkdir build\$env:outputpath)
- 'cmake --version'
- 'cmake ..\..\.. -G "%generator%"'
build:
project: c:\projects\crashrpt2\build\CrashRpt.sln
project: $(APPVEYOR_BUILD_FOLDER)\build\$(outputpath)\CrashRpt.sln
verbosity: minimal
parallel: true
after_build:
- 'cd %APPVEYOR_BUILD_FOLDER%\build'
- '7z a package.zip %outputpath%\lib\CrashRpt*.lib %outputpath%\bin\CrashRpt*.pdb %outputpath%\bin\CrashRpt*.dll %outputpath%\bin\CrashSender*.exe %outputpath%\bin\crashrpt_lang.ini'
test_script:
- c:\projects\crashrpt2\build\bin\Tests.exe /all
- '%APPVEYOR_BUILD_FOLDER%\build\%outputpath%\bin\Tests.exe /all'
artifacts:
- path: 'build/package.zip'
before_deploy:
- ps: |
cd $env:APPVEYOR_BUILD_FOLDER
# TODO: wait for other jobs to finish, needed only on parallel build:
# while ((Irm $env:apiproj).build.jobs | Where-Object {$_.jobId -ne $env:APPVEYOR_JOB_ID -and $_.status -ne "success"}) { Start-sleep 15 }
# download all artifacts and extract, including this job's one
foreach ($job in (Irm $env:apiproj).build.jobs) {
Start-FileDownload "$env:api/buildjobs/$($job.jobId)/artifacts/build/package.zip"
7z x package.zip
}
# Download the CoApp tools.
$msiPath = "$($env:USERPROFILE)\CoApp.Tools.Powershell.msi"
(New-Object Net.WebClient).DownloadFile('http://coapp.org/files/CoApp.Tools.Powershell.msi', $msiPath)
# Install the CoApp tools from the downloaded .msi.
Start-Process -FilePath msiexec -ArgumentList /i, $msiPath, /quiet -Wait
# Make the tools available for later PS scripts to use.
$env:PSModulePath = $env:PSModulePath + ';C:\Program Files (x86)\Outercurve Foundation\Modules'
Import-Module CoApp
# Write version to autopkg
$autopkg = "CrashRpt2.autopkg"
(Gc $autopkg).replace('appveyor_build_version', $env:APPVEYOR_BUILD_VERSION) | Sc $autopkg
# Write Nuget and create artifact
Write-NuGetPackage $autopkg
Get-ChildItem .\*.nupkg | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
deploy:
- provider: NuGet
on:
dodeploy: true
api_key:
secure: 1mWOwXfu1vQrBoct+pfNXDybBT9jwrTEzPqHlITiAoTljQPedQ/njJeB6hbShXB3