Browse Source

Merge pull request #2232 from Wackerbarth/AutoVersioning

Automatic versioning for Travis builds
AnHardt 9 years ago
parent
commit
95f1feab1a
2 changed files with 63 additions and 24 deletions
  1. 28
    24
      .travis.yml
  2. 35
    0
      LinuxAddons/bin/generate_version_header_for_marlin

+ 28
- 24
.travis.yml View File

@@ -3,9 +3,11 @@ language: c
3 3
 
4 4
 before_install:
5 5
   - pwd
6
+  - mkdir ~/bin
6 7
   - wget https://bootstrap.pypa.io/get-pip.py
7 8
   - wget https://bintray.com/artifact/download/olikraus/u8glib/u8glib_arduino_v1.17.zip
8 9
 install:
10
+  - mv LinuxAddons/bin/*  ~/bin/
9 11
   - sudo python get-pip.py
10 12
   - sudo pip install ino
11 13
   # add ppa for newer version of Arduino than available in ubuntu 12.04
@@ -30,9 +32,11 @@ before_script:
30 32
   - ln -s Marlin src
31 33
   # remove Marlin.pde as it confuses ino after it finds Marlin.ino
32 34
   - rm Marlin/Marlin.pde
35
+  - generate_version_header_for_marlin . Marlin/_Version.h
36
+  - cat Marlin/_Version.h
33 37
 script:
34 38
   # build default config
35
-  - ino build -m mega2560
39
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
36 40
   # backup configuration.h
37 41
   - cp Marlin/Configuration.h Marlin/Configuration.h.backup
38 42
   - cp Marlin/Configuration_adv.h Marlin/Configuration_adv.h.backup
@@ -40,17 +44,17 @@ script:
40 44
   # commented out for the moment fails build but compiles fine in Arduino
41 45
   #- sed -i 's/#define EXTRUDERS 1/#define EXTRUDERS 2/g' Marlin/Configuration.h
42 46
   #- rm -rf .build/
43
-  #- ino build -m mega2560
47
+  #- ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
44 48
   # change extruder numbers from 2 to 3, needs to be a board with 3 extruders defined in pins.h 
45 49
   #- sed -i 's/#define MOTHERBOARD BOARD_ULTIMAKER/#define MOTHERBOARD BOARD_AZTEEG_X3_PRO/g' Marlin/Configuration.h
46 50
   #- sed -i 's/#define EXTRUDERS 2/#define EXTRUDERS 3/g' Marlin/Configuration.h
47 51
   #- rm -rf .build/
48
-  #- ino build -m mega2560
52
+  #- ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
49 53
   # enable PIDTEMPBED 
50 54
   - cp Marlin/Configuration.h.backup Marlin/Configuration.h
51 55
   - sed -i 's/\/\/#define PIDTEMPBED/#define PIDTEMPBED/g' Marlin/Configuration.h
52 56
   - rm -rf .build/
53
-  - ino build -m mega2560
57
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
54 58
   # enable THERMAL RUNAWAY PROTECTION for extruders & bed
55 59
   - cp Marlin/Configuration.h.backup Marlin/Configuration.h
56 60
   - sed -i 's/\/\/#define THERMAL_RUNAWAY_PROTECTION_PERIOD/#define THERMAL_RUNAWAY_PROTECTION_PERIOD/g' Marlin/Configuration.h
@@ -58,45 +62,45 @@ script:
58 62
   - sed -i 's/\/\/#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD/#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD/g' Marlin/Configuration.h
59 63
   - sed -i 's/\/\/#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS/#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS/g' Marlin/Configuration.h
60 64
   - rm -rf .build/
61
-  - ino build -m mega2560
65
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
62 66
   # enable AUTO_BED_LEVELING
63 67
   - cp Marlin/Configuration.h.backup Marlin/Configuration.h
64 68
   - sed -i 's/\/\/#define ENABLE_AUTO_BED_LEVELING/#define ENABLE_AUTO_BED_LEVELING/g' Marlin/Configuration.h
65 69
   - rm -rf .build/
66
-  - ino build -m mega2560
70
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
67 71
   # enable EEPROM_SETTINGS & EEPROM_CHITCHAT
68 72
   - cp Marlin/Configuration.h.backup Marlin/Configuration.h
69 73
   - sed -i 's/\/\/#define EEPROM_SETTINGS/#define EEPROM_SETTINGS/g' Marlin/Configuration.h
70 74
   - sed -i 's/\/\/#define EEPROM_CHITCHAT/#define EEPROM_CHITCHAT/g' Marlin/Configuration.h
71 75
   - rm -rf .build/
72
-  - ino build -m mega2560
76
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
73 77
   ### LCDS ###
74 78
   # ULTIMAKERCONTROLLER
75 79
   - cp Marlin/Configuration.h.backup Marlin/Configuration.h
76 80
   - sed -i 's/\/\/#define ULTIMAKERCONTROLLER/#define ULTIMAKERCONTROLLER/g' Marlin/Configuration.h
77 81
   - rm -rf .build/
78
-  - ino build -m mega2560
82
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
79 83
   # MAKRPANEL
80 84
   # Needs to use melzi and sanguino hardware
81 85
   #- cp Marlin/Configuration.h.backup Marlin/Configuration.h
82 86
   #- sed -i 's/\/\/#define MAKRPANEL/#define MAKRPANEL/g' Marlin/Configuration.h
83 87
   #- rm -rf .build/
84
-  #- ino build -m mega2560
88
+  #- ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
85 89
   # REPRAP_DISCOUNT_SMART_CONTROLLER
86 90
   - cp Marlin/Configuration.h.backup Marlin/Configuration.h
87 91
   - sed -i 's/\/\/#define REPRAP_DISCOUNT_SMART_CONTROLLER/#define REPRAP_DISCOUNT_SMART_CONTROLLER/g' Marlin/Configuration.h
88 92
   - rm -rf .build/
89
-  - ino build -m mega2560
93
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
90 94
   # G3D_PANE
91 95
   - cp Marlin/Configuration.h.backup Marlin/Configuration.h
92 96
   - sed -i 's/\/\/#define G3D_PANEL/#define G3D_PANEL/g' Marlin/Configuration.h
93 97
   - rm -rf .build/
94
-  - ino build -m mega2560
98
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
95 99
   # REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
96 100
   - cp Marlin/Configuration.h.backup Marlin/Configuration.h
97 101
   - sed -i 's/\/\/#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER/#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER/g' Marlin/Configuration.h
98 102
   - rm -rf .build/
99
-  - ino build -m mega2560
103
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
100 104
   # REPRAPWORLD_KEYPAD 
101 105
   # Cant find configuration details to get it to compile
102 106
   #- cp Marlin/Configuration.h.backup Marlin/Configuration.h
@@ -104,60 +108,60 @@ script:
104 108
   #- sed -i 's/\/\/#define REPRAPWORLD_KEYPAD/#define REPRAPWORLD_KEYPAD/g' Marlin/Configuration.h
105 109
   #- sed -i 's/\/\/#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0/#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0/g' Marlin/Configuration.h
106 110
   #- rm -rf .build/
107
-  #- ino build -m mega2560
111
+  #- ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
108 112
   # RA_CONTROL_PANEL
109 113
   - cp Marlin/Configuration.h.backup Marlin/Configuration.h
110 114
   - sed -i 's/\/\/#define RA_CONTROL_PANEL/#define RA_CONTROL_PANEL/g' Marlin/Configuration.h
111 115
   - rm -rf .build/
112
-  - ino build -m mega2560
116
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
113 117
   ### I2C PANELS ###
114 118
   # LCD_I2C_SAINSMART_YWROBOT
115 119
   # Failing at the moment needs different library 
116 120
   #- cp Marlin/Configuration.h.backup Marlin/Configuration.h
117 121
   #- sed -i 's/\/\/#define LCD_I2C_SAINSMART_YWROBOT/#define LCD_I2C_SAINSMART_YWROBOT/g' Marlin/Configuration.h
118 122
   #- rm -rf .build/
119
-  #- ino build -m mega2560
123
+  #- ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
120 124
   # LCD_I2C_PANELOLU2
121 125
   - cp Marlin/Configuration.h.backup Marlin/Configuration.h
122 126
   - sed -i 's/\/\/#define LCD_I2C_PANELOLU2/#define LCD_I2C_PANELOLU2/g' Marlin/Configuration.h
123 127
   - rm -rf .build/
124
-  - ino build -m mega2560
128
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
125 129
   # LCD_I2C_VIKI
126 130
   - cp Marlin/Configuration.h.backup Marlin/Configuration.h
127 131
   - sed -i 's/\/\/#define LCD_I2C_VIKI/#define LCD_I2C_VIKI/g' Marlin/Configuration.h
128 132
   - rm -rf .build/
129
-  - ino build -m mega2560
133
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
130 134
   # Enable filament sensor
131 135
   - cp Marlin/Configuration.h.backup Marlin/Configuration.h
132 136
   - sed -i 's/\/\/#define FILAMENT_SENSOR/#define FILAMENT_SENSOR/g' Marlin/Configuration.h
133 137
   - rm -rf .build/
134
-  - ino build -m mega2560
138
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
135 139
    # Enable filament sensor with LCD display
136 140
   - cp Marlin/Configuration.h.backup Marlin/Configuration.h
137 141
   - sed -i 's/\/\/#define ULTIMAKERCONTROLLER/#define ULTIMAKERCONTROLLER/g' Marlin/Configuration.h
138 142
   - sed -i 's/\/\/#define FILAMENT_SENSOR/#define FILAMENT_SENSOR/g' Marlin/Configuration.h
139 143
   - sed -i 's/\/\/#define FILAMENT_LCD_DISPLAY/#define FILAMENT_LCD_DISPLAY/g' Marlin/Configuration.h
140 144
   - rm -rf .build/
141
-  - ino build -m mega2560
145
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
142 146
   ######## Example Configurations ##############
143 147
   # Delta Config (generic)
144 148
   - cp Marlin/example_configurations/delta/generic/Configuration* Marlin/
145 149
   - rm -rf .build/
146
-  - ino build -m mega2560
150
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
147 151
   # Delta Config (Mini Kossel)
148 152
   - cp Marlin/example_configurations/delta/kossel_mini/Configuration* Marlin/
149 153
   - rm -rf .build/
150
-  - ino build -m mega2560
154
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
151 155
   # Makibox Config  need to check board type for Teensy++ 2.0
152 156
   #- cp Marlin/example_configurations/makibox/Configuration* Marlin/
153 157
   #- rm -rf .build/
154
-  #- ino build -m mega2560
158
+  #- ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
155 159
   # SCARA Config
156 160
   - cp Marlin/example_configurations/SCARA/Configuration* Marlin/
157 161
   - rm -rf .build/
158
-  - ino build -m mega2560
162
+  - ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
159 163
   # tvrrug Config need to check board type for sanguino atmega644p
160 164
   #- cp Marlin/example_configurations/tvrrug/Round2/Configuration* Marlin/
161 165
   #- rm -rf .build/
162
-  #- ino build -m mega2560
166
+  #- ino build -m mega2560 --cppflags="-DHAS_AUTOMATIC_VERSIONING -ffunction-sections -fdata-sections -g -Os -w"
163 167
   ######## Board Types #############

+ 35
- 0
LinuxAddons/bin/generate_version_header_for_marlin View File

@@ -0,0 +1,35 @@
1
+#!/usr/bin/env bash
2
+# generate_version_header_for_marlin
3
+
4
+DIR=$1 export DIR
5
+OUTFILE=$2 export OUTFILE
6
+echo "/* This file is automatically generated by an Arduino hook" >$OUTFILE
7
+echo " * Do not manually edit it" >>$OUTFILE
8
+echo " * It does not get committed to the repository" >>$OUTFILE
9
+echo " */" >>$OUTFILE
10
+echo "" >>$OUTFILE
11
+
12
+echo "#define BUILD_UNIX_DATETIME" `date +%s` >>$OUTFILE
13
+echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>$OUTFILE
14
+( set +e
15
+  cd $DIR
16
+  BRANCH=`git symbolic-ref --short HEAD`
17
+  if [ "x$BRANCH" == "xHEAD" ] ; then
18
+    BRANCH=""
19
+  elif [ "x$BRANCH" == "xDevelopment" ] ; then
20
+    BRANCH=" dev"
21
+  else
22
+    BRANCH=" $BRANCH"
23
+  fi
24
+  VERSION=`git describe --tags --first-parent 2>/dev/null` 
25
+  if [ "x$VERSION" != "x" ] ; then
26
+    echo "#define BUILD_VERSION \"$VERSION\"" | sed "s/-/$BRANCH-/" >>$OUTFILE
27
+  fi
28
+  URL=`git config --local --get remote.origin.url | sed "sx.*github.com:xhttps://github.com/x" | sed "sx\.gitx/x"`
29
+  if [ "x$URL" != "x" ] ; then
30
+    echo "#define SOURCE_CODE_URL  \""$URL"\"" >>$OUTFILE
31
+    echo "// Deprecated URL definition" >>$OUTFILE
32
+    echo "#define FIRMWARE_URL  \""$URL"\"" >>$OUTFILE
33
+  fi
34
+  
35
+)

Loading…
Cancel
Save