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.
18 runs-on: ubuntu-latest
21 id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
24 - uses: actions/checkout@v4
25 - name: Install dependencies
26 run: sudo apt-get update && sudo apt-get -y install ninja-build
27 - name: Setup environment
29 ACTIONS_ALLOW_UNSECURE_COMMANDS: true
31 # This is the hash of the commit for the PR
32 # when the action is triggered by PR, empty otherwise
33 COMMIT_ID=${{ github.event.pull_request.head.sha }}
34 # This is the hash of the commit when triggered by push
35 # but the hash of refs/pull/<n>/merge, which is different
36 # from the hash of the latest commit in the PR, that's
37 # why we try github.event.pull_request.head.sha first
38 COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
39 BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
40 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/^[ \t]+|[ \t\)]+$/, "", $2); print $2 }')
41 echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
42 echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
43 - uses: actions/cache@v4
46 key: ${{ runner.os }}-downloads-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('**/cmake/*')}}
47 - name: Build targets (${{ matrix.id }})
48 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 }} -DMAIN_COMPILE_OPTIONS=-pipe -G Ninja .. && ninja -j4 ci
49 - name: Upload artifacts
50 uses: actions/upload-artifact@v4
52 name: matrix-${{ env.BUILD_NAME }}.${{ matrix.id }}
57 runs-on: ubuntu-latest
60 - uses: actions/checkout@v4
61 - name: Setup environment
63 ACTIONS_ALLOW_UNSECURE_COMMANDS: true
65 # This is the hash of the commit for the PR
66 # when the action is triggered by PR, empty otherwise
67 COMMIT_ID=${{ github.event.pull_request.head.sha }}
68 # This is the hash of the commit when triggered by push
69 # but the hash of refs/pull/<n>/merge, which is different
70 # from the hash of the latest commit in the PR, that's
71 # why we try github.event.pull_request.head.sha first
72 COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
73 BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
74 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/^[ \t]+|[ \t\)]+$/, "", $2); print $2 }')
75 echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
76 echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
77 - name: Download artifacts
78 uses: actions/download-artifact@v4
80 pattern: matrix-inav-*
83 - name: Build target list
85 ls -1 binaries/*.hex | cut -d/ -f2 > targets.txt
86 - name: Upload firmware images
87 uses: actions/upload-artifact@v4
89 name: ${{ env.BUILD_NAME }}
91 - name: Upload firmware images
92 uses: actions/upload-artifact@v4
98 runs-on: ubuntu-latest
100 - uses: actions/checkout@v4
101 - name: Install dependencies
102 run: sudo apt-get update && sudo apt-get -y install ninja-build
103 - name: Setup environment
105 ACTIONS_ALLOW_UNSECURE_COMMANDS: true
107 # This is the hash of the commit for the PR
108 # when the action is triggered by PR, empty otherwise
109 COMMIT_ID=${{ github.event.pull_request.head.sha }}
110 # This is the hash of the commit when triggered by push
111 # but the hash of refs/pull/<n>/merge, which is different
112 # from the hash of the latest commit in the PR, that's
113 # why we try github.event.pull_request.head.sha first
114 COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
115 BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
116 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/^[ \t]+|[ \t\)]+$/, "", $2); print $2 }')
117 echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
118 echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
120 run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja -j4
121 - name: Upload artifacts
122 uses: actions/upload-artifact@v4
124 name: ${{ env.BUILD_NAME }}_SITL-Linux
125 path: ./build_SITL/*_SITL
128 runs-on: macos-latest
130 - uses: actions/checkout@v4
131 - name: Install dependencies
133 brew install cmake ninja ruby
135 - name: Setup environment
137 ACTIONS_ALLOW_UNSECURE_COMMANDS: true
139 # This is the hash of the commit for the PR
140 # when the action is triggered by PR, empty otherwise
141 COMMIT_ID=${{ github.event.pull_request.head.sha }}
142 # This is the hash of the commit when triggered by push
143 # but the hash of refs/pull/<n>/merge, which is different
144 # from the hash of the latest commit in the PR, that's
145 # why we try github.event.pull_request.head.sha first
146 COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
147 BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
148 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/^[ \t]+|[ \t\)]+$/, "", $2); print $2 }')
149 echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
150 echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
153 mkdir -p build_SITL && cd build_SITL
154 cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -G Ninja ..
157 - name: Upload artifacts
158 uses: actions/upload-artifact@v4
160 name: ${{ env.BUILD_NAME }}_SITL-MacOS
161 path: ./build_SITL/*_SITL
164 runs-on: windows-latest
167 shell: C:\tools\cygwin\bin\bash.exe -o igncr '{0}'
169 - uses: actions/checkout@v4
171 uses: egor-tensin/setup-cygwin@v4
173 packages: cmake ruby ninja gcc-g++
174 - name: Setup environment
176 ACTIONS_ALLOW_UNSECURE_COMMANDS: true
178 # This is the hash of the commit for the PR
179 # when the action is triggered by PR, empty otherwise
180 COMMIT_ID=${{ github.event.pull_request.head.sha }}
181 # This is the hash of the commit when triggered by push
182 # but the hash of refs/pull/<n>/merge, which is different
183 # from the hash of the latest commit in the PR, that's
184 # why we try github.event.pull_request.head.sha first
185 COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
186 BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
187 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/^[ \t]+|[ \t\)]+$/, "", $2); print $2 }')
188 echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
189 echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
191 run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja -j4
192 - name: Upload artifacts
193 uses: actions/upload-artifact@v4
195 name: ${{ env.BUILD_NAME }}_SITL-WIN
196 path: ./build_SITL/*.exe
201 runs-on: ubuntu-latest
203 - uses: actions/checkout@v4
204 - name: Install dependencies
205 run: sudo apt-get update && sudo apt-get -y install ninja-build
207 run: mkdir -p build && cd build && cmake -DTOOLCHAIN=none -G Ninja .. && ninja check