-
Notifications
You must be signed in to change notification settings - Fork 833
74 lines (69 loc) · 1.92 KB
/
Build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
Gen_Matrix:
outputs:
matrix: ${{ steps.files.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Generate Matrix of all examples
id: files
run: |
JSONI=$(find . -name platformio.ini -type f | sed 's,/platformio.ini$,,' | xargs -n 1 -I {} echo -e '"{}",')
# Remove last "," and add closing brackets
if [[ $JSONI == *, ]]; then
JSONI="${JSONI%?}"
fi
JSONI=${JSONI//$'\n'}
echo $JSONI
# Set output
echo "::set-output name=matrix::[${JSONI}]"
Build_Example:
needs: Gen_Matrix
runs-on: ubuntu-latest
strategy:
matrix:
project: ${{fromJson(needs.Gen_Matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v2
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/platformio.ini') }}
- name: Cache PlatformIO build
uses: actions/cache@v2
with:
path: .pio
key: pio-${{ runner.os }}-${{ matrix.project }}
restore-keys: |
pio-${{ runner.os }}-
pio-
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Build example
env:
PLATFORMIO_BUILD_CACHE_DIR: "../../.pio/buildcache"
run: pio run --jobs 2 --project-dir ${{ matrix.project }}
Build_Examples:
needs: Build_Example
runs-on: ubuntu-latest
steps:
- name: done
run: echo ok