Using GitLab-CI with Arduino

June 18, 2016

My configuration :

How did I do ? My project looks like this :

-src
    sketch.ino
gitlab-ci.yml
README

First, use it with a simple sketch (blink example) :

sketch.ino

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
 */

// Pin 13 has an LED connected on most Arduino boards.
// Pin 11 has the LED on Teensy 2.0
// Pin 6  has the LED on Teensy++ 2.0
// Pin 13 has the LED on Teensy 3.0
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {  
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {  
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

.gitlab-ci.yml

compile:  
  script:
    - ino build

Commit and push the code.
In gitlab project properties, activate at least one runner.

Everytime you push your changes :

Click on a build gave script output :

By default, ino build for Arduino Uno.
In my case, I use an Arduino Mini Pro with "pulseIn" function.

I gave this error message :

.build/uno/arduino/libarduino.a(wiring_pulse.o): In function `pulseIn':
/usr/local/share/arduino/hardware/arduino/avr/cores/arduino/wiring_pulse.c:46: undefined reference to `countPulseASM'
[email protected]:~$ ino list-models  
Searching for Board description file (boards.txt) ... /usr/local/share/arduino/hardware/arduino/avr/boards.txt  
         yun: Arduino Yún
         uno: [DEFAULT] Arduino/Genuino Uno
   diecimila: Arduino Duemilanove or Diecimila
        nano: Arduino Nano
        mega: Arduino/Genuino Mega or Mega 2560
     megaADK: Arduino Mega ADK
    leonardo: Arduino Leonardo
       micro: Arduino/Genuino Micro
     esplora: Arduino Esplora
        mini: Arduino Mini
    ethernet: Arduino Ethernet
         fio: Arduino Fio
          bt: Arduino BT
  LilyPadUSB: LilyPad Arduino USB
     lilypad: LilyPad Arduino
         pro: Arduino Pro or Pro Mini
    atmegang: Arduino NG or older
robotControl: Arduino Robot Control  
  robotMotor: Arduino Robot Motor
       gemma: Arduino Gemma

So now my .gitlab-ci.yml looks like this :

compile:  
  script:
    - ino build -m pro

And it works fine :-)