Using AppVeyor CI and Deploy for Windows

Let’s use AppVeyor CI for Windows to automatically build and publish our new commits and releases to biicode.

AppVeyor CI service now integrated with biicode to make it work in Windows.

GitHub or Bitbucket enable creating remote repositories to develop them collaboratively.

First, put your repo into a biicode block, we’re using GitHub in this tutorial, but same basic steps apply for Bitbucket repos. Get your repo’s URL here:

Clone a Github repo as the first step in our AppVeyor CI tutorial

Create a new biicode project, and paste the URL to clone the repository into your block:

Don’t miss the dot at the end, this copies your repo’s files and folders into your block’s main folder.

Automatically build and publish via AppVeyor CI

Login at AppVeyor with your favourite developer account and once logged-in clic on “+ new project”

Open a new AppVeyor CI project

Choose the repo you want to deploy with AppVeyor:

Choose and AppVeyor CI project

Once enabled, let’s get back to our local project and create an appveyor.yml file into your block’s folder. This file is to building and automatically publishing to biicode, after that it will check if your biicode.conf file [parents] have been updated while publishing and committing the changes to github. This is the one I’m using, but you can configure it to fit your needs:

Let’s take a deeper look into this file to adapt it to your build config, changes are only needed in test_script and enviroment values, other changes may depend on what you will use Appveyor for:

  • install: Just copy this part, it installs all tools required to deploy your biicode projects in AppVeyor.
  • before_build: Copy your project’s files into the biicode project and configure it to use Visual Studio 12 via bii cpp: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.
  • build_script: builds the project via bii cpp:build.
  • test_script: cd bin and execute your project. Ensure about your project’s executable, build and execute it locally via  bii cpp:build.
  • deploy_script: This script publishes your block to biicode, as stable including your version tag only when it’s tagged, otherwise your block is published as dev.
  • 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  the environment variables with your own values: project_name, tag, default version tag value…

Specifics:

Create a GitHub Personal Access Token

Here’s an appveyor guide about how to git push from build. Following this Appveyor Guide we’re using it as credentials with Git commands. Use this GitHub guide to create your personal access token.

Configuring build secure variable

Encrypt your biicode password and your access token using Encrypt Data tool and then put it as secure variable into your appveyor.yml, for example, to generate an encrypted password with Appveyor go to your profile and choose Encrypt data:

Encrypt the data of your AppVeyor CI projectOnce there, encrypt your password and copy the value generated to put it in your  environment “secured_password: secure:”

AppVeyor CI encryption config

When it comes to specifying your project settings, it’s useful to check them online. For example, you can skip branches without an appveyor.yml file just saying it your appveyor.yml or into their web interface. Also, AppVeyor docs explain in detail build configuration.

The icing

Put a nice AppVeyor badge to show your project builds in Windows.

Go to your projects settings>Badges, copy your repo’s badge and paste it in your README file:

AppVeyor CI project settings

Update and push to GitHub!

Add, commit and push your changes to GitHub

Working with tags

Using the appveyor.yml file described before, you can tag a version with git, push it to github and it will be automatically tagged in biicode too:

Here’s Git basics about Tagging.

Unless you specify it otherwise, each time you push to AppVeyor CI System, a build launches to check everything is still working.

Check it out

Post’s original marterial is:

Hope you enjoy this new feature and, as always, we look forward to read what you think. Just click on the sidebar button to try biicode, check our docs, forum and/or Stackoverflow tag for questions and answers or comment below to tell us your enquiries.


Related Posts