1 name: Build pre-release
2 # Don't enable CI on push, just on PR. If you
3 # are working on the main repo and want to trigger
4 # a CI build submit a draft PR.
20 runs-on: ubuntu-latest
23 id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
26 - uses: actions/checkout@v4
27 - name: Install dependencies
28 run: sudo apt-get update && sudo apt-get -y install ninja-build
29 - name: Setup environment
31 ACTIONS_ALLOW_UNSECURE_COMMANDS: true
33 # This is the hash of the commit for the PR
34 # when the action is triggered by PR, empty otherwise
35 COMMIT_ID=${{ github.event.pull_request.head.sha }}
36 # This is the hash of the commit when triggered by push
37 # but the hash of refs/pull/<n>/merge, which is different
38 # from the hash of the latest commit in the PR, that's
39 # why we try github.event.pull_request.head.sha first
40 COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
41 BUILD_SUFFIX=dev-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
42 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/^[ \t]+|[ \t\)]+$/, "", $2); print $2 }')
43 echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
44 echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
45 echo "NUM_CORES=$(grep processor /proc/cpuinfo | wc -l)" >> $GITHUB_ENV
46 - uses: actions/cache@v4
49 key: ${{ runner.os }}-downloads-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('**/cmake/*')}}
50 - name: Build targets (${{ matrix.id }})
51 run: mkdir -p build && cd build && cmake -DWARNINGS_AS_ERRORS=ON -DCI_JOB_INDEX=${{ matrix.id }} -DCI_JOB_COUNT=${{ strategy.job-total }} -DBUILD_SUFFIX=${{ env.BUILD_SUFFIX }} -DVERSION_TYPE=dev -G Ninja .. && ninja -j${{ env.NUM_CORES }} ci
52 - name: Upload artifacts
53 uses: actions/upload-artifact@v4
55 name: ${{ env.BUILD_NAME }}.${{ matrix.id }}
59 runs-on: ubuntu-latest
61 - uses: actions/checkout@v4
62 - name: Install dependencies
63 run: sudo apt-get update && sudo apt-get -y install ninja-build
64 - name: Setup environment
66 ACTIONS_ALLOW_UNSECURE_COMMANDS: true
68 # This is the hash of the commit for the PR
69 # when the action is triggered by PR, empty otherwise
70 COMMIT_ID=${{ github.event.pull_request.head.sha }}
71 # This is the hash of the commit when triggered by push
72 # but the hash of refs/pull/<n>/merge, which is different
73 # from the hash of the latest commit in the PR, that's
74 # why we try github.event.pull_request.head.sha first
75 COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
76 BUILD_SUFFIX=dev-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
77 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }')
78 echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
79 echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
80 echo "NUM_CORES=$(grep processor /proc/cpuinfo | wc -l)" >> $GITHUB_ENV
82 run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja -DVERSION_TYPE=dev .. && ninja -j${{ env.NUM_CORES }}
83 - name: Upload artifacts
84 uses: actions/upload-artifact@v4
86 name: sitl-${{ env.BUILD_NAME }}-Linux
87 path: ./build_SITL/*_SITL
92 - uses: actions/checkout@v4
93 - name: Install dependencies
95 brew install cmake ninja ruby
97 - name: Setup environment
99 ACTIONS_ALLOW_UNSECURE_COMMANDS: true
101 # This is the hash of the commit for the PR
102 # when the action is triggered by PR, empty otherwise
103 COMMIT_ID=${{ github.event.pull_request.head.sha }}
104 # This is the hash of the commit when triggered by push
105 # but the hash of refs/pull/<n>/merge, which is different
106 # from the hash of the latest commit in the PR, that's
107 # why we try github.event.pull_request.head.sha first
108 COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
109 BUILD_SUFFIX=dev-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
110 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }')
111 echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
112 echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
115 mkdir -p build_SITL && cd build_SITL
116 cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DVERSION_TYPE=dev -G Ninja ..
119 - name: Upload artifacts
120 uses: actions/upload-artifact@v4
122 name: sitl-${{ env.BUILD_NAME }}-MacOS
123 path: ./build_SITL/*_SITL
126 runs-on: windows-latest
129 shell: C:\tools\cygwin\bin\bash.exe -o igncr '{0}'
131 - uses: actions/checkout@v4
133 uses: egor-tensin/setup-cygwin@v4
135 packages: cmake ruby ninja gcc-g++
136 - name: Setup environment
138 ACTIONS_ALLOW_UNSECURE_COMMANDS: true
140 # This is the hash of the commit for the PR
141 # when the action is triggered by PR, empty otherwise
142 COMMIT_ID=${{ github.event.pull_request.head.sha }}
143 # This is the hash of the commit when triggered by push
144 # but the hash of refs/pull/<n>/merge, which is different
145 # from the hash of the latest commit in the PR, that's
146 # why we try github.event.pull_request.head.sha first
147 COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
148 BUILD_SUFFIX=dev-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
149 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }')
150 #echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
151 #echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
152 #echo "VERSION_TAG=-$(date '+%Y%m%d')" >> $GITHUB_ENV
153 echo "version=${VERSION}" >> $GITHUB_OUTPUT
155 run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -DVERSION_TYPE=dev -G Ninja .. && ninja -j4
156 - name: Upload artifacts
157 uses: actions/upload-artifact@v4
159 name: sitl-${{ env.BUILD_NAME }}-WIN
160 path: ./build_SITL/*.exe
164 runs-on: ubuntu-latest
166 - uses: actions/checkout@v4
167 - name: Install dependencies
168 run: sudo apt-get update && sudo apt-get -y install ninja-build
170 run: mkdir -p build && cd build && cmake -DTOOLCHAIN=none -G Ninja .. && ninja check
173 needs: [build, build-SITL-Linux, build-SITL-Mac, build-SITL-Windows, test]
174 runs-on: ubuntu-latest
176 - uses: actions/checkout@v4
180 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }')
181 echo "version=${VERSION}" >> $GITHUB_OUTPUT
182 - name: Get current date
184 run: echo "today=$(date '+%Y%m%d')" >> $GITHUB_OUTPUT
185 - name: download artifacts
186 uses: actions/download-artifact@v4
191 - name: download sitl linux
192 uses: actions/download-artifact@v4
194 path: resources/sitl/linux
195 pattern: sitl-*-Linux
197 - name: download sitl windows
198 uses: actions/download-artifact@v4
200 path: resources/sitl/windows
203 - name: download sitl mac
204 uses: actions/download-artifact@v4
206 path: resources/sitl/macos
207 pattern: sitl-*-MacOS
209 - name: Consolidate sitl files
211 zip -r -9 sitl-resources.zip resources/
212 - name: Upload release artifacts
213 uses: softprops/action-gh-release@v2
215 name: inav-${{ steps.version.outputs.version }}-dev-${{ steps.date.outputs.today }}-${{ github.run_number }}-${{ github.sha }}
216 tag_name: v${{ steps.version.outputs.version }}-${{ steps.date.outputs.today }}.${{ github.run_number }}
217 # To create release on a different repo, we need a token setup
218 token: ${{ secrets.NIGHTLY_TOKEN }}
219 repository: iNavFlight/inav-nightly
222 #generate_release_notes: true
228 ${{ steps.notes.outputs.notes }}
231 These are nightly builds and configuration settings can be added and removed often. Flashing with Full chip erase is strongly recommended to avoid issues.
232 Firmware related issues should be opened in the iNavflight/inav repository, not in inav-nightly.
235 ${{ github.repository }} ([link](${{ github.event.repository.html_url }}))
238 ${{ github.ref_name }} ([link](${{ github.event.repository.html_url }}/tree/${{ github.ref_name }}))
240 ### Latest changeset:
241 ${{ github.event.head_commit.id }} ([link](${{ github.event.head_commit.url }}))
244 ${{ github.event.head_commit.message }}