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, 15, 16]
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 - uses: actions/cache@v4
48 key: ${{ runner.os }}-downloads-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('**/cmake/*')}}
49 - name: Build targets (${{ matrix.id }})
50 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 ci
51 - name: Upload artifacts
52 uses: actions/upload-artifact@v4
54 name: ${{ env.BUILD_NAME }}.${{ matrix.id }}
58 runs-on: ubuntu-latest
60 - uses: actions/checkout@v4
61 - name: Install dependencies
62 run: sudo apt-get update && sudo apt-get -y install ninja-build
63 - name: Setup environment
65 ACTIONS_ALLOW_UNSECURE_COMMANDS: true
67 # This is the hash of the commit for the PR
68 # when the action is triggered by PR, empty otherwise
69 COMMIT_ID=${{ github.event.pull_request.head.sha }}
70 # This is the hash of the commit when triggered by push
71 # but the hash of refs/pull/<n>/merge, which is different
72 # from the hash of the latest commit in the PR, that's
73 # why we try github.event.pull_request.head.sha first
74 COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
75 BUILD_SUFFIX=dev-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
76 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }')
77 echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
78 echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
80 run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja -DVERSION_TYPE=dev .. && ninja
81 - name: Upload artifacts
82 uses: actions/upload-artifact@v4
84 name: sitl-${{ env.BUILD_NAME }}-Linux
85 path: ./build_SITL/*_SITL
90 - uses: actions/checkout@v4
91 - name: Install dependencies
93 brew install cmake ninja ruby
95 - name: Setup environment
97 ACTIONS_ALLOW_UNSECURE_COMMANDS: true
99 # This is the hash of the commit for the PR
100 # when the action is triggered by PR, empty otherwise
101 COMMIT_ID=${{ github.event.pull_request.head.sha }}
102 # This is the hash of the commit when triggered by push
103 # but the hash of refs/pull/<n>/merge, which is different
104 # from the hash of the latest commit in the PR, that's
105 # why we try github.event.pull_request.head.sha first
106 COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
107 BUILD_SUFFIX=dev-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
108 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }')
109 echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
110 echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
113 mkdir -p build_SITL && cd build_SITL
114 cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DVERSION_TYPE=dev -G Ninja ..
117 - name: Upload artifacts
118 uses: actions/upload-artifact@v4
120 name: sitl-${{ env.BUILD_NAME }}-MacOS
121 path: ./build_SITL/*_SITL
124 runs-on: windows-latest
127 shell: C:\tools\cygwin\bin\bash.exe -o igncr '{0}'
129 - uses: actions/checkout@v4
131 uses: egor-tensin/setup-cygwin@v4
133 packages: cmake ruby ninja gcc-g++
134 - name: Setup environment
136 ACTIONS_ALLOW_UNSECURE_COMMANDS: true
138 # This is the hash of the commit for the PR
139 # when the action is triggered by PR, empty otherwise
140 COMMIT_ID=${{ github.event.pull_request.head.sha }}
141 # This is the hash of the commit when triggered by push
142 # but the hash of refs/pull/<n>/merge, which is different
143 # from the hash of the latest commit in the PR, that's
144 # why we try github.event.pull_request.head.sha first
145 COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
146 BUILD_SUFFIX=dev-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
147 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }')
148 #echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
149 #echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
150 #echo "VERSION_TAG=-$(date '+%Y%m%d')" >> $GITHUB_ENV
151 echo "version=${VERSION}" >> $GITHUB_OUTPUT
153 run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -DVERSION_TYPE=dev -G Ninja .. && ninja
154 - name: Upload artifacts
155 uses: actions/upload-artifact@v4
157 name: sitl-${{ env.BUILD_NAME }}-WIN
158 path: ./build_SITL/*.exe
162 runs-on: ubuntu-latest
164 - uses: actions/checkout@v4
165 - name: Install dependencies
166 run: sudo apt-get update && sudo apt-get -y install ninja-build
168 run: mkdir -p build && cd build && cmake -DTOOLCHAIN=none -G Ninja .. && ninja check
171 needs: [build, build-SITL-Linux, build-SITL-Mac, build-SITL-Windows, test]
172 runs-on: ubuntu-latest
174 - uses: actions/checkout@v4
178 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }')
179 echo "version=${VERSION}" >> $GITHUB_OUTPUT
180 - name: Get current date
182 run: echo "today=$(date '+%Y%m%d')" >> $GITHUB_OUTPUT
183 - name: download artifacts
184 uses: actions/download-artifact@v4
189 - name: download sitl linux
190 uses: actions/download-artifact@v4
192 path: resources/sitl/linux
193 pattern: sitl-*-Linux
195 - name: download sitl windows
196 uses: actions/download-artifact@v4
198 path: resources/sitl/windows
201 - name: download sitl mac
202 uses: actions/download-artifact@v4
204 path: resources/sitl/macos
205 pattern: sitl-*-MacOS
207 - name: Consolidate sitl files
209 zip -r -9 sitl-resources.zip resources/
210 - name: Upload release artifacts
211 uses: softprops/action-gh-release@v2
213 name: inav-${{ steps.version.outputs.version }}-dev-${{ steps.date.outputs.today }}-${{ github.run_number }}-${{ github.sha }}
214 tag_name: v${{ steps.version.outputs.version }}-${{ steps.date.outputs.today }}.${{ github.run_number }}
215 # To create release on a different repo, we need a token setup
216 token: ${{ secrets.NIGHTLY_TOKEN }}
217 repository: iNavFlight/inav-nightly
220 #generate_release_notes: true
226 ${{ steps.notes.outputs.notes }}
229 These are nightly builds and configuration settings can be added and removed often. Flashing with Full chip erase is strongly recommended to avoid issues.
230 Firmware related issues should be opened in the iNavflight/inav repository, not in inav-nightly.
233 ${{ github.repository }} ([link](${{ github.event.repository.html_url }}))
236 ${{ github.ref_name }} ([link](${{ github.event.repository.html_url }}/tree/${{ github.ref_name }}))
238 ### Latest changeset:
239 ${{ github.event.head_commit.id }} ([link](${{ github.event.head_commit.url }}))
242 ${{ github.event.head_commit.message }}