Skip to content

Commit 0533d97

Browse files
committed
fixed the brew dependencies on python
1 parent a8746f4 commit 0533d97

File tree

1 file changed

+107
-48
lines changed

1 file changed

+107
-48
lines changed

.github/workflows/build.yaml

Lines changed: 107 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -923,13 +923,16 @@ jobs:
923923
# Download CLI binaries and calculate SHA256
924924
wget -q "${{ github.event.release.assets_url }}" -O assets.json
925925
926+
# Authenticate the request to get proper asset URLs
927+
ASSETS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${{ github.event.release.assets_url }}")
928+
926929
# macOS x64 CLI
927-
macos_x64_url=$(jq -r '.[] | select(.name == "eim-cli-macos-x64.zip") | .browser_download_url' assets.json)
930+
macos_x64_url=$(echo "$ASSETS" | jq -r '.[] | select(.name == "eim-cli-macos-x64.zip") | .browser_download_url')
928931
wget -q "$macos_x64_url" -O eim-cli-macos-x64.zip
929932
macos_x64_sha=$(sha256sum eim-cli-macos-x64.zip | cut -d' ' -f1)
930933
931934
# macOS ARM64 CLI
932-
macos_arm64_url=$(jq -r '.[] | select(.name == "eim-cli-macos-aarch64.zip") | .browser_download_url' assets.json)
935+
macos_arm64_url=$(echo "$ASSETS" | jq -r '.[] | select(.name == "eim-cli-macos-aarch64.zip") | .browser_download_url')
933936
wget -q "$macos_arm64_url" -O eim-cli-macos-aarch64.zip
934937
macos_arm64_sha=$(sha256sum eim-cli-macos-aarch64.zip | cut -d' ' -f1)
935938
@@ -941,13 +944,15 @@ jobs:
941944
- name: Download and calculate checksums for GUI
942945
id: gui-checksums
943946
run: |
944-
# macOS x64 GUI
945-
macos_x64_gui_url=$(jq -r '.[] | select(.name == "eim-gui-macos-x64.dmg") | .browser_download_url' assets.json)
947+
ASSETS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${{ github.event.release.assets_url }}")
948+
949+
# macOS x64 GUI (DMG)
950+
macos_x64_gui_url=$(echo "$ASSETS" | jq -r '.[] | select(.name == "eim-gui-macos-x64.dmg") | .browser_download_url')
946951
wget -q "$macos_x64_gui_url" -O eim-gui-macos-x64.dmg
947952
macos_x64_gui_sha=$(sha256sum eim-gui-macos-x64.dmg | cut -d' ' -f1)
948953
949-
# macOS ARM64 GUI
950-
macos_arm64_gui_url=$(jq -r '.[] | select(.name == "eim-gui-macos-aarch64.dmg") | .browser_download_url' assets.json)
954+
# macOS ARM64 GUI (DMG)
955+
macos_arm64_gui_url=$(echo "$ASSETS" | jq -r '.[] | select(.name == "eim-gui-macos-aarch64.dmg") | .browser_download_url')
951956
wget -q "$macos_arm64_gui_url" -O eim-gui-macos-aarch64.dmg
952957
macos_arm64_gui_sha=$(sha256sum eim-gui-macos-aarch64.dmg | cut -d' ' -f1)
953958
@@ -957,90 +962,144 @@ jobs:
957962
echo "macos_arm64_gui_sha=$macos_arm64_gui_sha" >> $GITHUB_OUTPUT
958963
959964
- name: Generate Homebrew Formula for CLI
965+
env:
966+
VERSION: ${{ steps.release-info.outputs.tag_name }}
967+
MACOS_X64_URL: ${{ steps.cli-checksums.outputs.macos_x64_url }}
968+
MACOS_X64_SHA: ${{ steps.cli-checksums.outputs.macos_x64_sha }}
969+
MACOS_ARM64_URL: ${{ steps.cli-checksums.outputs.macos_arm64_url }}
970+
MACOS_ARM64_SHA: ${{ steps.cli-checksums.outputs.macos_arm64_sha }}
960971
run: |
961972
mkdir -p homebrew-repo/Formula
962-
cat > homebrew-repo/Formula/eim.rb << 'EOF'
973+
974+
# Remove 'v' prefix from version for formula
975+
CLEAN_VERSION="${VERSION#v}"
976+
977+
cat > homebrew-repo/Formula/eim.rb << 'FORMULA_EOF'
978+
# typed: false
979+
# frozen_string_literal: true
980+
963981
class Eim < Formula
964-
desc "ESP-IDF Installer and Manager CLI"
982+
desc "ESP-IDF Installation Manager - CLI tool for setting up ESP-IDF development environment"
965983
homepage "https://github.com/espressif/idf-im-ui"
966-
version "${{ steps.release-info.outputs.tag_name }}"
967-
968-
if Hardware::CPU.intel?
969-
url "${{ steps.cli-checksums.outputs.macos_x64_url }}"
970-
sha256 "${{ steps.cli-checksums.outputs.macos_x64_sha }}"
971-
elsif Hardware::CPU.arm?
972-
url "${{ steps.cli-checksums.outputs.macos_arm64_url }}"
973-
sha256 "${{ steps.cli-checksums.outputs.macos_arm64_sha }}"
984+
FORMULA_EOF
985+
986+
cat >> homebrew-repo/Formula/eim.rb << FORMULA_EOF
987+
version "${CLEAN_VERSION}"
988+
license "MIT"
989+
990+
on_macos do
991+
on_intel do
992+
url "${MACOS_X64_URL}"
993+
sha256 "${MACOS_X64_SHA}"
994+
end
995+
on_arm do
996+
url "${MACOS_ARM64_URL}"
997+
sha256 "${MACOS_ARM64_SHA}"
998+
end
974999
end
9751000
1001+
# Runtime dependencies for QEMU (used by ESP-IDF for emulation)
9761002
depends_on "libgcrypt"
9771003
depends_on "glib"
9781004
depends_on "pixman"
9791005
depends_on "sdl2"
9801006
depends_on "libslirp"
1007+
1008+
# DFU utility for flashing
9811009
depends_on "dfu-util"
982-
depends_on "[email protected]" => :recommended
983-
depends_on "[email protected]" => :recommended
984-
depends_on "python@3.11" => :recommended
985-
depends_on "python@3.10" => :recommended
1010+
1011+
# ESP-IDF requires Python 3.9-3.13. We install [email protected] as default.
1012+
# If user already has python@3.12, Homebrew won't reinstall it.
1013+
depends_on "python@3.12"
9861014
9871015
def install
9881016
bin.install "eim"
9891017
end
9901018
1019+
def caveats
1020+
<<~EOS
1021+
ESP-IDF Installation Manager (EIM) has been installed.
1022+
1023+
Python 3.12 was installed as a dependency (ESP-IDF requires Python 3.9-3.13).
1024+
Python 3.14+ is not yet supported.
1025+
1026+
Run 'eim' to install ESP-IDF.
1027+
EOS
1028+
end
1029+
9911030
test do
992-
system "#{bin}/eim", "--version"
1031+
assert_match "eim", shell_output("#{bin}/eim --version")
9931032
end
9941033
end
995-
EOF
1034+
FORMULA_EOF
1035+
1036+
echo "Generated CLI formula:"
1037+
cat homebrew-repo/Formula/eim.rb
9961038
9971039
- name: Generate Homebrew Cask for GUI
1040+
env:
1041+
VERSION: ${{ steps.release-info.outputs.tag_name }}
1042+
MACOS_X64_GUI_URL: ${{ steps.gui-checksums.outputs.macos_x64_gui_url }}
1043+
MACOS_X64_GUI_SHA: ${{ steps.gui-checksums.outputs.macos_x64_gui_sha }}
1044+
MACOS_ARM64_GUI_URL: ${{ steps.gui-checksums.outputs.macos_arm64_gui_url }}
1045+
MACOS_ARM64_GUI_SHA: ${{ steps.gui-checksums.outputs.macos_arm64_gui_sha }}
9981046
run: |
9991047
mkdir -p homebrew-repo/Casks
1000-
cat > homebrew-repo/Casks/eim-gui.rb << 'EOF'
1048+
1049+
# Remove 'v' prefix from version for cask
1050+
CLEAN_VERSION="${VERSION#v}"
1051+
1052+
cat > homebrew-repo/Casks/eim-gui.rb << CASK_EOF
10011053
cask "eim-gui" do
1002-
version "${{ steps.release-info.outputs.tag_name }}"
1003-
1004-
if Hardware::CPU.intel?
1005-
url "${{ steps.gui-checksums.outputs.macos_x64_gui_url }}"
1006-
sha256 "${{ steps.gui-checksums.outputs.macos_x64_gui_sha }}"
1007-
elsif Hardware::CPU.arm?
1008-
url "${{ steps.gui-checksums.outputs.macos_arm64_gui_url }}"
1009-
sha256 "${{ steps.gui-checksums.outputs.macos_arm64_gui_sha }}"
1010-
end
1054+
version "${CLEAN_VERSION}"
10111055
1012-
depends_on "libgcrypt"
1013-
depends_on "glib"
1014-
depends_on "pixman"
1015-
depends_on "sdl2"
1016-
depends_on "libslirp"
1017-
depends_on "dfu-util"
1018-
depends_on "[email protected]" => :recommended
1019-
depends_on "[email protected]" => :recommended
1020-
depends_on "[email protected]" => :recommended
1021-
depends_on "[email protected]" => :recommended
1056+
on_intel do
1057+
url "${MACOS_X64_GUI_URL}"
1058+
sha256 "${MACOS_X64_GUI_SHA}"
1059+
end
1060+
on_arm do
1061+
url "${MACOS_ARM64_GUI_URL}"
1062+
sha256 "${MACOS_ARM64_GUI_SHA}"
1063+
end
10221064
1023-
name "ESP-IDF Installer and Manager"
1024-
desc "GUI application for managing ESP-IDF installations"
1065+
name "ESP-IDF Installation Manager"
1066+
desc "GUI application for installing and managing ESP-IDF development environment"
10251067
homepage "https://github.com/espressif/idf-im-ui"
10261068
10271069
app "eim.app"
10281070
1071+
caveats <<~EOS
1072+
ESP-IDF Installation Manager (EIM) has been installed.
1073+
1074+
IMPORTANT: ESP-IDF requires Python 3.9, 3.10, 3.11, 3.12, or 3.13.
1075+
Python 3.14+ is not yet supported.
1076+
1077+
If you don't have a compatible Python version, install one with:
1078+
brew install [email protected]
1079+
1080+
For QEMU emulation support, you may also need:
1081+
brew install libgcrypt glib pixman sdl2 libslirp dfu-util
1082+
EOS
1083+
10291084
zap trash: [
1030-
"~/Library/Application Support/eim",
1031-
"~/Library/Caches/eim",
1085+
"~/Library/Application Support/com.espressif.eim",
1086+
"~/Library/Caches/com.espressif.eim",
10321087
"~/Library/Preferences/com.espressif.eim.plist",
1088+
"~/Library/Saved Application State/com.espressif.eim.savedState",
10331089
]
10341090
end
1035-
EOF
1091+
CASK_EOF
1092+
1093+
echo "Generated GUI cask:"
1094+
cat homebrew-repo/Casks/eim-gui.rb
10361095
10371096
- name: Commit and push changes
10381097
run: |
10391098
cd homebrew-repo
10401099
git config --local user.email "[email protected]"
10411100
git config --local user.name "GitHub Action"
10421101
git add Formula/eim.rb Casks/eim-gui.rb
1043-
git commit -m "Update eim formula and cask to version ${{ steps.release-info.outputs.tag_name }}" || exit 0
1102+
git diff --staged --quiet || git commit -m "Update eim to version ${{ steps.release-info.outputs.tag_name }}"
10441103
git push
10451104
10461105
uupdate-apt-repo:

0 commit comments

Comments
 (0)