CONFIG: define BMI270 for ATOMRCF405 (#12536)
[betaflight.git] / .github / workflows / ci.yml
blobd811dc242ac8ea4db904b80f17c047968c701879
1 # Builds Betaflight Firmware.
4 name: CI
6 on: 
7   workflow_call:
8     inputs:
9       release_build:
10         description: 'Specifies if it is a build that should include commit hash in hex file names or not'
11         default: false
12         required: false
13         type: boolean
15 jobs:
16   setup:
17     name: Setup
18     runs-on: ubuntu-22.04
19     outputs:
20       targets: ${{ steps.get-targets.outputs.targets }}
21     steps:
22       - uses: actions/checkout@v3
24       - name: Get all official build targets
25         id: get-targets
26         run: echo "targets=$(make targets-ci-print | jq -R -c 'split(" ")')" >> $GITHUB_OUTPUT
27       - name: Cache build toolchain
28         uses: actions/cache@v3
29         id: cache-toolchain
30         with:
31           path: tools
32           key: ${{ runner.os }}-${{ hashFiles('make/tools.mk') }}
34       - name: Download and install toolchain
35         if: steps.cache-toolchain.outputs.cache-hit != 'true'
36         run: make arm_sdk_install
38   build:
39     name: Build
40     needs: setup
41     runs-on: ubuntu-22.04
42     strategy:
43       matrix:
44         target: ${{ fromJson(needs.setup.outputs.targets) }}
45     steps:
46       - name: Checkout code
47         uses: actions/checkout@v3
49       - name: Fetch toolchain from cache
50         uses: actions/cache@v3
51         id: cache-toolchain
52         with:
53           path: tools
54           key: ${{ runner.os }}-${{ hashFiles('make/tools.mk') }}
56       - name: Build target (without revision)
57         if: inputs.release_build == true
58         run: make EXTRA_FLAGS=-Werror ${{ matrix.target }}
59         
60       - name: Build target (with revision)
61         if: inputs.release_build == false
62         run: make EXTRA_FLAGS=-Werror ${{ matrix.target }}_rev
64       - name: Publish build artifacts
65         uses: actions/upload-artifact@v3
66         with:
67           name: Assets
68           path: obj/*.hex
69           retention-days: 60
71   test:
72     name: Test
73     runs-on: ubuntu-22.04
74     steps:
75       - uses: actions/checkout@v3
77       - name: Install dependencies
78         run: sudo apt-get install -y libblocksruntime-dev
80       - name: Run sanity checks
81         run: make EXTRA_FLAGS=-Werror checks
83       - name: Run all unit tests
84         run: make EXTRA_FLAGS=-Werror test-all
86   result:
87     name: Complete
88     needs: [build, test]
89     if: ${{ always() }}
90     runs-on: ubuntu-22.04
91     steps:
92       - name: Check build matrix result
93         if: ${{ needs.build.result != 'success' }}
94         run: exit 1
96       - name: Check test result
97         if: ${{ needs.test.result != 'success' }}
98         run: exit 1