Skip to content

Commit

Permalink
Add AppVeyor config
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslo committed Aug 12, 2015
1 parent 99c11a3 commit 81f7c41
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 13 deletions.
24 changes: 14 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,25 @@ install(TARGETS foo DESTINATION lib)
install(TARGETS boo DESTINATION bin)

string(COMPARE NOTEQUAL "$ENV{TRAVIS_TAG}" "" travis_deploy)
string(COMPARE EQUAL "$ENV{APPVEYOR_REPO_TAG}" "true" appveyor_deploy)

if(travis_deploy)
string(REGEX REPLACE "^v([0-9]+)\\.[0-9]+\\.[0-9]+$" "\\1" major_ver "$ENV{TRAVIS_TAG}")
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+)\\.[0-9]+$" "\\1" minor_ver "$ENV{TRAVIS_TAG}")
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+)$" "\\1" patch_ver "$ENV{TRAVIS_TAG}")
set(version "$ENV{TRAVIS_TAG}")
elseif(appveyor_deploy)
set(version "$ENV{APPVEYOR_REPO_TAG_NAME}")
else()
set(major_ver 0)
set(minor_ver 0)
set(patch_ver 0)
set(version "v0.0.0")
endif()

set(CPACK_PACKAGE_VERSION_MAJOR ${major_ver})
set(CPACK_PACKAGE_VERSION_MINOR ${minor_ver})
set(CPACK_PACKAGE_VERSION_PATCH ${patch_ver})
string(REGEX REPLACE "^v([0-9]+)\\.[0-9]+\\.[0-9]+$" "\\1" x "${version}")
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+)\\.[0-9]+$" "\\1" y "${version}")
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+)$" "\\1" z "${version}")

if(travis_deploy)
set(CPACK_PACKAGE_VERSION_MAJOR ${x})
set(CPACK_PACKAGE_VERSION_MINOR ${y})
set(CPACK_PACKAGE_VERSION_PATCH ${z})

if(travis_deploy OR appveyor_deploy)
string(COMPARE EQUAL "$ENV{CONFIG}" "Debug" debug_build)
if(debug_build)
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}-$ENV{TOOLCHAIN}-Debug")
Expand Down
39 changes: 36 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
### Uploading release binaries
# Uploading release binaries

[![Build Status](https://travis-ci.org/forexample/github-binary-release.svg)](https://travis-ci.org/forexample/github-binary-release/builds)

## Travis

#### Create token

Create GitHub token with name like "Token for Travis CI deployment" and select `public_repo` (or `repo`). Keep in mind that this token is a **private sensitive** data! See:
Expand Down Expand Up @@ -31,7 +33,7 @@ before_deploy:
deploy:
provider: releases
api_key:
- secure: "encrypted GITHUB OAUTH TOKEN"
- secure: "Encrypted GITHUB OAUTH TOKEN"
file_glob: true
file: "${FILE_TO_UPLOAD}"
skip_cleanup: true
Expand All @@ -52,9 +54,40 @@ os:
- osx
```

#### Deploy (Linux + OS X)
## AppVeyor

Create GitHub token with name like "Token for AppVeyor CI deployment" and select `public_repo` (or `repo`). Keep in mind that this token is a **private sensitive** data! See:
* [Creating an access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use)

#### Encrypt token

Encrypt your token using form on [appveyor.com](https://ci.appveyor.com/tools/encrypt).

#### Add token

Copy `secure: "..."` string to `appveyor.yml`:

```
artifacts:
- path: _builds\*\Foo-*.tar.gz
name: Releases
deploy:
provider: GitHub
auth_token:
secure: "Encrypted GITHUB OAUTH TOKEN"
artifact: /Foo-.*\.tar.gz/
draft: false
prerelease: false
on:
appveyor_repo_tag: true
```

## Deploy

```bash
> git tag vA.B.C
> git push --tags
```

Travis will deploy artifacts from Linux and OS X, AppVeyor will deploy artifacts from Windows.
56 changes: 56 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
environment:
matrix:
- TOOLCHAIN: "vs-12-2013"
CONFIG: Release

- TOOLCHAIN: "vs-12-2013"
CONFIG: Debug

- TOOLCHAIN: "vs-12-2013-win64"
CONFIG: Release

- TOOLCHAIN: "vs-12-2013-win64"
CONFIG: Debug

- TOOLCHAIN: "vs-11-2012"
CONFIG: Release

- TOOLCHAIN: "vs-11-2012"
CONFIG: Debug

- TOOLCHAIN: "vs-10-2010"
CONFIG: Release

- TOOLCHAIN: "vs-10-2010"
CONFIG: Debug

- TOOLCHAIN: "vs-9-2008"
CONFIG: Release

- TOOLCHAIN: "vs-9-2008"
CONFIG: Debug

install:
- cmd: set POLLY_VERSION="0.7.5"
- cmd: appveyor DownloadFile "https://github.com/ruslo/polly/archive/v%POLLY_VERSION%.tar.gz"
- cmd: cmake -E tar xf "v%POLLY_VERSION%.tar.gz"
- cmd: set PATH=%cd%\polly-%POLLY_VERSION%\bin;%PATH%
- cmd: cmake --version
- cmd: python --version

build_script:
- cmd: build.py --verbose --pack TGZ --config "%CONFIG%" --toolchain "%TOOLCHAIN%"

artifacts:
- path: _builds\*\Foo-*.tar.gz
name: Releases

deploy:
provider: GitHub
auth_token:
secure: "MlYtJPvxZuQlKMolBQxysZef5AiZapj8gOI8dPpEzkMxeQlQmL6/j/myMT6Zpkne"
artifact: /Foo-.*\.tar.gz/
draft: false
prerelease: false
on:
appveyor_repo_tag: true

0 comments on commit 81f7c41

Please sign in to comment.