1+ name : Unified Build
2+
3+ on :
4+ push :
5+ tags :
6+ - " v*"
7+ branches :
8+ - master
9+ pull_request :
10+ branches :
11+ - master
12+ release :
13+ types :
14+ - created
15+ workflow_dispatch :
16+
17+ jobs :
18+ setup-matrix :
19+ runs-on : ubuntu-latest
20+ outputs :
21+ matrix : ${{ steps.set-matrix.outputs.matrix }}
22+ steps :
23+ - id : set-matrix
24+ run : |
25+ echo "matrix={\
26+ \"include\":[\
27+ {\"os\":\"ubuntu-latest\",\"package_name\":\"linux-x64\"},\
28+ {\"os\":\"ubuntu-24.04-arm\",\"target\":\"aarch64-unknown-linux-gnu\",\"package_name\":\"linux-arm64\"},\
29+ {\"os\":\"windows-latest\",\"package_name\":\"windows-x64\"},\
30+ {\"os\":\"macos-latest\",\"package_name\":\"macos-aarch64\"},\
31+ {\"os\":\"macos-13\",\"package_name\":\"macos-x64\"}\
32+ ]}" >> "$GITHUB_OUTPUT"
33+
34+ build :
35+ needs : setup-matrix
36+ name : Build
37+ runs-on : ${{ matrix.os }}
38+ strategy :
39+ matrix : ${{fromJson(needs.setup-matrix.outputs.matrix)}}
40+ fail-fast : false
41+
42+ steps :
43+ - name : Checkout repository
44+ uses : actions/checkout@v4
45+
46+ - name : Setup Rust
47+ uses : actions-rs/toolchain@v1
48+ with :
49+ toolchain : stable
50+ override : true
51+ target : ${{ matrix.target }}
52+
53+ # Common setup steps for all platforms
54+ - name : Install OpenSSL (Windows)
55+ if : runner.os == 'Windows'
56+ shell : powershell
57+ run : |
58+ echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
59+ vcpkg install openssl:x64-windows-static-md
60+
61+ - name : Cache cargo registry
62+ uses : actions/cache@v4
63+ with :
64+ path : ~/.cargo/registry
65+ key : ${{ runner.os }}-cargo-registry
66+ restore-keys : |
67+ ${{ runner.os }}-cargo-registry
68+
69+ - name : Cache cargo index
70+ uses : actions/cache@v4
71+ with :
72+ path : ~/.cargo/git
73+ key : ${{ runner.os }}-cargo-index
74+ restore-keys : |
75+ ${{ runner.os }}-cargo-index
76+
77+ # Build & testLibrary
78+ - name : Build and Test Library
79+ if : runner.os != 'Windows' # issue with the openssl-sys on windows -> and it gets tested later with the binary package
80+ run : |
81+ cd src-tauri
82+ if [ "${{ matrix.target }}" != "" ]; then
83+ cargo test --no-fail-fast --no-default-features --lib --target ${{ matrix.target }} 2>&1 | tee result_lib.txt
84+ else
85+ cargo test --no-fail-fast --no-default-features --lib 2>&1 | tee result_lib.txt
86+ fi
87+ shell : bash
88+ continue-on-error : true
89+
90+ - name : Format test results
91+ if : runner.os != 'Windows'
92+ uses : hahihula/rust-test-results-formatter@v1
93+ with :
94+ results-file : " ./src-tauri/result_lib.txt"
95+
96+ # Build CLI
97+ - name : Build CLI
98+ if : runner.os != 'Windows'
99+ run : |
100+ cd src-tauri
101+ if [ "${{ matrix.target }}" != "" ]; then
102+ cargo build --release --no-default-features --features cli --target ${{ matrix.target }}
103+ else
104+ cargo build --release --no-default-features --features cli
105+ fi
106+ shell : bash
107+
108+ # Build CLI Windows
109+ - name : Build CLI Windows
110+ if : runner.os == 'Windows'
111+ run : |
112+ cd src-tauri
113+ cargo build --release --no-default-features --features cli
114+
115+ # Build GUI (Tauri)
116+ - name : Setup Node
117+ uses : actions/setup-node@v4
118+ with :
119+ node-version : lts/*
120+
121+ - name : Install frontend dependencies
122+ run : yarn install
123+
124+ # Platform specific GUI dependencies
125+ - name : Install GUI dependencies (Ubuntu)
126+ if : runner.os == 'Linux'
127+ run : |
128+ sudo apt-get update
129+ sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev libssl-dev patchelf
130+
131+ # Signing and notarization steps
132+ - uses : apple-actions/import-codesign-certs@v3
133+ if : startsWith(matrix.os, 'macos')
134+ with :
135+ p12-file-base64 : ${{ secrets.MACOS_CERTIFICATE }}
136+ p12-password : ${{ secrets.MACOS_CERTIFICATE_PWD }}
137+ keychain : build
138+
139+ - name : build with signing and notarization (macos only)
140+ if : startsWith(matrix.os, 'macos')
141+ env :
142+ MACOS_CERTIFICATE : ${{ secrets.MACOS_CERTIFICATE }}
143+ APPLE_ID : ${{ secrets.NOTARIZATION_USERNAME }}
144+ APPLE_PASSWORD : ${{ secrets.NOTARIZATION_PASSWORD }}
145+ APPLE_TEAM_ID : ${{ secrets.NOTARIZATION_TEAM_ID }}
146+ MACOS_CERTIFICATE_PWD : ${{ secrets.MACOS_CERTIFICATE_PWD }}
147+ run : |
148+ /usr/bin/security create-keychain -p espressif notary.keychain
149+ /usr/bin/security default-keychain -s notary.keychain
150+ /usr/bin/security unlock-keychain -p espressif notary.keychain
151+ yarn tauri build
152+
153+
154+ - name : build app
155+ if : ${{ ! startsWith(matrix.os, 'macos') }}
156+ run : |
157+ yarn tauri build
158+
159+ - name : Sign Windows binaries
160+ if : runner.os == 'Windows'
161+ env :
162+ WINDOWS_PFX_FILE : ${{ secrets.WIN_CERTIFICATE }}
163+ WINDOWS_PFX_PASSWORD : ${{ secrets.WIN_CERTIFICATE_PWD }}
164+ WINDOWS_SIGN_TOOL_PATH : ' C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\signtool.exe'
165+ run : |
166+ echo $env:WINDOWS_PFX_FILE | Out-File -FilePath cert.b64 -Encoding ASCII
167+ certutil -decode cert.b64 cert.pfx
168+ Remove-Item cert.b64
169+ & "$env:WINDOWS_SIGN_TOOL_PATH" sign /f cert.pfx /p $env:WINDOWS_PFX_PASSWORD /tr http://timestamp.digicert.com /td sha256 /fd sha256 src-tauri/target/release/eim.exe
170+
171+ # Package and upload artifacts
172+ - name : Package artifacts
173+ run : |
174+ mkdir -p release/{cli,gui}
175+ # Copy and zip CLI artifacts
176+ cp src-tauri/target/release/eim* release/cli/
177+ cd release/cli && zip -r eim-cli.zip . && cd ../..
178+ # Copy and zip GUI artifacts
179+ cp -r src-tauri/target/release/bundle/* release/gui/
180+ cd release/gui && zip -r eim-gui.zip . && cd ../..
181+
182+ - name : Upload artifacts CLI
183+ uses : actions/upload-artifact@v4
184+ with :
185+ name : eim-cli-${{ matrix.package_name }}-${{ github.run_number }}
186+ path : |
187+ release/cli/eim-cli.zip
188+
189+ - name : Upload artifacts GUI
190+ uses : actions/upload-artifact@v4
191+ with :
192+ name : eim-${{ matrix.package_name }}-${{ github.run_number }}
193+ path : |
194+ release/gui/eim-gui.zip
195+
196+ - name : Upload Release Assets
197+ if : github.event_name == 'release' && github.event.action == 'created'
198+ uses : actions/upload-release-asset@v1
199+ env :
200+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
201+ with :
202+ upload_url : ${{ github.event.release.upload_url }}
203+ asset_path : release/cli/eim-cli.zip
204+ asset_name : eim-cli-${{ matrix.package_name }}-${{ github.ref_name }}.zip
205+ asset_content_type : application/zip
206+
207+ # Tests can run in parallel after build
208+ test :
209+ needs : build
210+ uses : ./.github/workflows/test.yml
211+ with :
212+ run_id : ${{ github.run_number }}
213+ ref : ${{ github.event.pull_request.head.ref }}
214+
215+ test-cli :
216+ needs : build
217+ uses : ./.github/workflows/test_cli.yml
218+ with :
219+ run_id : ${{ github.run_number }}
220+ ref : ${{ github.event.pull_request.head.ref }}
221+
222+ update-release-info :
223+ needs : [build, test, test-cli]
224+ if : github.event_name == 'release' || github.event_name == 'workflow_dispatch'
225+ runs-on : ubuntu-latest
226+ steps :
227+ - name : Update release information
228+ env :
229+ AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
230+ AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
231+ AWS_DEFAULT_REGION : ap-east-1
232+ run : |
233+ # Update CLI release info
234+ curl -s https://api.github.com/repos/espressif/idf-im-cli/releases/latest > eim_cli_release.json
235+ aws s3 cp --acl=public-read "eim_cli_release.json" s3://espdldata/dl/eim/eim_cli_release.json
236+
237+ # Update GUI release info
238+ curl -s https://api.github.com/repos/espressif/idf-im-ui/releases/latest > eim_gui_release.json
239+ aws s3 cp --acl=public-read "eim_gui_release.json" s3://espdldata/dl/eim/eim_gui_release.json
0 commit comments