forked from wled/WLED
-
-
Notifications
You must be signed in to change notification settings - Fork 133
104 lines (98 loc) · 3.74 KB
/
build.yml
File metadata and controls
104 lines (98 loc) · 3.74 KB
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
name: PlatformIO CI
# Only included into other workflows
on:
workflow_call:
inputs:
nightly_build:
description: 'Flag to indicate this is a nightly build'
required: false
type: boolean
default: false
jobs:
get_default_envs:
name: Gather Environments
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install PlatformIO
run: pip install -r requirements.txt
- name: Get default environments
id: envs
run: |
echo "environments=$(pio project config --json-output | jq -cr '.[0][1][0][1]')" >> $GITHUB_OUTPUT
outputs:
environments: ${{ steps.envs.outputs.environments }}
build:
name: Builds
runs-on: ubuntu-22.04
needs: get_default_envs
strategy:
fail-fast: false
matrix:
environment: ${{ fromJSON(needs.get_default_envs.outputs.environments) }}
steps:
- uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ matrix.environment}}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install PlatformIO
run: pip install -r requirements.txt
- name: Build firmware
env:
WLED_RELEASE: True
WLED_NIGHTLY_BUILD: ${{ inputs.nightly_build && 'true' || 'false' }}
run: pio run -e ${{ matrix.environment }}
- name: Collect firmware files
run: |
mkdir -p artifact-${{ matrix.environment }}
cp .pio/build/${{ matrix.environment }}/firmware.bin artifact-${{ matrix.environment }}/firmware.bin
# partitions.bin is only produced by ESP32 builds (not ESP8266)
if [ -f .pio/build/${{ matrix.environment }}/partitions.bin ]; then
cp .pio/build/${{ matrix.environment }}/partitions.bin artifact-${{ matrix.environment }}/partitions.bin
fi
# bootloader.bin is only produced by ESP32 builds using arduino-esp32 >= 2.x (not ESP8266, not old 1.0.x)
if [ -f .pio/build/${{ matrix.environment }}/bootloader.bin ]; then
cp .pio/build/${{ matrix.environment }}/bootloader.bin artifact-${{ matrix.environment }}/bootloader.bin
fi
# boot_app0.bin is copied to the build dir by output_bins.py using the PlatformIO platform API (ESP32 only)
if [ -f .pio/build/${{ matrix.environment }}/boot_app0.bin ]; then
cp .pio/build/${{ matrix.environment }}/boot_app0.bin artifact-${{ matrix.environment }}/boot_app0.bin
fi
echo "--- Collected files for ${{ matrix.environment }} ---"
ls -la artifact-${{ matrix.environment }}/
# Create a zip with all collected files for use as a release asset
(cd artifact-${{ matrix.environment }} && zip ../firmware-${{ matrix.environment }}.zip *)
- uses: actions/upload-artifact@v4
with:
name: firmware-${{ matrix.environment }}
path: artifact-${{ matrix.environment }}/
- uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/') || inputs.nightly_build
with:
name: firmware-release-${{ matrix.environment }}
path: |
build_output/release/*.bin
firmware-${{ matrix.environment }}.zip