forked from letscontrolit/ESPEasy
-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (148 loc) · 4.82 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Checks whether the pushed commit can be build with PIO. Only triggered on normal push to the mega branch without tag and with pull requests targeting mega
name: Build
on:
push:
branches: [mega]
tags-ignore: '**'
paths-ignore:
- 'dist/Release_notes.txt'
pull_request:
branches: [mega]
permissions:
contents: read
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
documentation:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-docs-${{ hashFiles('docs/requirements.txt') }}
- name: Build documentation
run: |
cd docs
sudo apt install imagemagick zip
pip install -r requirements.txt
make html
cd ..
zip -r -qq ESPEasy_docs.zip docs/build/*
- uses: actions/upload-artifact@v3
with:
name: Documentation
path: ESPEasy_docs.zip
generate-matrix:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- id: set-matrix
run: |
pip install platformio
python tools/ci/generate-matrix.py
build:
needs: generate-matrix
runs-on: ubuntu-22.04
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ hashFiles('requirements.txt') }}
- uses: actions/cache@v3
if: ${{ contains(matrix.env, 'esp32') }}
with:
path: ~/.platformio
key: ${{ runner.os }}-esp32-${{ hashFiles('platformio*.ini') }}
- uses: actions/cache@v3
if: ${{ contains(matrix.env, 'esp8266') }}
with:
path: ~/.platformio
key: ${{ runner.os }}-esp8266-${{ hashFiles('platformio*.ini') }}
- name: Dependencies
run: |
sudo apt-get update
sudo apt install binutils build-essential libffi-dev libgit2-dev
pip3 install --upgrade pip
pip install -r requirements.txt
platformio update
- name: Build and archive
id: build-and-archive
env:
CHIP: ${{ matrix.chip }}
ENV: ${{ matrix.env }}
run: |
python tools/ci/build-and-archive.py
- uses: actions/upload-artifact@v3
with:
name: Binaries
path: |
bin
if-no-files-found: ignore
# Repackage separately for ESP82xx and ESP32
repackage:
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-docs-${{ hashFiles('docs/requirements.txt') }}
- name: Get current date
id: date
run: |
echo "builddate=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v3
with:
path: artifacts/
- name: Prepare artifacts
run: |
mkdir ESPEasy_dist_ESP82xx
mkdir ESPEasy_dist_ESP32
cd dist
find . -exec cp -r --parents {} ../ESPEasy_dist_ESP82xx/ \;
find . -exec cp -r --parents {} ../ESPEasy_dist_ESP32/ \;
cd ..
cd ESPEasy_dist_ESP32
rm ESP.Easy.Flasher.exe bin/blank_1MB.bin bin/blank_2MB.bin bin/ESPEasy_2step_UploaderMega_1024.bin
cd ..
cd artifacts/Binaries
find . -not -name '*ESP32*' -exec mv {} ../../ESPEasy_dist_ESP82xx/bin/ \;
find . -name '*ESP32*' -exec mv {} ../../ESPEasy_dist_ESP32/bin/ \;
cd ../..
- uses: actions/upload-artifact@v3
with:
name: ESPEasy_mega_${{ steps.date.outputs.builddate }}_ESP32_PR#${{ github.event.number }}_${{ github.run_id }}
path: |
ESPEasy_dist_ESP32/*
if-no-files-found: ignore
- uses: actions/upload-artifact@v3
with:
name: ESPEasy_mega_${{ steps.date.outputs.builddate }}_ESP82xx_PR#${{ github.event.number }}_${{ github.run_id }}
path: |
ESPEasy_dist_ESP82xx/*
if-no-files-found: ignore
# When successfully re-packaged, the original Binaries can be removed
# comment below 3 lines to not remove the Binaries artifact after repackaging
- uses: geekyeggo/delete-artifact@v2
with:
name: Binaries