PowerShell.org offers an instance of TeamCity, free to use for any PowerShell project with an approved open-source license. This is similar to other hosted Continuous Integration services out there, such as Appveyor and teamcity.codebetter.com, but with some advantages for the PowerShell community:
- We have a pool of build agents tailored specifically for the needs of PowerShell testing. You can test modules on PowerShell v2 through v5, using Pester (which is already installed on each agent.) Currently, this pool consists of Windows 2012 R2 (for PowerShell v4 and v5), Windows 2012 (for PowerShell v3), and Windows 2008 R2 (for PowerShell v2). Over time, we can add other operating system / PS version combinations, if that adds value for the community.
- Like Appveyor, we use each build agent only once, then delete it and start again from a clean image. This helps to ensure security in a multi-tenant environment like this, so any secrets in your build job (certificates, API keys, etc) are never potentially exposed to other users.
Your project must be open-source, and it may not have any developers who are paid to work on it. This includes open-source projects that are "sponsored" by a company that pays developers to primarily work on that project. This is a licensing requirement for some of our pipeline components.
Over time, we'll flesh out this documentation quite a bit more, but for now, I'll share what the on-boarding process looks like:
1. In a browser, go to build.powershell.org.
2. If you haven't already done so, register an account with the link on the logon page.
3. To add a new project, send an email to DaveW@powershell.org with your TeamCity user name and a link to your project. It needs to be hosted on a public repository, and needs to have an approved open-source license file in the root of the repo.
4. As soon as I can get to it, I'll copy a template to create your project, create a project administrator group for it, and add your account to the group. If you'd like other users to be added to your project as well, you can give their usernames in the email. The template is set up for GitHub projects, and will automatically run Pester tests on PowerShell v2 through v5 against new commits to any branch, as well as any pull request.
5. Once the project is created, you can log on and view it. Since you'll have admin rights to that project, you'll have an "Edit Project Settings" link available:
6. The template is also set up to push status information for the branches / PRs that it tests back to GitHub, but in order for that to work, you need to give it credentials. The template is set up to use a GitHub "Personal Access Token", which you can enter by clicking the Parameters link under your project's settings, and then modifying the GitHub.PersonalAccessToken parameter. (As you can see, the value is no longer displayed in the UI after you enter it. It is encrypted and stored in the TeamCity database.)
7. If you don't have a Personal Access Token yet, you can create one by logging on to GitHub, selecting Settings from the drop-down menu behind your profile picture in the upper right, and selecting "Personal access tokens". When you create one, make sure it has the "public_repo" and "repo:status" scopes checked.
8. Once you've done this, you're all set. The next time a build is triggered for your project, the TeamCity server will push status information about the branch or pull request back to GitHub.
A Few Comments
- Because we're only creating build agents on-demand when they're needed, there's a small delay from the time your build is queued until it actually starts. On average, it seems to take around 3-4 minutes for our build agent VMs to be created and boot up. It may even take longer - that's the price of free ;).
- For now, we've limited ourselves to a pool of 4 concurrent build agents, to ensure we stay within budget. We'll keep an eye on wait times / queue lengths, and on our cloud costs over the first few months, and decide if we need to increase that number at some point (and if we have enough money for it; we're running this on donations.)
- If your project doesn't support older versions of PowerShell, you can simply delete those configurations from your project. You'll find that under the General Settings link of your Project Settings page; each build configuration has a "More" drop-down menu off to the right where you can copy, move or delete it.
- Feel free to experiment! You have full admin rights to your project, and you can tweak the settings however you like. The worst thing that could happen is it gets so mucked up that you'd rather start over, at which point, just send me an email and I'll start you over with the template again.
- There's a lot more than can be done with TeamCity, and I've just given a very quick introduction to our setup here. I'll add more guides over time here, and you can also learn about the product straight from JetBrains.
- If you have any questions or concerns about the service, please don't hesitate to ask, either on the Forums or via email.
Want to Give Back?
As mentioned, this service is run entirely on donations - including yours. If you're using the service, why not donate $10 a year toward expenses? You can even donate more, if you like. Just click here to donate via PayPal - and thanks!