Github Actions is a new way to implement continuous integration and continuous deployment for Github projects. Pipelines are called workflows and they are written in everybodys favorite language: YAML. Editing can be done directly in github.com and Github provides nice set of templates to get started.
Github Actions provides nice amount of build time for free. Total of 2000 minutes per month. Pricing has some weird aspect though, the 2000 minutes is actually lot less if you are using Windows and LOT less if you are using macOs agents:
Product | Storage | Minutes (per month) |
---|---|---|
GitHub Free | 500 MB | 2,000 |
GitHub Pro | 1 GB | 3,000 |
GitHub Team | 2 GB | 10,000 |
GitHub Enterprise Cloud | 50 GB | 50,000 |
Jobs that run on Windows and macOS runners that GitHub hosts consume minutes at 2 and 10 times the rate that jobs on Linux runners consume. For example, using 1,000 Windows minutes would consume 2,000 of the minutes included in your account.
Operating system | Minute multiplier |
---|---|
Linux | 1 |
macOS | 10 |
Windows | 2 |
The macOS multiplier is whopping 10x against Linux. Well you can’t really complain them when you know the restrictions for virtualization of macOS. You can buy extra time if you run out of free minutes and it is not even that expensiv. More information about pricing can be found from here.
Setting up the pipeline
Pipeline setting is really easy. Github Actions has very nice YAML editor built in, that creates .github/workflows folder with main.yml file in it. Main.yml file contains the definition for building your project. The editor has automatic tabbing, intellisense and git tool for commiting changes.
To build a dotnet core project, we will need to use setup-dotnet action and call the dotnet build in run task. At simplest the working dotnet building main.yml looks like this.
name: CI on: push: branches: - master jobs: build: runs-on: ubuntu-16.04 name: Dotnet build steps: - uses: actions/checkout@master - name: Setup dotnet uses: actions/setup-dotnet@v1 with: dotnet-version: '3.1.100' # SDK Version to use. - run: dotnet build <solution or project>
After submitting the file, the build will trigger automatically (as said in on part of the main.yml file).
Build times with simple dotnet project is around 1 minute, so at free level I can build my project over 60 times in a day! For more information about Github Actions, navigate to their Features site, which explains the basics.