Setting up CI for robot code

Hello,
I remember reading sometime ago that WPILib recommends using Azure Pipelines to build robot code.
I found this azure-pipelines.yml file in the WPILib GitHub repository. However, it seems it builds for many machines which we might not need.
Does someone have an example for an azure-pipelines.yml, or any other CI solution for FRC? We’d also like the CI to run our unit tests (built with JUnit).

Thank you!

Hello,

We’ve used Travis CI happily during 2018 off season. It has a fairly easy setup and works almost out of the box. Here is our 2018 github repo, if you want to check: https://github.com/team-7108/robot-2018. Feel free to DM me if you need any help with Travis.

Happy build season!

I can’t speak for C++, but it’s really easy to set up a system with Java. You basically just need some way to run the command ./gradlew build and you are set.

We are using GitHub Actions (which is easier to set up for github users), with the following code in the .github/workflows/ci.yml:

name: CI

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-java@v1
        with:
          java-version: "11"
      - name: Gradle Build
        run: |
          chmod +x ./gradlew
          ./gradlew build

Azure Pipelines should be really similar:

trigger:
  - master

jobs:
  - job: Build
    pool:
      vmImage: "ubuntu-latest"
    steps:
      - task: Gradle@2
        displayName: "Gradle Build"
        inputs:
          workingDirectory: ""
          gradleWrapperFile: "gradlew"
          javaHomeOption: "JDKVersion"
          jdkVersionOption: "1.11"
          jdkArchitectureOption: "x64"
          publishJUnitResults: true
          testResultsFiles: "**/TEST-*.xml"
          tasks: "build"
2 Likes

We use azure pipelines extensively for CI. One of our repositories that does so is here:

Thanks everyone for your answers! We ended up using GitHub Actions with with the file @yu.liu2 provided.
One change we did is remove the section about branches, because we want to the CI to run on all branches, and not just the master branch.
Thanks again!

Id just like to mention that I maintain what is currently the only FRC CI script on GitHub marketplace, if you are interested: https://github.com/marketplace/actions/frc-build-test

My team uses it for everything. Here is our yml config for 2020 (solves a little version bug):

1 Like

Travis for C++ (yes, language is java):

language: java
install:
- "./gradlew installRoboRioToolchain"
script:
- "./gradlew build"

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.