@@ -3,28 +3,47 @@ name: Base workflow for compile
33on :
44 workflow_call :
55 inputs :
6+ # name of the particle platform
67 platform :
78 required : true
89 type : string
10+ # target version to compile for
911 version :
1012 required : true
1113 type : string
14+ # name of the program
15+ program :
16+ required : true
17+ type : string
18+ # path to the program folder
1219 src :
1320 required : true
1421 type : string
22+ # optional path(s) to libraries to be included
1523 lib :
1624 required : false
1725 type : string
26+ # optional path(s) to specific resources to include in addition
1827 aux :
1928 required : false
2029 type : string
30+ # program sub folder name where the src files are kept, default is usually correct
31+ src_sub_folder :
32+ required : false
33+ type : string
34+ default : " /src"
35+ # libs sub folder name where the src files are kept, default is usually correct
36+ lib_sub_folder :
37+ required : false
38+ type : string
39+ default : " /src"
2140
2241
2342jobs :
2443 compile :
2544 runs-on : ubuntu-latest
2645
27- name : ${{ inputs.src }}-${{ inputs.platform }}-${{ inputs.version }}
46+ name : ${{ inputs.program }}-${{ inputs.platform }}-${{ inputs.version }}
2847
2948 steps :
3049 - name : Checkout code
@@ -35,25 +54,25 @@ jobs:
3554 - name : Gather application sources
3655 run : |
3756 echo "Creating temporary source directory"
38- mkdir ${{ inputs.src }}
39- echo "Including sources from src/ ${{ inputs.src }}"
40- mv src/ ${{ inputs.src }}/* ${{ inputs.src }}
57+ mkdir ${{ inputs.program }}
58+ echo "Including sources from ${{ inputs.src }}${{ inputs.src_sub_folder }}"
59+ mv ${{ inputs.src }}${{ inputs.src_sub_folder }} /* ${{ inputs.program }}
4160 echo "Including libraries:"
4261 for lib in ${{ inputs.lib }}; do
43- if [ -d "$lib" ]; then
44- echo " - $lib/*"
45- mv $lib/* ${{ inputs.src }}
46- elif [ -d "lib/$lib" ]; then
47- echo " - lib/$lib/*"
48- mv lib/$lib/* ${{ inputs.src }}
62+ if [ -d "$lib${{ inputs.lib_sub_folder }} " ]; then
63+ echo " - $lib${{ inputs.lib_sub_folder }} /*"
64+ mv $lib${{ inputs.lib_sub_folder }} /* ${{ inputs.program }}
65+ elif [ -d "lib/$lib${{ inputs.lib_sub_folder }} " ]; then
66+ echo " - lib/$lib${{ inputs.lib_sub_folder }} /*"
67+ mv lib/$lib${{ inputs.lib_sub_folder }} /* ${{ inputs.program }}
4968 else
50- echo " - could not find $lib, make sure the folder exists"
69+ echo " - could not find $lib${{ inputs.lib_sub_folder }} , make sure the folder exists"
5170 fi
5271 done
5372 echo "Including auxiliary resources:"
5473 for aux in ${{ inputs.aux }}; do
5574 echo " - $aux"
56- mv $aux ${{ inputs.src }}
75+ mv $aux ${{ inputs.program }}
5776 done
5877
5978 - name : Compile in cloud (on master)
@@ -64,12 +83,12 @@ jobs:
6483 particle-access-token : ${{ secrets.PARTICLE_ACCESS_TOKEN }}
6584 particle-platform-name : ${{ inputs.platform }}
6685 device-os-version : ${{ inputs.version }}
67- sources-folder : ${{ inputs.src }}
86+ sources-folder : ${{ inputs.program }}
6887
6988 - name : Move cloud binary
7089 if : ${{ github.ref == 'refs/heads/master' }}
7190 run : |
72- mv ${{ steps.compile.outputs.firmware-path }} ${{ inputs.src }}/${{ inputs.src }}-${{ inputs.platform }}-${{ inputs.version }}.bin
91+ mv ${{ steps.compile.outputs.firmware-path }} ${{ inputs.program }}/${{ inputs.program }}-${{ inputs.platform }}-${{ inputs.version }}.bin
7392
7493 - name : Compile locally # if not on master or if cloud compile failed
7594 if : ${{ failure() || github.ref != 'refs/heads/master' }}
@@ -78,15 +97,15 @@ jobs:
7897 with :
7998 particle-platform-name : ${{ inputs.platform }}
8099 device-os-version : ${{ inputs.version }}
81- sources-folder : ${{ inputs.src }}
100+ sources-folder : ${{ inputs.program }}
82101
83102 - name : Move local binary
84103 if : ${{ github.ref != 'refs/heads/master' }}
85104 run : |
86- mv ${{ steps.localcompile.outputs.firmware-path }} ${{ inputs.src }}/${{ inputs.src }}-${{ inputs.platform }}-${{ inputs.version }}.bin
105+ mv ${{ steps.localcompile.outputs.firmware-path }} ${{ inputs.program }}/${{ inputs.program }}-${{ inputs.platform }}-${{ inputs.version }}.bin
87106
88107 - name : Upload binary
89108 uses : actions/upload-artifact@v4
90109 with :
91- name : ${{ inputs.src }}-${{ inputs.platform }}-${{ inputs.version }}
92- path : ${{ inputs.src }}
110+ name : ${{ inputs.program }}-${{ inputs.platform }}-${{ inputs.version }}
111+ path : ${{ inputs.program }}
0 commit comments