Merge pull request #1269 from pkendall64/crsf-max-output
[ExpressLRS.git] / .github / workflows / build.yml
blob907e741781ccccd4e6a027814e14c1f304aab996
1 name: Build ExpressLRS
2 on: [push, pull_request]
3 jobs:
4   test:
5     runs-on: ubuntu-latest
6     steps:
8     - name: Inject slug/short variables
9       uses: rlespinasse/github-slug-action@v3.x
11     - name: Checkout
12       uses: actions/checkout@v2
14     - name: Set up Python
15       uses: actions/setup-python@v1
17     - name: Cache pip
18       uses: actions/cache@v2
19       with:
20         path: ~/.cache/pip
21         key: ${{ runner.os }}-pip-${{ matrix.target }}
23     - name: Install PlatformIO
24       run: |
25         python -m pip install --upgrade pip
26         pip install platformio
28     - name: Cache PlatformIO
29       uses: actions/cache@v2
30       with:
31         path: ~/.platformio
32         key: ${{ runner.os }}-platformio
34     - name: Run PlatformIO Tests
35       run: |
36         platformio platform install native
37         platformio platform update
38         cd src
39         PLATFORMIO_BUILD_FLAGS="-DRegulatory_Domain_ISM_2400" pio test -e native
41   targets:
42     runs-on: ubuntu-latest
43     outputs:
44       targets: ${{ steps.set-targets.outputs.targets }}
45     steps:
46     - name: Checkout
47       uses: actions/checkout@v2
48     - id: set-targets
49       run: echo "::set-output name=targets::[$(grep -r "\[env:" src/targets | sed 's/.*://' | sed s/.$// | egrep "(STLINK|UART)" | grep -v DEPRECATED | tr '\n' ','  | sed 's/,$/"\n/' | sed 's/,/","/'g | sed 's/^/"/')]"
51   build:
52     needs: targets
53     strategy:
54       fail-fast: false
55       matrix:
56         target: ${{fromJSON(needs.targets.outputs.targets)}}
57     runs-on: ubuntu-latest
58     steps:
60     - name: Inject slug/short variables
61       uses: rlespinasse/github-slug-action@v3.x
63     - name: Checkout
64       uses: actions/checkout@v2
66     - name: Set up Python
67       uses: actions/setup-python@v1
69     - name: Cache pip
70       uses: actions/cache@v2
71       with:
72         path: ~/.cache/pip
73         key: ${{ runner.os }}-pip-${{ matrix.target }}
75     - name: Install PlatformIO
76       run: |
77         python -m pip install --upgrade pip
78         pip install platformio
80     - name: Cache PlatformIO
81       uses: actions/cache@v2
82       with:
83         path: ~/.platformio
84         key: ${{ runner.os }}-platformio
86     - name: Run PlatformIO
87       run: |
88         platformio platform update
89         platformio platform install native
90         mkdir -p ~/artifacts
91         cd src
92         case ${{matrix.target}} in
93           *2400* | FM30*)
94             export REG=-DRegulatory_Domain_ISM_2400
95             ;;
96           *)
97             export REG=-DRegulatory_Domain_AU_915
98             ;;
99         esac
100         # All the features
101         PLATFORMIO_BUILD_FLAGS="$REG -DUSE_DIVERSITY" pio run -e ${{ matrix.target }}
102         # Minimal/default features
103         PLATFORMIO_BUILD_FLAGS="$REG !-DUSE_DIVERSITY" pio run -e ${{ matrix.target }}
104         mv .pio/build ~/artifacts/AU_915
106     - name: Store Artifacts
107       uses: actions/upload-artifact@v2-preview
108       with:
109         name: ExpressLRS-${{ env.GITHUB_REF_SLUG_URL }}-${{ github.run_number }}
110         path: ~/artifacts/**/*.bin
111       continue-on-error: true