Automatic versioning for Travis builds

This commit is contained in:
Richard Wackerbarth 2015-06-02 08:01:40 -05:00
parent 764e61708b
commit ac382cbdaf
2 changed files with 63 additions and 24 deletions

View file

@ -3,9 +3,11 @@ language: c
before_install: before_install:
- pwd - pwd
- mkdir ~/bin
- wget https://bootstrap.pypa.io/get-pip.py - wget https://bootstrap.pypa.io/get-pip.py
- wget https://bintray.com/artifact/download/olikraus/u8glib/u8glib_arduino_v1.17.zip - wget https://bintray.com/artifact/download/olikraus/u8glib/u8glib_arduino_v1.17.zip
install: install:
- mv LinuxAddons/bin/* ~/bin/
- sudo python get-pip.py - sudo python get-pip.py
- sudo pip install ino - sudo pip install ino
# add ppa for newer version of Arduino than available in ubuntu 12.04 # add ppa for newer version of Arduino than available in ubuntu 12.04
@ -30,9 +32,11 @@ before_script:
- ln -s Marlin src - ln -s Marlin src
# remove Marlin.pde as it confuses ino after it finds Marlin.ino # remove Marlin.pde as it confuses ino after it finds Marlin.ino
- rm Marlin/Marlin.pde - rm Marlin/Marlin.pde
- generate_version_header_for_marlin . Marlin/_Version.h
- cat Marlin/_Version.h
script: script:
# build default config # build default config
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# backup configuration.h # backup configuration.h
- cp Marlin/Configuration.h Marlin/Configuration.h.backup - cp Marlin/Configuration.h Marlin/Configuration.h.backup
- cp Marlin/Configuration_adv.h Marlin/Configuration_adv.h.backup - cp Marlin/Configuration_adv.h Marlin/Configuration_adv.h.backup
@ -40,17 +44,17 @@ script:
# commented out for the moment fails build but compiles fine in Arduino # commented out for the moment fails build but compiles fine in Arduino
#- sed -i 's/#define EXTRUDERS 1/#define EXTRUDERS 2/g' Marlin/Configuration.h #- sed -i 's/#define EXTRUDERS 1/#define EXTRUDERS 2/g' Marlin/Configuration.h
#- rm -rf .build/ #- rm -rf .build/
#- ino build -m mega2560 #- ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# change extruder numbers from 2 to 3, needs to be a board with 3 extruders defined in pins.h # change extruder numbers from 2 to 3, needs to be a board with 3 extruders defined in pins.h
#- sed -i 's/#define MOTHERBOARD BOARD_ULTIMAKER/#define MOTHERBOARD BOARD_AZTEEG_X3_PRO/g' Marlin/Configuration.h #- sed -i 's/#define MOTHERBOARD BOARD_ULTIMAKER/#define MOTHERBOARD BOARD_AZTEEG_X3_PRO/g' Marlin/Configuration.h
#- sed -i 's/#define EXTRUDERS 2/#define EXTRUDERS 3/g' Marlin/Configuration.h #- sed -i 's/#define EXTRUDERS 2/#define EXTRUDERS 3/g' Marlin/Configuration.h
#- rm -rf .build/ #- rm -rf .build/
#- ino build -m mega2560 #- ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# enable PIDTEMPBED # enable PIDTEMPBED
- cp Marlin/Configuration.h.backup Marlin/Configuration.h - cp Marlin/Configuration.h.backup Marlin/Configuration.h
- sed -i 's/\/\/#define PIDTEMPBED/#define PIDTEMPBED/g' Marlin/Configuration.h - sed -i 's/\/\/#define PIDTEMPBED/#define PIDTEMPBED/g' Marlin/Configuration.h
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# enable THERMAL RUNAWAY PROTECTION for extruders & bed # enable THERMAL RUNAWAY PROTECTION for extruders & bed
- cp Marlin/Configuration.h.backup Marlin/Configuration.h - cp Marlin/Configuration.h.backup Marlin/Configuration.h
- sed -i 's/\/\/#define THERMAL_RUNAWAY_PROTECTION_PERIOD/#define THERMAL_RUNAWAY_PROTECTION_PERIOD/g' Marlin/Configuration.h - sed -i 's/\/\/#define THERMAL_RUNAWAY_PROTECTION_PERIOD/#define THERMAL_RUNAWAY_PROTECTION_PERIOD/g' Marlin/Configuration.h
@ -58,45 +62,45 @@ script:
- sed -i 's/\/\/#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD/#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD/g' Marlin/Configuration.h - sed -i 's/\/\/#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD/#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD/g' Marlin/Configuration.h
- sed -i 's/\/\/#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS/#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS/g' Marlin/Configuration.h - sed -i 's/\/\/#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS/#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS/g' Marlin/Configuration.h
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# enable AUTO_BED_LEVELING # enable AUTO_BED_LEVELING
- cp Marlin/Configuration.h.backup Marlin/Configuration.h - cp Marlin/Configuration.h.backup Marlin/Configuration.h
- sed -i 's/\/\/#define ENABLE_AUTO_BED_LEVELING/#define ENABLE_AUTO_BED_LEVELING/g' Marlin/Configuration.h - sed -i 's/\/\/#define ENABLE_AUTO_BED_LEVELING/#define ENABLE_AUTO_BED_LEVELING/g' Marlin/Configuration.h
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# enable EEPROM_SETTINGS & EEPROM_CHITCHAT # enable EEPROM_SETTINGS & EEPROM_CHITCHAT
- cp Marlin/Configuration.h.backup Marlin/Configuration.h - cp Marlin/Configuration.h.backup Marlin/Configuration.h
- sed -i 's/\/\/#define EEPROM_SETTINGS/#define EEPROM_SETTINGS/g' Marlin/Configuration.h - sed -i 's/\/\/#define EEPROM_SETTINGS/#define EEPROM_SETTINGS/g' Marlin/Configuration.h
- sed -i 's/\/\/#define EEPROM_CHITCHAT/#define EEPROM_CHITCHAT/g' Marlin/Configuration.h - sed -i 's/\/\/#define EEPROM_CHITCHAT/#define EEPROM_CHITCHAT/g' Marlin/Configuration.h
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
### LCDS ### ### LCDS ###
# ULTIMAKERCONTROLLER # ULTIMAKERCONTROLLER
- cp Marlin/Configuration.h.backup Marlin/Configuration.h - cp Marlin/Configuration.h.backup Marlin/Configuration.h
- sed -i 's/\/\/#define ULTIMAKERCONTROLLER/#define ULTIMAKERCONTROLLER/g' Marlin/Configuration.h - sed -i 's/\/\/#define ULTIMAKERCONTROLLER/#define ULTIMAKERCONTROLLER/g' Marlin/Configuration.h
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# MAKRPANEL # MAKRPANEL
# Needs to use melzi and sanguino hardware # Needs to use melzi and sanguino hardware
#- cp Marlin/Configuration.h.backup Marlin/Configuration.h #- cp Marlin/Configuration.h.backup Marlin/Configuration.h
#- sed -i 's/\/\/#define MAKRPANEL/#define MAKRPANEL/g' Marlin/Configuration.h #- sed -i 's/\/\/#define MAKRPANEL/#define MAKRPANEL/g' Marlin/Configuration.h
#- rm -rf .build/ #- rm -rf .build/
#- ino build -m mega2560 #- ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# REPRAP_DISCOUNT_SMART_CONTROLLER # REPRAP_DISCOUNT_SMART_CONTROLLER
- cp Marlin/Configuration.h.backup Marlin/Configuration.h - cp Marlin/Configuration.h.backup Marlin/Configuration.h
- sed -i 's/\/\/#define REPRAP_DISCOUNT_SMART_CONTROLLER/#define REPRAP_DISCOUNT_SMART_CONTROLLER/g' Marlin/Configuration.h - sed -i 's/\/\/#define REPRAP_DISCOUNT_SMART_CONTROLLER/#define REPRAP_DISCOUNT_SMART_CONTROLLER/g' Marlin/Configuration.h
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# G3D_PANE # G3D_PANE
- cp Marlin/Configuration.h.backup Marlin/Configuration.h - cp Marlin/Configuration.h.backup Marlin/Configuration.h
- sed -i 's/\/\/#define G3D_PANEL/#define G3D_PANEL/g' Marlin/Configuration.h - sed -i 's/\/\/#define G3D_PANEL/#define G3D_PANEL/g' Marlin/Configuration.h
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER # REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
- cp Marlin/Configuration.h.backup Marlin/Configuration.h - cp Marlin/Configuration.h.backup Marlin/Configuration.h
- sed -i 's/\/\/#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER/#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER/g' Marlin/Configuration.h - sed -i 's/\/\/#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER/#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER/g' Marlin/Configuration.h
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# REPRAPWORLD_KEYPAD # REPRAPWORLD_KEYPAD
# Cant find configuration details to get it to compile # Cant find configuration details to get it to compile
#- cp Marlin/Configuration.h.backup Marlin/Configuration.h #- cp Marlin/Configuration.h.backup Marlin/Configuration.h
@ -104,60 +108,60 @@ script:
#- sed -i 's/\/\/#define REPRAPWORLD_KEYPAD/#define REPRAPWORLD_KEYPAD/g' Marlin/Configuration.h #- sed -i 's/\/\/#define REPRAPWORLD_KEYPAD/#define REPRAPWORLD_KEYPAD/g' Marlin/Configuration.h
#- sed -i 's/\/\/#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0/#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0/g' Marlin/Configuration.h #- sed -i 's/\/\/#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0/#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0/g' Marlin/Configuration.h
#- rm -rf .build/ #- rm -rf .build/
#- ino build -m mega2560 #- ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# RA_CONTROL_PANEL # RA_CONTROL_PANEL
- cp Marlin/Configuration.h.backup Marlin/Configuration.h - cp Marlin/Configuration.h.backup Marlin/Configuration.h
- sed -i 's/\/\/#define RA_CONTROL_PANEL/#define RA_CONTROL_PANEL/g' Marlin/Configuration.h - sed -i 's/\/\/#define RA_CONTROL_PANEL/#define RA_CONTROL_PANEL/g' Marlin/Configuration.h
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
### I2C PANELS ### ### I2C PANELS ###
# LCD_I2C_SAINSMART_YWROBOT # LCD_I2C_SAINSMART_YWROBOT
# Failing at the moment needs different library # Failing at the moment needs different library
#- cp Marlin/Configuration.h.backup Marlin/Configuration.h #- cp Marlin/Configuration.h.backup Marlin/Configuration.h
#- sed -i 's/\/\/#define LCD_I2C_SAINSMART_YWROBOT/#define LCD_I2C_SAINSMART_YWROBOT/g' Marlin/Configuration.h #- sed -i 's/\/\/#define LCD_I2C_SAINSMART_YWROBOT/#define LCD_I2C_SAINSMART_YWROBOT/g' Marlin/Configuration.h
#- rm -rf .build/ #- rm -rf .build/
#- ino build -m mega2560 #- ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# LCD_I2C_PANELOLU2 # LCD_I2C_PANELOLU2
- cp Marlin/Configuration.h.backup Marlin/Configuration.h - cp Marlin/Configuration.h.backup Marlin/Configuration.h
- sed -i 's/\/\/#define LCD_I2C_PANELOLU2/#define LCD_I2C_PANELOLU2/g' Marlin/Configuration.h - sed -i 's/\/\/#define LCD_I2C_PANELOLU2/#define LCD_I2C_PANELOLU2/g' Marlin/Configuration.h
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# LCD_I2C_VIKI # LCD_I2C_VIKI
- cp Marlin/Configuration.h.backup Marlin/Configuration.h - cp Marlin/Configuration.h.backup Marlin/Configuration.h
- sed -i 's/\/\/#define LCD_I2C_VIKI/#define LCD_I2C_VIKI/g' Marlin/Configuration.h - sed -i 's/\/\/#define LCD_I2C_VIKI/#define LCD_I2C_VIKI/g' Marlin/Configuration.h
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# Enable filament sensor # Enable filament sensor
- cp Marlin/Configuration.h.backup Marlin/Configuration.h - cp Marlin/Configuration.h.backup Marlin/Configuration.h
- sed -i 's/\/\/#define FILAMENT_SENSOR/#define FILAMENT_SENSOR/g' Marlin/Configuration.h - sed -i 's/\/\/#define FILAMENT_SENSOR/#define FILAMENT_SENSOR/g' Marlin/Configuration.h
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# Enable filament sensor with LCD display # Enable filament sensor with LCD display
- cp Marlin/Configuration.h.backup Marlin/Configuration.h - cp Marlin/Configuration.h.backup Marlin/Configuration.h
- sed -i 's/\/\/#define ULTIMAKERCONTROLLER/#define ULTIMAKERCONTROLLER/g' Marlin/Configuration.h - sed -i 's/\/\/#define ULTIMAKERCONTROLLER/#define ULTIMAKERCONTROLLER/g' Marlin/Configuration.h
- sed -i 's/\/\/#define FILAMENT_SENSOR/#define FILAMENT_SENSOR/g' Marlin/Configuration.h - sed -i 's/\/\/#define FILAMENT_SENSOR/#define FILAMENT_SENSOR/g' Marlin/Configuration.h
- sed -i 's/\/\/#define FILAMENT_LCD_DISPLAY/#define FILAMENT_LCD_DISPLAY/g' Marlin/Configuration.h - sed -i 's/\/\/#define FILAMENT_LCD_DISPLAY/#define FILAMENT_LCD_DISPLAY/g' Marlin/Configuration.h
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
######## Example Configurations ############## ######## Example Configurations ##############
# Delta Config (generic) # Delta Config (generic)
- cp Marlin/example_configurations/delta/generic/Configuration* Marlin/ - cp Marlin/example_configurations/delta/generic/Configuration* Marlin/
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# Delta Config (Mini Kossel) # Delta Config (Mini Kossel)
- cp Marlin/example_configurations/delta/kossel_mini/Configuration* Marlin/ - cp Marlin/example_configurations/delta/kossel_mini/Configuration* Marlin/
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# Makibox Config need to check board type for Teensy++ 2.0 # Makibox Config need to check board type for Teensy++ 2.0
#- cp Marlin/example_configurations/makibox/Configuration* Marlin/ #- cp Marlin/example_configurations/makibox/Configuration* Marlin/
#- rm -rf .build/ #- rm -rf .build/
#- ino build -m mega2560 #- ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# SCARA Config # SCARA Config
- cp Marlin/example_configurations/SCARA/Configuration* Marlin/ - cp Marlin/example_configurations/SCARA/Configuration* Marlin/
- rm -rf .build/ - rm -rf .build/
- ino build -m mega2560 - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
# tvrrug Config need to check board type for sanguino atmega644p # tvrrug Config need to check board type for sanguino atmega644p
#- cp Marlin/example_configurations/tvrrug/Round2/Configuration* Marlin/ #- cp Marlin/example_configurations/tvrrug/Round2/Configuration* Marlin/
#- rm -rf .build/ #- rm -rf .build/
#- ino build -m mega2560 #- ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
######## Board Types ############# ######## Board Types #############

View file

@ -0,0 +1,35 @@
#!/usr/bin/env bash
# generate_version_header_for_marlin
DIR=$1 export DIR
OUTFILE=$2 export OUTFILE
echo "/* This file is automatically generated by an Arduino hook" >$OUTFILE
echo " * Do not manually edit it" >>$OUTFILE
echo " * It does not get committed to the repository" >>$OUTFILE
echo " */" >>$OUTFILE
echo "" >>$OUTFILE
echo "#define BUILD_UNIX_DATETIME" `date +%s` >>$OUTFILE
echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>$OUTFILE
( set +e
cd $DIR
BRANCH=`git symbolic-ref --short HEAD`
if [ "x$BRANCH" == "xHEAD" ] ; then
BRANCH=""
elif [ "x$BRANCH" == "xDevelopment" ] ; then
BRANCH=" dev"
else
BRANCH=" $BRANCH"
fi
VERSION=`git describe --tags --first-parent 2>/dev/null`
if [ "x$VERSION" != "x" ] ; then
echo "#define BUILD_VERSION \"$VERSION\"" | sed "s/-/$BRANCH-/" >>$OUTFILE
fi
URL=`git config --local --get remote.origin.url | sed "sx.*github.com:xhttps://github.com/x" | sed "sx\.gitx/x"`
if [ "x$URL" != "x" ] ; then
echo "#define SOURCE_CODE_URL \""$URL"\"" >>$OUTFILE
echo "// Deprecated URL definition" >>$OUTFILE
echo "#define FIRMWARE_URL \""$URL"\"" >>$OUTFILE
fi
)