File tree 2 files changed +31
-1
lines changed
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -125,3 +125,26 @@ External libraries (which are not hosted by the Arduino library manager) can be
125
125
```
126
126
- if [ ! -d "$HOME/arduino_ide/libraries/<Name>" ]; then git clone <URL> $HOME/arduino_ide/libraries/<Name>; fi
127
127
```
128
+
129
+ ## Deploying compiled artifacts
130
+ If you need to get hold of the compiled sketches of your project, in order to release them or forward them to an
131
+ deployment pipeline, you can find them in the ` $ARDUINO_HEX_DIR ` directory. Specifically, if ` Foo ` is the name
132
+ of your project, you are compiling for an ` Arduino Mega ` and the primary sketch is called ` Foo.ino ` , the flashable
133
+ ` .hex ` files will be found inside ` $ARDUINO_HEX_DIR/mega2560/Foo ` as ` Foo.ino.hex ` and ` Foo.ino.with_bootloader.hex ` .
134
+ Similarly for the rest of the platforms.
135
+
136
+ For example, assuming you have a ` Foo ` project as outlined above, to create a release which includes the ` .hex `
137
+ files on GitHub, you could add this to your ` .travis.yml ` configuration:
138
+
139
+ ``` yaml
140
+ deploy :
141
+ provider : releases
142
+ api_key :
143
+ secure : YOUR_API_KEY_ENCRYPTED
144
+ file :
145
+ - $ARDUINO_HEX_DIR/mega2560/Foo/Foo.ino.hex
146
+ - $ARDUINO_HEX_DIR/mega2560/Foo/Foo.ino.with_bootloader.hex
147
+ skip_cleanup : true
148
+ on :
149
+ tags : true
150
+ ` ` `
Original file line number Diff line number Diff line change @@ -71,6 +71,9 @@ echo -n "CACHED: "
71
71
echo -e " " " $GREEN " " \xe2\x9c\x93"
72
72
fi
73
73
74
+ # define output directory for .hex files
75
+ export ARDUINO_HEX_DIR=$HOME /compiled_arduino_sketches/arduino_build_$TRAVIS_BUILD_NUMBER
76
+
74
77
# link test library folder to the arduino libraries folder
75
78
ln -s $TRAVIS_BUILD_DIR $HOME /arduino_ide/libraries/Adafruit_Test_Library
76
79
@@ -345,11 +348,15 @@ function build_platform()
345
348
346
349
fi
347
350
351
+ # get the sketch name so we can place the generated files in the respective folder
352
+ local sketch_filename_with_ending=$( basename -- " $example " )
353
+ local sketch_filename=" ${sketch_filename_with_ending% .* } "
354
+ local build_path=$ARDUINO_HEX_DIR /$platform_key /$sketch_filename
348
355
# verify the example, and save stdout & stderr to a variable
349
356
# we have to avoid reading the exit code of local:
350
357
# "when declaring a local variable in a function, the local acts as a command in its own right"
351
358
local build_stdout
352
- build_stdout=$( arduino --verify $example 2>&1 )
359
+ build_stdout=$( arduino --verify --pref build.path= $build_path --preserve-temp-files $example 2>&1 )
353
360
354
361
# echo output if the build failed
355
362
if [ $? -ne 0 ]; then
You can’t perform that action at this time.
0 commit comments