-
Notifications
You must be signed in to change notification settings - Fork 24
188 lines (160 loc) · 8.22 KB
/
compile_all.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: Compile All
on:
workflow_dispatch:
jobs:
build:
name: Build for ${{ matrix.target.name }}
runs-on: ubuntu-latest
strategy:
matrix:
target:
- { name: "esp32-generic", idf_target: "esp32", sdkconfig_file: "configs/sdkconfig.default.esp32", zip_name: "esp32-generic.zip" }
- { name: "esp32s2-generic", idf_target: "esp32s2", sdkconfig_file: "configs/sdkconfig.default.esp32s2", zip_name: "esp32s2-generic.zip"}
- { name: "esp32s3-generic", idf_target: "esp32s3", sdkconfig_file: "configs/sdkconfig.default.esp32s3", zip_name: "esp32s3-generic.zip" }
- { name: "esp32c3-generic", idf_target: "esp32c3", sdkconfig_file: "configs/sdkconfig.default.esp32c3", zip_name: "esp32c3-generic.zip" }
- { name: "esp32c6-generic", idf_target: "esp32c6", sdkconfig_file: "configs/sdkconfig.default.esp32c6", zip_name: "esp32c6-generic.zip" }
- { name: "Awok V5", idf_target: "esp32s2", sdkconfig_file: "configs/sdkconfig.default.esp32s2", zip_name: "esp32v5_awok.zip"}
# Dev Kit configurations (LED on, no screen support)
- { name: "esp32c3-devkit", idf_target: "esp32c3", sdkconfig_file: "configs/sdkconfig.devkit.esp32c3", zip_name: "esp32c3-devkit.zip"}
- { name: "esp32c6-devkit", idf_target: "esp32c6", sdkconfig_file: "configs/sdkconfig.devkit.esp32c6", zip_name: "esp32c6-devkit.zip"}
# Ghost board (LED on, special pin and LED count)
- { name: "ghostboard", idf_target: "esp32c6", sdkconfig_file: "configs/sdkconfig.ghostboard", zip_name: "ghostboard.zip"}
# Screen-supported builds
- { name: "MarauderV4_FlipperHub", idf_target: "esp32", sdkconfig_file: "configs/sdkconfig.marauderv4", zip_name: "MarauderV4_FlipperHub.zip"}
- { name: "MarauderV6&AwokDual", idf_target: "esp32", sdkconfig_file: "configs/sdkconfig.marauderv6", zip_name: "MarauderV6_AwokDual.zip"}
- { name: "AwokMini", idf_target: "esp32", sdkconfig_file: "configs/sdkconfig.awokmini", zip_name: "AwokMini.zip"}
- { name: "ESP32-S3-Cardputer", idf_target: "esp32s3", sdkconfig_file: "configs/sdkconfig.cardputer", zip_name: "ESP32-S3-Cardputer.zip"}
- { name: "LillyGoTWatch_S3", idf_target: "esp32s3", sdkconfig_file: "configs/sdkconfig.S3TWatch", zip_name: "lillygos3watch.zip"}
# CYD (Cheap Yellow Display) with touch screen
- { name: "CYD2USB", idf_target: "esp32", sdkconfig_file: "configs/sdkconfig.CYD2USB", zip_name: "CYD2USB.zip"}
- { name: "CYDMicroUSB", idf_target: "esp32", sdkconfig_file: "configs/sdkconfig.CYDMicroUSB", zip_name: "CYDMicroUSB.zip"}
- { name: "CYDDualUSB", idf_target: "esp32", sdkconfig_file: "configs/sdkconfig.CYDDualUSB", zip_name: "CYDDualUSB.zip"}
- { name: "CYD2USB2.4_Inch", idf_target: "esp32", sdkconfig_file: "configs/sdkconfig.CYD2USB2.4Inch", zip_name: "CYD2USB2.4Inch.zip"}
# 7-inch boards
- { name: "Waveshare_LCD", idf_target: "esp32s3", sdkconfig_file: "configs/sdkconfig.waveshare7inch", zip_name: "Waveshare_LCD.zip"}
- { name: "Crowtech_LCD", idf_target: "esp32s3", sdkconfig_file: "configs/sdkconfig.crowtech7inch", zip_name: "Crowtech_LCD.zip"}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- 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: Apply Custom SDK Config
run: |
cp "${{ matrix.target.sdkconfig_file }}" sdkconfig.defaults
- name: Set up ESP-IDF and Target
run: |
. ~/esp-idf/export.sh
export IDF_TARGET=${{ matrix.target.idf_target }}
echo "IDF_TARGET=${{ matrix.target.idf_target }}" >> $GITHUB_ENV
- name: Clean and Build Project
env:
SDKCONFIG_DEFAULTS: "sdkconfig.defaults"
run: |
. ~/esp-idf/export.sh
idf.py clean
idf.py build
- name: Package Build Artifacts
run: |
mkdir -p packaged_artifacts
cp build/partition_table/partition-table.bin packaged_artifacts/
cp build/*.bin packaged_artifacts/
zip "packaged_artifacts/${{ matrix.target.zip_name }}" packaged_artifacts/*
- name: Upload Build Artifacts to GitHub
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target.zip_name }}
path: packaged_artifacts/${{ matrix.target.zip_name }}
upload_all:
name: Upload All to Cloudflare R2
needs: build
runs-on: ubuntu-latest
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v3
with:
path: all_artifacts
- name: Install rclone
run: |
curl -fsSL https://rclone.org/install.sh | sudo bash
- name: Configure rclone for Cloudflare R2
env:
R2_ACCESS_KEY: ${{ secrets.R2_ACCESS_KEY }}
R2_SECRET_KEY: ${{ secrets.R2_SECRET_KEY }}
run: |
mkdir -p ~/.config/rclone
echo "[cloudflare_r2]" > ~/.config/rclone/rclone.conf
echo "type = s3" >> ~/.config/rclone/rclone.conf
echo "provider = Cloudflare" >> ~/.config/rclone/rclone.conf
echo "access_key_id = $R2_ACCESS_KEY" >> ~/.config/rclone/rclone.conf
echo "secret_access_key = $R2_SECRET_KEY" >> ~/.config/rclone/rclone.conf
echo "endpoint = https://fb5f7d31bedfe4f3538ddfa6db491962.r2.cloudflarestorage.com" >> ~/.config/rclone/rclone.conf
- name: Upload All Artifacts to Cloudflare R2
env:
R2_BUCKET: "spooksapi"
R2_PATH: "GhostESPBins"
run: |
echo "Uploading all artifacts to Cloudflare R2..."
rclone copy all_artifacts cloudflare_r2:${R2_BUCKET}/${R2_PATH} --progress
if [ $? -ne 0 ]; then
echo "Upload failed. Exiting..."
exit 1
fi
echo "All artifacts uploaded successfully."
- name: Download All Artifacts
uses: actions/download-artifact@v3
with:
path: all_artifacts
- name: Get the Latest Release ID (Including Pre-releases)
id: get_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
latest_release=$(curl -s \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/releases" | jq '[.[] | select(.draft == false)] | .[0]')
release_id=$(echo "$latest_release" | jq -r '.id')
echo "Latest release ID (including pre-releases) is $release_id"
echo "::set-output name=release_id::$release_id"
- name: Upload Artifacts to Latest Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for file in all_artifacts/*; do
echo "Uploading $file to GitHub Release..."
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/zip" \
--data-binary @"$file" \
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.get_release.outputs.release_id }}/assets?name=$(basename $file)"
done
- name: Notify Discord of Successful Upload
if: success()
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
payload=$(cat <<EOF
{
"embeds": [
{
"title": "🎉 New Build Artifacts Uploaded!",
"description": "All build artifacts have been successfully uploaded to Cloudflare R2.",
"color": 5814783,
"timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
}
]
}
EOF
)
curl -X POST \
-H "Content-Type: application/json" \
-d "$payload" \
"$DISCORD_WEBHOOK_URL"