Azure Pipelines for Github allows build of plugin

Yeah you can make it run unit tests easily if you have them. (I have not done that for my tests yet but plan to one day).

I’m just grappling with the fact that plugin.mk hardcodes “zip” as the command to make a zip file. Have a workaround for that and soon should have assets for all 3 being built by my pipeline. I’ll add a section to my GitHub readme also on how it works.

I always use lower snake casing for files (foo-bar.hh) and this works on every platform, always. (Albeit some languages that demand filename to equal module name like freepascal require underscores sadly.)

You can amusingly unittest this as well with a test_filenames.py in the source directory and running nose2 on it:


import unittest
import glob
import re

header_regex = re.compile('([a-z0-9]+-)*([a-z0-9]+).hh')
source_regex = re.compile('([a-z0-9]+-)*([a-z0-9]+).cc')

class TestFilenameConvention(unittest.TestCase):
   def test_headers(self):
      headers = glob.glob('*.hh')
   
      for f in headers:
         self.assertTrue(header_regex.match(f), f)
      
   def test_sources(self):
      sources = glob.glob('*.cc')
   
      for f in sources:
         self.assertTrue(source_regex.match(f), f)

Any filename outside of convention will make the test fail, and it doesn’t even require spooling up the VM.

I’m just saying continuous integration on all platform is useful, even if one is able to build manually on all platforms.

2 Likes

Yup.

Well anyway I got it so the CI builds now make zip files on all 3 platforms. I had to copy a make rule from plugin.mk to my makefile for dist to do it and name it win-dist but it all works. If you go look on the candidate_v0.6.3 branch in my GitHub you can see everything.

Basically if you copy that azure-pipelines.yml to your project, invite the bot after you set up the account, you should be good to go (if you change BACON to SQUINKY or whatever in a few spots). Adding extra stages is pretty obvious.

Hope it helps!

1 Like

Oh and here’s an example of a build from my latest push

https://dev.azure.com/paul0179/BaconPlugs/_build/results?buildId=16

you can see the “ARTIFACTS” in the top right which let you download the zips.

1 Like

I have had success using Travis-CI for this as well. They have experimental support for Windows builds now, and I have more experience with Travis than with the Azure suite so I gave it a try.

Here’s the travis.yml for one of my in-progress plugins. It has a couple things that may be superfluous for a more basic plugin as it has a bunch of dependencies to install and compile first, but removing or changing the apt/brew package lists should be all that’s needed to make it more generic.

2 Likes

I’ve set up Travis and connected it to my repository, with the .travis.yml copied from you and changed some text to match my project. It shows like it’s compiled it for mac and linux, but I have no idea where to download the created zips. Am I missing something? :confused:

The Travis config I have only saves the zips for tagged releases and uploads the zips to Github releases. You’ll need to update the deploy section of the yaml file to fit your needs, Travis has a ton of deploy providers (list here) so you can upload the zips to pretty much whatever accepts file uploads. If you just want to use Github releases like me, you will need to update the file pattern, repo name and api_key value (guide here on the API token management).

So if folks are interested over at https://github.com/surge-synthesizer/surge-rack I extended this technique so

1: it builds 062 and v1
2; it uploads the assets to a github release

This means with every master push of surge rack we get newly built zips in the release all platforms within about 15 minutes.

3 Likes

@baconpaul - could you maybe point me to some tutorial for this Azure artifacts publishing to github release pages, as I want it also to integrate in my work (which is described here - Build VCVRack with Conan and CMake + add CI). I understand what is defined in the azure-pipelines.yml, but I don’t know if there also must be something setup on Azure itself. Otherwise I’ll just try.

Thank you.

Sure. It’s teally easy actually - just look at how I set up the surge-rack azure pipelines. There’s a matrix of jobs for each os and at the end they publish pipeline artifact then another job which downloads them and then pushes them to a GitHub release. I just followed the api doc at Microsoft - didn’t really use a tutorial

