AppVeyor provides Continuous Integration and Deploy for Windows and it is compatible with both GitHub and Bitbucket.
Place an appveyor.yml
file in your repository and each time you push to your Github repository it will kick-off a new build in Windows, executing your tests and publishing it as a biicode block into your biicode user account.
Login AppVeyor and click on + NEW PROJECT
and choose the repository you want to deploy with. Create an appveyor.yml
file in your local project to automatically publish your block to biicode, including your version tags, here’s an example file:
version: 1.0.{build}
install:
- cmd: cinst cmake -version 3.0.2 -y
- cmd: cmake --version
- cmd: echo "Downloading biicode..."
- ps: wget http://www.biicode.com/downloads/latest/win -OutFile bii-win.exe
- cmd: bii-win.exe /VERYSILENT
- cmd: set PATH=%PATH%;C:\Program Files (x86)\BiiCode\bii
- cmd: bii -v
- cmd: del bii-win.exe
before_build:
- cmd: bii init -L
- cmd: bii cpp:configure -G "Visual Studio 12"
build_script:
- cmd: bii build
test_script:
- cmd: cd bin
- cmd: amalulla_cpp-expression-parser_test-shunting-yard.exe
deploy_script:
- cmd: bii user %block_user% -p %secured_passwd%
- cmd: bii publish -r
environment:
block_user:
"amalulla"
secured_passwd:
secure: ENCRYPTED_BIICODE_PASSWORD_HERE
Encrypt your biicode password and your access token using Encrypt Data tool, copy the values generated and put them it in your environment like secured_password: secure:
.
Use your own test_script
and environment
values to start deploying with it.
Here’s an appveyor guide about how to Git push from Appveyor Build. Following this Appveyor Guide we’re using it as credentials with Git commands. Use this GitHub guide to create your GitHub Personal Access Token. This is a full appveyor.yml file to automatically publish to biicode DEV and STABLE versions:
version: 1.0.{build}
install:
- cmd: cinst cmake -version 3.0.2 -y
- cmd: cmake --version
- cmd: echo "Downloading biicode..."
- ps: wget http://www.biicode.com/downloads/latest/win -OutFile bii-win.exe
- cmd: bii-win.exe /VERYSILENT
- cmd: set PATH=%PATH%;C:\Program Files (x86)\BiiCode\bii
- cmd: bii -v
- cmd: del bii-win.exe
before_build:
- cmd: bii init -L
- cmd: bii cpp:configure -G "Visual Studio 12"
- cmd: bii user %block_user%
build_script:
- cmd: bii build
test_script:
- cmd: cd bin
- cmd: amalulla_cpp-expression-parser_test-shunting-yard.exe
deploy_script:
- cmd: bii user %block_user% -p %secured_passwd%
- if defined APPVEYOR_REPO_TAG_NAME set VERSION=%APPVEYOR_REPO_TAG_NAME%
- if defined APPVEYOR_REPO_TAG_NAME bii publish -r --tag=STABLE --versiontag=%VERSION%
- if not defined APPVEYOR_REPO_TAG_NAME bii publish -r
on_success:
- cmd: cd /%project_name%/blocks/%block_user%/%block_name%
- ps: |
$new_biiconf = get-content biicode.conf
$orig_biiconf = get-content "$env:APPVEYOR_BUILD_FOLDER\biicode.conf"
if (diff $new_biiconf $orig_biiconf){
'different, updating biicode parents'
git checkout "$env:APPVEYOR_REPO_BRANCH"
git config --global core.autocrlf true
git config --global credential.helper store
Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):x-oauth-basic@github.com`n"
git remote add neworigin "$env:github_repo"
git config --global user.email "$env:github_email"
git config --global user.name "$env:github_user"
git add biicode.conf
git commit -m "Updated biicode parents [skip ci]"
git push neworigin "$env:APPVEYOR_REPO_BRANCH"
}Write-Host "Updated biicode parents" else {
'equal, no parents update needed'
}
environment:
project_name:
"myproject"
block_user:
"amalulla"
block_name:
"cpp-expression-parser"
secured_passwd:
secure: ENCRYPTED_BIICODE_PASSWORD_HERE
access_token:
secure: ENCRYPTED_GITHUB_PASSWORD_HERE
github_user:
"MariadeAnton"
github_email:
"maria.deanton@biicode.com"
github_repo:
"git@github.com:MariadeAnton/cpp-expression-parser.git"
What’s going on the appveyor.yml
file?
install:
This part installs all tools required to deploy your biicode projects in AppVeyor.before_build:
Moves your project’s files into the biicode project and configures it to use Visual Studio 12 viabii configure
. Check biicode docs and your project’s settings in Appveyor to use other build configurations. Also note that there’s a commented line here you should also write if your project contains folders.test_script:
cd bin and execute your project. Ensure about your project’s executable, build and execute it locally withbii build
.deploy_script:
This script publishes your block to biicode, including your version tag only when it’s tagged.on_success:
If your biicode.conf file is updated commit its changes to github without launching a new build. Else do nothing.environment:
Replace all environment variables here with your values: project_name, tag, default version tag value... Also your encrypted variables.
You can see this example live:
Learn more about AppVeyor visiting their docs.
install
section: set PATH=%PATH%;C:\MinGW\bin
and bii configure “MinGW Makefiles” at before_build
section.Travis CI takes care of running your tests and deploying your apps. Like we work with VCS, many of the blocks published in our web have their .travis.yml
files, that lets us pushing to our GitHub repository, and automatically build in Linux, execute and publish this project with your biicode user account thanks to this excellent service.
If you’re working with it, the .travis.yml
file format will help to automatically publish to your biicode account with DEV tag:
language: cpp
compiler:
- clang
- gcc
before_install:
- if [ "$CXX" == "g++" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
- if [ "$CXX" == "clang++" ]; then sudo add-apt-repository -y ppa:h-rayflood/llvm; fi
- sudo apt-get update -qq
- if [ "$CXX" == "g++" ]; then sudo apt-get install -qq g++-${GCC_VERSION}; fi
- if [ "$CXX" == "g++" ]; then sudo apt-get install -qq gcc-${GCC_VERSION}; fi
- if [ "$CXX" == "g++" ]; then sudo ln -s -v -f $(which g++-${GCC_VERSION}) /usr/bin/g++; fi
- if [ "$CXX" == "g++" ]; then sudo ln -s -v -f $(which gcc-${GCC_VERSION}) /usr/bin/gcc; fi
install:
- wget http://apt.biicode.com/install.sh && chmod +x install.sh && ./install.sh
- bii --version
- wget https://s3.amazonaws.com/biibinaries/thirdparty/cmake-3.0.2-Linux-64.tar.gz
- tar -xzf cmake-3.0.2-Linux-64.tar.gz
- sudo cp -fR cmake-3.0.2-Linux-64/* /usr
- rm -rf cmake-3.0.2-Linux-64
- rm cmake-3.0.2-Linux-64.tar.gz
script:
- cmake --version
- bii init -L
- if [ "$CXX" == "clang++" ]; then export CXX="clang++" && bii build; fi
- if [ "$CXX" == "g++" ]; then export CXX="g++" && bii build; fi
##################### CHANGE WITH YOUR CUSTOM CHECKS OR TEST EXECUTION ##################
- ./bin/amalulla_unit_test_main
########################################################################################
after_success:
- bii user $USER -p $BII_PASSWORD
- bii publish
env:
global:
- GCC_VERSION="4.9"
- USER=amalulla
- secure: Z1IrvEQFr/poZNXRWAVPXB7eDIUwQWXMgkjMWNTJuXAsjKHTXazd5SaOc88Fd6ajU8ZyJfbX1P25bO0A1G+GS15OVq0i28tuFp1HuHF/YmTKu9Ig5erBW36Huj5ijysKbpPeyQxYIpuFcOsCH3MjghQ1nV0Zo+CdnM0OSB2hgcc=
Here’s a way to automatically publish to your biicode account with DEV tag unless your github repository is tagged, in this case, imports the tag and publishes as STABLE to biicode:
language: cpp
compiler:
- gcc
before_install:
- export TRAVIS_COMMIT_MSG="$(git log --format=%B --no-merges -n 1)"
- if [[ "$TRAVIS_COMMIT_MSG" = "$COMMIT_IGNORE_BUILD" ]]; then exit 0 ; fi
- if [ "$CXX" == "g++" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
- sudo apt-get update -qq
- git config --global user.email "$USER_EMAIL"
- git config --global user.name "$USER_NAME"
- git config --global push.default simple
- git checkout $TRAVIS_BRANCH
install:
- if [ "$CXX" == "g++" ]; then sudo apt-get install -qq g++-4.8; fi
- if [ "$CXX" == "g++" ]; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50; fi
- wget http://www.biicode.com/downloads/latest/ubuntu64
- mv ubuntu64 bii-ubuntu64.deb
- sudo dpkg -i bii-ubuntu64.deb && sudo apt-get -f install
- rm bii-ubuntu64.deb
- wget https://s3.amazonaws.com/biibinaries/thirdparty/cmake-3.0.2-Linux-64.tar.gz
- tar -xzf cmake-3.0.2-Linux-64.tar.gz
- sudo cp -fR cmake-3.0.2-Linux-64/* /usr
- rm -rf cmake-3.0.2-Linux-64
- rm cmake-3.0.2-Linux-64.tar.gz
- export TRAVIS_CXX=$CXX
script:
- cd /tmp
- bii init -L
- shopt -s dotglob && mv $TRAVIS_BUILD_DIR/* ./
- if [ "$CXX" == "clang++" ]; then export CXX="clang++" && bii build; fi
- if [ "$CXX" == "g++" ]; then export CXX="g++" && bii build; fi
- cd /tmp/biicode_project
##################### CHANGE WITH YOUR CUSTOM CHECKS OR TEST EXECUTION ##################
- ls ./bin/lasote_docker_client_example_main
#########################################################################################
after_success:
- bii user $USER -p $BII_PASSWORD
- if [[ -n $TRAVIS_TAG ]]; then bii publish -r --tag STABLE --versiontag $TRAVIS_TAG || echo "Ignored publish output..."; fi
- if [[ -z $TRAVIS_TAG ]]; then bii publish -r || echo "Ignored publish output..."; fi
# If there are changes, commit them
- cd /tmp/biicode_project/blocks/$USER/$BLOCK_NAME
- git config credential.helper "store --file=.git/credentials"
- echo "https://${GH_TOKEN}:@github.com" > .git/credentials
- git add -A .
- git commit -m "$COMMIT_IGNORE_BUILD"
- git remote -v
- git remote set-url origin https://github.com/$TRAVIS_REPO_SLUG.git
- git push
env:
global:
- USER_EMAIL=lasote@gmail.com
- USER_NAME="Luis Martinez de Bartolome"
- COMMIT_IGNORE_BUILD="Promoted version.***travis***"
- BLOCK_NAME=docker_client
- USER=lasote
# BII_PASSWORD: Biicode USER's password. > travis encrypt BII_PASSWORD=XXXXXX --add
- secure: ENCRYPTED_BIICODE_PASSWORD_HERE
# GH_TOKEN: Github token > travis encrypt GH_TOKEN=XXXXXX --add
- secure: NCRYPTED_GITHUB_PASSWORD_HERE
What’s going on the .travis.yml
file?
language and compiler
are totally clear (this is where you choose the language and compiler that Travis CI will use).before_installing
, stablishes our automatic commit must be ignored and configures git to push later, on the after_success part.install
provides the tools necessary to test our code with BIICODE.script
, creates, builds and runs the project and checks if the project successes.after_success
part is to publish your project to biicode as STABLE with VERSION_TAG if tagged in github, otherwise it publishes as DEV. Also, if your biicode.conf file is updated, this commits its changes to github without launching a new build.env:
replace all environment values with your own ones. Don’t delete the *travis* text, as it is the one needed to specify that commit should skip build, avoiding entering an endless build loop.
To learn more about Travis using C++ language, visit its documentation.
Check our biicode's forum and/or StackOverflow tag for questions and answers. You can also write us for suggestions and feedback.