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.
12 id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
15 - uses: actions/checkout@v3
16 - name: Install dependencies
17 run: sudo apt-get update && sudo apt-get -y install ninja-build
18 - name: Setup environment
20 ACTIONS_ALLOW_UNSECURE_COMMANDS: true
22 # This is the hash of the commit for the PR
23 # when the action is triggered by PR, empty otherwise
24 COMMIT_ID=${{ github.event.pull_request.head.sha }}
25 # This is the hash of the commit when triggered by push
26 # but the hash of refs/pull/<n>/merge, which is different
27 # from the hash of the latest commit in the PR, that's
28 # why we try github.event.pull_request.head.sha first
29 COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
30 BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
31 VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/^[ \t]+|[ \t\)]+$/, "", $2); print $2 }')
32 echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
33 echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
34 - uses: actions/cache@v1
37 key: ${{ runner.os }}-downloads-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('**/cmake/*')}}
38 - name: Build targets (${{ matrix.id }})
39 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 }} -G Ninja .. && ninja ci
40 - name: Upload artifacts
41 uses: actions/upload-artifact@v2-preview
43 name: ${{ env.BUILD_NAME }}.zip
48 runs-on: ubuntu-latest
50 - uses: actions/checkout@v3
51 - name: Install dependencies
52 run: sudo apt-get update && sudo apt-get -y install ninja-build
54 run: mkdir -p build && cd build && cmake -DTOOLCHAIN=none -G Ninja .. && ninja check