Couple of things

  1. For surge rack I am using one release I made by hand and updating it. The create action works fine also but then you need the logic to determine if you want to

  2. I do rename my assets in my download job. Handy? Maybe. I also whack the version with jq at the start

Lemme know if anything’s not clear

Oh and you need a github connection in your azure. I made a dummy user which has write access for this so I didn’t have to use my user I’d and set it up securely in the admin console using oath. The Microsoft docs on that were super clear once I knew I needed it.

@baconpaul, thank you so very much for that!
It took me 2 hours yesterday to set it up and now that SDK v1 is available my plugin builds automatically for every platform on every commit :slight_smile: I’m quite familiar with Microsoft Azure from my day job and already a big fan, but these Azure Pipelines are just amazing!

One note: I had to adjust the execution rights of the script-files (chmod +x ...sh), but nothing that can’t be fixed in a few minutes.

Hey great - and yeah it’s wonderful right? Always have the latest binary available and never do a pull request that doesn’t build. Glad it worked for you. (I also have to chmod +x my scripts but git should keep that status once you do it in the repo - or maybe you have to add them chmodded)

I added Artifacts handling and publishing now - works great.

Thank you!

2 Likes

Wow, thanks for this tutorial @baconpaul !

I almost have it running for https://github.com/mhetrick/hetrickcv. It’s failing when running scripts/release-notes.sh:

[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/c816734f-bc72-42fa-9671-018677c637f0.sh

/home/vsts/work/_temp/c816734f-bc72-42fa-9671-018677c637f0.sh: line 1: scripts/release-notes.sh: Permission denied

##[error]Bash exited with code '126'.

I saw @stoermelder mention using chmod to modify the file permissions, but doing so on my local machine doesn’t mark the file as modified for git. Any ideas?

Yeah if you don’t check it in 755 it has the wrong perms. Right before that script runs in the azure pipeline just chmod it (so like put the chmod command in azurepipelines.yml)

Chmod u+x scripts/release notes.sh

Or if you want explicitly source it so

. Scripts/releasenote.sh

On my phone sorry for the autocorrect boogers but you get the idea. Just chmod it in the azure pipeline right before it runs.

Good luck and glad it works for you!!

Edit; I found this https://medium.com/@akash1233/change-file-permissions-when-working-with-git-repos-on-windows-ea22e34d5cee which shows you how to change permissions in the repo from windows. That should work but I haven’t tried it

1 Like

Yes!!! That worked. I changed the permissions via git.

Thanks again for sharing the knowledge with us. I’ve been wanting to learn this CI stuff for Unfiltered Audio since we spend so much time wrangling builds.

Great!

Azure Pipelines has started failing to build for me on Linux, and I’m pretty sure I haven’t changed anything. Here’s the error:

g++ -std=c++11 -Wsuggest-override  -fPIC -I/home/vsts/work/_temp/Rack-SDK/include -I/home/vsts/work/_temp/Rack-SDK/dep/include -MMD -MP -g -O3 -march=nocona -funsafe-math-optimizations -Wall -Wextra -Wno-unused-parameter -DARCH_LIN -c -o build/src/Follower.cpp.o src/Follower.cpp
In file included from /home/vsts/work/_temp/Rack-SDK/include/window.hpp:8:0,
                 from /home/vsts/work/_temp/Rack-SDK/include/rack.hpp:11,
                 from src/EntrianRack.hpp:6,
                 from src/Follower.cpp:16:
/home/vsts/work/_temp/Rack-SDK/dep/include/GL/glew.h:1205:24: fatal error: GL/glu.h: No such file or directory

The internet tells me I need to install libglu-dev or similar, but I didn’t need to do that previously, and I’m not sure it’s even possible in an Azure Pipeline. I’m using imageName: 'ubuntu-16.04'.

Is anyone else seeing this? Any workarounds? (Paging @baconpaul…)