Skip to content

Commit 61c1279

Browse files
committed
unifing build pipeline
1 parent da390b9 commit 61c1279

File tree

6 files changed

+306
-55
lines changed

6 files changed

+306
-55
lines changed

.github/workflows/build.yaml

Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
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+
continue-on-error: true # just to test the test pipeline
115+
116+
# Build GUI (Tauri)
117+
- name: Setup Node
118+
uses: actions/setup-node@v4
119+
with:
120+
node-version: lts/*
121+
122+
- name: Install frontend dependencies
123+
run: yarn install
124+
125+
# Platform specific GUI dependencies
126+
- name: Install GUI dependencies (Ubuntu)
127+
if: runner.os == 'Linux'
128+
run: |
129+
sudo apt-get update
130+
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev libssl-dev patchelf
131+
132+
# Signing and notarization steps
133+
- uses: apple-actions/import-codesign-certs@v3
134+
if: startsWith(matrix.os, 'macos')
135+
with:
136+
p12-file-base64: ${{ secrets.MACOS_CERTIFICATE }}
137+
p12-password: ${{ secrets.MACOS_CERTIFICATE_PWD }}
138+
keychain: build
139+
140+
- name: build with signing and notarization (macos only)
141+
if: startsWith(matrix.os, 'macos')
142+
env:
143+
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
144+
APPLE_ID: ${{ secrets.NOTARIZATION_USERNAME }}
145+
APPLE_PASSWORD: ${{ secrets.NOTARIZATION_PASSWORD }}
146+
APPLE_TEAM_ID: ${{ secrets.NOTARIZATION_TEAM_ID }}
147+
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
148+
run: |
149+
/usr/bin/security create-keychain -p espressif notary.keychain
150+
/usr/bin/security default-keychain -s notary.keychain
151+
/usr/bin/security unlock-keychain -p espressif notary.keychain
152+
yarn tauri build
153+
154+
155+
- name: build app
156+
if: ${{ ! startsWith(matrix.os, 'macos') }}
157+
run: |
158+
yarn tauri build
159+
160+
- name: Sign Windows binaries
161+
if: runner.os == 'Windows'
162+
env:
163+
WINDOWS_PFX_FILE: ${{ secrets.WIN_CERTIFICATE }}
164+
WINDOWS_PFX_PASSWORD: ${{ secrets.WIN_CERTIFICATE_PWD }}
165+
WINDOWS_SIGN_TOOL_PATH: 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\signtool.exe'
166+
run: |
167+
echo $env:WINDOWS_PFX_FILE | Out-File -FilePath cert.b64 -Encoding ASCII
168+
certutil -decode cert.b64 cert.pfx
169+
Remove-Item cert.b64
170+
& "$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
171+
172+
# Package and upload artifacts
173+
- name: Package artifacts
174+
run: |
175+
mkdir -p release/{cli,lib,gui}
176+
# Handle CLI artifacts
177+
if [ -f "src-tauri/target/release/eim" ]; then
178+
cp src-tauri/target/release/eim release/cli/
179+
chmod +x release/cli/eim
180+
cd release/cli
181+
zip eim-cli.zip eim
182+
cd ../..
183+
elif [ -f "src-tauri/target/release/eim.exe" ]; then
184+
cp src-tauri/target/release/eim.exe release/cli/
185+
cd release/cli
186+
zip eim-cli.zip eim.exe
187+
cd ../..
188+
fi
189+
# Handle GUI artifacts
190+
if [ -d "src-tauri/target/release/bundle" ]; then
191+
for file in src-tauri/target/release/bundle/*; do
192+
if [ -f "$file" ]; then
193+
chmod +x "$file"
194+
filename=$(basename "$file")
195+
cp "$file" release/gui/
196+
cd release/gui
197+
zip "${filename}.zip" "$filename"
198+
cd ../..
199+
elif [ -d "$file" ]; then
200+
dirname=$(basename "$file")
201+
cp -r "$file" release/gui/
202+
find "release/gui/$dirname" -type f -executable -exec chmod +x {} \;
203+
cd release/gui
204+
zip -r "${dirname}.zip" "$dirname"
205+
cd ../..
206+
fi
207+
done
208+
fi
209+
210+
- name: Upload artifacts CLI
211+
uses: actions/upload-artifact@v4
212+
with:
213+
name: eim-cli-${{ matrix.package_name }}-${{ github.run_number }}
214+
path: release/cli/*.zip
215+
216+
- name: Upload artifacts GUI
217+
uses: actions/upload-artifact@v4
218+
with:
219+
name: eim-${{ matrix.package_name }}-${{ github.run_number }}
220+
path: release/gui/*.zip
221+
222+
- name: Upload Release Assets
223+
if: github.event_name == 'release' && github.event.action == 'created'
224+
uses: actions/upload-release-asset@v1
225+
env:
226+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
227+
with:
228+
upload_url: ${{ github.event.release.upload_url }}
229+
asset_path: release/cli/eim-cli.zip
230+
asset_name: eim-cli-${{ matrix.package_name }}-${{ github.ref_name }}.zip
231+
asset_content_type: application/zip
232+
233+
# Tests can run in parallel after build
234+
test:
235+
needs: build
236+
uses: ./.github/workflows/test.yml
237+
with:
238+
run_id: ${{ github.run_number }}
239+
ref: ${{ github.event.pull_request.head.ref }}
240+
241+
test-cli:
242+
needs: build
243+
uses: ./.github/workflows/test_cli.yml
244+
with:
245+
run_id: ${{ github.run_number }}
246+
ref: ${{ github.event.pull_request.head.ref }}
247+
248+
update-release-info:
249+
needs: [build, test, test-cli]
250+
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
251+
runs-on: ubuntu-latest
252+
steps:
253+
- name: Update release information
254+
env:
255+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
256+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
257+
AWS_DEFAULT_REGION: ap-east-1
258+
run: |
259+
# Update CLI release info
260+
curl -s https://api.github.com/repos/espressif/idf-im-cli/releases/latest > eim_cli_release.json
261+
aws s3 cp --acl=public-read "eim_cli_release.json" s3://espdldata/dl/eim/eim_cli_release.json
262+
263+
# Update GUI release info
264+
curl -s https://api.github.com/repos/espressif/idf-im-ui/releases/latest > eim_gui_release.json
265+
aws s3 cp --acl=public-read "eim_gui_release.json" s3://espdldata/dl/eim/eim_gui_release.json

.github/workflows/build_and_test_lib.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
name: Build and Test for lib
22

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:
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:
1616

1717
jobs:
1818
build:

.github/workflows/build_cli.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
name: Build CLI
22

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:
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:
1616

1717
jobs:
1818
build:

.github/workflows/build_tauri.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
name: GUI Build
22

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:
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:
1616

1717
# This workflow will trigger on each push to the `release` branch to create or update a GitHub release, build your app, and upload the artifacts to the release.
1818

src-tauri/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ gui = ["dep:tauri", "dep:tauri-build", "dep:tauri-plugin-shell", "dep:tauri-plug
1111
cli = ["dep:clap", "dep:dialoguer", "dep:indicatif", "dep:console", "dep:log4rs", "vendored-openssl"]
1212
offline = []
1313
userustpython = ["dep:rustpython-vm", "dep:rustpython-stdlib"]
14-
vendored-openssl = ["openssl-sys/vendored"] # New feature
14+
vendored-openssl = ["openssl-sys/vendored", "reqwest/native-tls-vendored"]
1515

1616
[lib]
1717
name = "idf_im_lib"
@@ -78,4 +78,4 @@ features = []
7878
[target.'cfg(target_os = "windows")'.dependencies.reqwest]
7979
version = "0.12.4"
8080
default-features = false
81-
features = ["native-tls-vendored"]
81+
features = ["native-tls"]

tests_cli/runs/suites/basic-test.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,5 @@
1616
"data": {
1717
"nonInteractive": "true"
1818
}
19-
},
20-
{
21-
"id": 4,
22-
"type": "custom",
23-
"name": "non-interactive-full-parameters",
24-
"data": {
25-
"targetList": "esp32s2",
26-
"idfList": "v5.3.2",
27-
"installFolder": ".espcustom",
28-
"idfMirror": "github",
29-
"toolsMirror": "github",
30-
"recursive": "false",
31-
"nonInteractive": "false"
32-
}
3319
}
3420
]

0 commit comments

Comments
 (0)