-
Notifications
You must be signed in to change notification settings - Fork 28
160 lines (136 loc) · 5.35 KB
/
compile_generics.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
156
157
158
159
160
name: Compile Generics
on:
release:
types: [published]
workflow_dispatch:
jobs:
build:
name: Build for ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
matrix:
target:
- esp32
- esp32s2
- esp32s3
- esp32c3
- esp32c6
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Cache ESP-IDF and Tools
uses: actions/cache@v3
with:
path: |
~/.espressif
~/.idf_tools
~/.cache/pip
key: ${{ runner.os }}-esp-idf-${{ matrix.target }}-${{ hashFiles('**/sdkconfig') }}
restore-keys: |
${{ runner.os }}-esp-idf-${{ matrix.target }}-
${{ runner.os }}-esp-idf-
${{ runner.os }}-
# Manual ESP-IDF Installation
- name: Install ESP-IDF
run: |
sudo apt-get update
sudo apt-get install -y wget git flex bison gperf python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util
git clone -b v5.3.1 --depth 1 https://github.com/espressif/esp-idf.git ~/esp-idf
~/esp-idf/install.sh
- name: Set Target
run: |
. ~/esp-idf/export.sh
idf.py set-target ${{ matrix.target }}
# Use sdkconfig instead of sdkconfig.defaults
- name: Apply Base sdkconfig
run: |
. ~/esp-idf/export.sh
cp sdkconfig sdkconfig.build
- name: Override Build Options
run: |
. ~/esp-idf/export.sh
idf.py set-config FLASH_SIZE 4MB
idf.py set-config CONFIG_COMPILER_OPTIMIZATION_SIZE=y
idf.py set-config PARTITION_TABLE_CUSTOM=y
idf.py set-config PARTITION_TABLE_FILENAME "partitions.csv"
idf.py set-config CONFIG_FATFS_LFN_ENABLED=y
idf.py set-config CONFIG_FATFS_LFN_CODE_PAGE=437
idf.py set-config CONFIG_FATFS_MAX_LFN=255
if [ "${{ matrix.target }}" = "esp32s2" ]; then
idf.py set-config CONFIG_BT_ENABLED=n
idf.py set-config CONFIG_BLUEDROID_ENABLED=n
idf.py set-config CONFIG_BLUETOOTH_ENABLED=n
idf.py set-config CONFIG_BLE_ENABLED=n
idf.py set-config CONFIG_BT_NIMBLE_ENABLED=n
else
idf.py set-config CONFIG_BT_ENABLED=y
idf.py set-config CONFIG_BLUEDROID_ENABLED=y
idf.py set-config CONFIG_BLUETOOTH_ENABLED=y
idf.py set-config CONFIG_BLE_ENABLED=y
idf.py set-config CONFIG_BT_NIMBLE_ENABLED=y
fi
idf.py set-config CONFIG_LV_FONT_MONTSERRAT_8=y
idf.py set-config CONFIG_LV_FONT_MONTSERRAT_10=y
idf.py set-config CONFIG_LV_FONT_MONTSERRAT_12=y
idf.py set-config CONFIG_LV_FONT_MONTSERRAT_14=y
idf.py set-config CONFIG_LV_FONT_MONTSERRAT_16=y
idf.py set-config CONFIG_LV_FONT_MONTSERRAT_18=y
idf.py set-config CONFIG_LV_FONT_MONTSERRAT_24=y
idf.py menuconfig --disableconfig
idf.py reconfigure
- name: Clean Build Environment
run: |
. ~/esp-idf/export.sh
idf.py fullclean
- name: Build Project
run: |
. ~/esp-idf/export.sh
idf.py build
- name: Package Build Artifacts
run: |
. ~/esp-idf/export.sh
mkdir -p packaged_artifacts
BOOTLOADER_BIN=build/bootloader/bootloader.bin
PARTITION_TABLE_BIN=build/partition_table/partition-table.bin
GHOST_ESP_IDF_BIN=build/Ghost_ESP_IDF.bin
if [ ! -f "$BOOTLOADER_BIN" ]; then
echo "Error: $BOOTLOADER_BIN not found!"
exit 1
fi
if [ ! -f "$PARTITION_TABLE_BIN" ]; then
echo "Error: $PARTITION_TABLE_BIN not found!"
exit 1
fi
if [ ! -f "$GHOST_ESP_IDF_BIN" ]; then
echo "Error: $GHOST_ESP_IDF_BIN not found!"
exit 1
fi
cp "$BOOTLOADER_BIN" packaged_artifacts/
cp "$PARTITION_TABLE_BIN" packaged_artifacts/
cp "$GHOST_ESP_IDF_BIN" packaged_artifacts/
ZIP_NAME="${{ matrix.target }}-build-${{ github.run_id }}.zip"
cd packaged_artifacts
zip "$ZIP_NAME" bootloader.bin partition-table.bin Ghost_ESP_IDF.bin
cd ..
- name: Upload Build Artifacts ZIP
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}-build-${{ github.run_id }}.zip
path: packaged_artifacts/${{ matrix.target }}-build-${{ github.run_id }}.zip
- name: Archive Build Directory on Failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}-build-failure-${{ github.run_id }}
path: build/
# Discord notification using curl
- name: Notify on Failure
if: failure()
run: |
curl -X POST -H "Content-Type: application/json" \
-d "{\"content\": \"🚨 **Build Failed**\n**Repository**: \`${{ github.repository }}\`\n**Target**: \`${{ matrix.target }}\`\n**Run ID**: \`${{ github.run_id }}\`\n**View Details**: [Click Here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}