Integrating with Github Actions

Github Actions support your CI/CD integration by allowing you to trigger software workflows every time your code is committed. Incredibuild integrates with Github Actions to allow you to speed up these software workflows by distributing them to available helper agents.

Github Actions uses machines called Runners to run workflows every time your code is committed. Incredibuild integrates with Github Actions by installing an Incredibuild Initiator Agent on these Runners. Your workflows can then be distributed across all of your Incredibuild Helper Agents.

The integration is different depending on whether you are using self-hosted runners, or Github hosted runners.

This integration works with every type of Incredibuild license.

Integrating with Github Actions when using Self-Hosted Runners

Incredibuild integrates by installing an Initiator Agent on each self-hosted runner.

  1. Incredibuild Setup and Prerequisites

    1. Github Actions must be up and running on self-hosted runners using Windows.

    2. An Incredibuild Coordinator must already be installed.

    3. Install Incredibuild on the machines that have your Github Self-Hosted Runners and associate them with your Incredibuild Coordinator.

    4. Prepare a batch file with the Incredibuild build command. This depends on what you are building. For details, see Running Builds.

  2. Add a Github Action Workflow

    You define a Workflow that will call Incredibuild whenever Github Actions is triggered. If you already have a Github Action Workflow, you can refer to the code below as an example to make the relevant modifications to your existing Workflow.

    1. From your GitHub project repository, go to the Actions tab and add a new Workflow.

    2. Choose Manual Workflow and click Configure.

    3. Replace the content with the following code:

      Copy
      name: IB trigger

      # Controls when the workflow will run
      on:
        # Triggers the workflow on push or pull request events but only for the master branch
        push:
          branches: [ master ]
        pull_request:
          branches: [ master ]

      jobs:
        # This workflow contains a single job called "build"
        build:
          # The type of runner that the job will run on
          runs-on: self-hosted

            # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
            - uses: actions/checkout@v2

            # Runs a single command using the runners shell
            - name: Run Rebuild batch file and distridute the tasks within helpers
              run: powershell <path to batch file you just created>

            # Runs a set of commands using the runners shell
      #      - name: Run a multi-line script
      #        run: |
      #         echo Add other actions to build,
      #         echo test, and deploy your project.
    4. Replace <path to batch file you just created> with the correct path.

 

Integrating with Github Actions when using Github-Hosted Runners

Because Github-Hosted Runners are dynamically created, the integration process involves setting up Github Actions to automatically install Incredibuild on the machines they create and connect them to your Coordinator. This requires you to use an Incredibuild floating initiator license on your Github hosted runner machines.

  1. Github Actions must be up and running on Github-hosted runners using Windows.

  2. An Incredibuild Coordinator must already be installed.

  3. Make sure that the port 31104 on the Coordinator machine is open for traffic from the runner machines. Incredibuild Initiators will be installed on those runners and they will be connected to your Incredibuild Coordinator.

  4. Copy the Incredibuild installation file to a location that your Github Runners can access.

  5. In Github Actions, create a manual workflow. If you already have a Github Action Workflow, you can refer to the code below as an example to make the relevant modifications to your existing Workflow:

    1. From your GitHub project repository, go to the Actions tab and add a new Workflow.

    2. Choose Manual Workflow and click Configure.

    3. Replace the content with the following code:

      Copy
      name: Build on Windows
      on: push
      jobs:
        build:
          runs-on: windows-2019
          steps:
            -  run: |
                choco install wget -y
                cd C:\ 
                wget "<path to original IB install file>/IBSetupConsole.exe" -O "C:\IBSetupConsole.exe" 
                ./IBSetupConsole.exe /Install /Components=Agent /Coordinator=<IP of Coordinator Machine> the /Agent:AgentRole=Initiator /Agent:InitiatorType=Floating /AddToPath=ON /Agent:InstallAddins=OFF
                                            
            - name: Add msbuild to PATH
              uses: microsoft/setup-msbuild@v1.1
                    
            - name: Clone Repository and Rebuild with Incredibuild
              run: |
                  cd C:\
                  git clone <URL to your Github repository>
                  cd C:\<name of your Github project>
                  $env:Path = 'C:\Program Files (x86)\IncrediBuild'
                  BuildConsole.exe '<path to your solution>' /rebuild /cfg="Debug|x64" /usemsbuild ##Replace with your build command
                                                   
            - name: Upload artifacts
              if: always()    
              uses: actions/upload-artifact@v2
              with:
                 name: my-artifact
                 path: |
                   C:\Program Files (x86)\IncrediBuild\History
                   C:\Program Files (x86)\IncrediBuild\Logs
    4. Modify the code with the actual URL to your Github repository, Name of your Github project, and build command (instead of the line BuildConsole.exe...). To define your build command, see Running Builds. If you want to modify the Incredibuild installation command (IBSetupConsole.exe), see Silent Installation for details.