@@ -26,80 +26,105 @@ jobs:
2626 target : x86_64-pc-windows-msvc
2727 - os : windows-2019
2828 target : aarch64-pc-windows-msvc
29+
2930 runs-on : ${{ matrix.os }}
3031 steps :
3132 - uses : actions/checkout@v4
3233
3334 - name : Install Dependencies (Linux)
3435 if : contains(matrix.os, 'ubuntu')
35- run : sudo apt-get update && sudo apt-get install -y libclang-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libudev-dev && cargo install cargo-bundle
36+ run : |
37+ sudo apt-get update
38+ sudo apt-get install -y libclang-dev libgtk-3-dev libxcb-render0-dev \
39+ libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev \
40+ libudev-dev cmake
41+ cargo install cargo-bundle
3642
3743 - name : Install Dependencies (macOS)
3844 if : contains(matrix.os, 'macos')
39- run : cargo install cargo-bundle
45+ run : |
46+ brew install cmake
47+ cargo install cargo-bundle
4048
4149 - name : Install Dependencies (Windows)
4250 if : contains(matrix.os, 'windows')
43- run : cargo install --force cargo-wix
51+ run : |
52+ cargo install --force cargo-wix
53+ choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
4454
45- - name : Set CARGO_FEATURES environment variable (Windows)
55+ - name : Set CARGO_FEATURES (Windows)
4656 if : contains(matrix.os, 'windows')
47- run : |
48- echo "CARGO_FEATURES=self_update" >> $env:GITHUB_ENV
57+ run : echo "CARGO_FEATURES=self_update" >> $env:GITHUB_ENV
4958
5059 - name : Build
51- run : cargo build --features self_update --release
60+ run : |
61+ rustup target add ${{ matrix.target }}
62+ cargo build --release --features self_update --target ${{ matrix.target }}
5263
5364 - name : Build .deb Package (Linux)
5465 if : contains(matrix.os, 'ubuntu')
55- run : cargo bundle --features self_update --release
66+ run : cargo bundle --features self_update --release --target ${{ matrix.target }}
5667
5768 - name : Build .app Package (macOS)
5869 if : contains(matrix.os, 'macos')
59- run : cargo bundle --features self_update --release
70+ run : cargo bundle --features self_update --release --target ${{ matrix.target }}
6071
6172 - name : Build .msi Package (Windows)
6273 if : contains(matrix.os, 'windows')
6374 run : cargo wix
6475
65- # Compress for Linux Binary
6676 - name : Compress Output (Linux Binary)
6777 if : contains(matrix.os, 'ubuntu')
6878 run : |
69- cd target/release
79+ BIN_DIR="target/${{ matrix.target }}/release"
80+ [ -d "$BIN_DIR" ] || BIN_DIR="target/release"
81+ cd "$BIN_DIR"
7082 zip -r serial-monitor-${{ matrix.target }}.zip serial-monitor-rust
7183 mv serial-monitor-${{ matrix.target }}.zip $GITHUB_WORKSPACE/
7284
73- # Compress for Linux .deb Package
7485 - name : Compress Output (Linux .deb)
7586 if : contains(matrix.os, 'ubuntu')
7687 run : |
77- cd target/release/bundle/deb
88+ DEB_DIR="target/${{ matrix.target }}/release/bundle/deb"
89+ [ -d "$DEB_DIR" ] || DEB_DIR="target/release/bundle/deb"
90+ cd "$DEB_DIR"
7891 zip serial-monitor-${{ matrix.target }}.deb.zip *.deb
7992 mv serial-monitor-${{ matrix.target }}.deb.zip $GITHUB_WORKSPACE/
8093
81- # Compress for macOS (.app Bundle)
82- - name : Compress Output (macOS)
94+ - name : Compress Output (macOS .app)
8395 if : contains(matrix.os, 'macos')
8496 run : |
85- cd target/release/bundle/osx
97+ OSX_DIR="target/${{ matrix.target }}/release/bundle/osx"
98+ [ -d "$OSX_DIR" ] || OSX_DIR="target/release/bundle/osx"
99+ cd "$OSX_DIR"
86100 zip -r serial-monitor-${{ matrix.target }}.app.zip Serial\ Monitor.app
87101 mv serial-monitor-${{ matrix.target }}.app.zip $GITHUB_WORKSPACE/
88102
89- # Compress for Windows (.exe)
90103 - name : Compress Output (Windows .exe)
91104 if : contains(matrix.os, 'windows')
105+ shell : pwsh
92106 run : |
93- Compress-Archive -Path target/release/serial-monitor-rust.exe -DestinationPath serial-monitor-${{ matrix.target }}.exe.zip
94- Move-Item -Path serial-monitor-${{ matrix.target }}.exe.zip -Destination $env:GITHUB_WORKSPACE
107+ $exePath1 = "target/${{ matrix.target }}/release/serial-monitor-rust.exe"
108+ $exePath2 = "target/release/serial-monitor-rust.exe"
109+ $exePath = if (Test-Path $exePath1) { $exePath1 } elseif (Test-Path $exePath2) { $exePath2 } else { "" }
110+ if ($exePath -eq "") {
111+ Write-Error "Executable not found"
112+ exit 1
113+ }
114+ Compress-Archive -Path $exePath -DestinationPath "serial-monitor-${{ matrix.target }}.exe.zip"
115+ Move-Item -Path "serial-monitor-${{ matrix.target }}.exe.zip" -Destination $env:GITHUB_WORKSPACE
95116
96- # Compress for Windows (.msi)
97117 - name : Compress Output (Windows .msi)
98118 if : contains(matrix.os, 'windows')
119+ shell : pwsh
99120 run : |
100- cd target/wix
101- Compress-Archive -Path *.msi -DestinationPath serial-monitor-${{ matrix.target }}.msi.zip
102- Move-Item -Path serial-monitor-${{ matrix.target }}.msi.zip -Destination $env:GITHUB_WORKSPACE
121+ $msiPath = Get-ChildItem -Path "target/wix" -Filter "*.msi" | Select-Object -First 1
122+ if (-Not $msiPath) {
123+ Write-Error "MSI not found"
124+ exit 1
125+ }
126+ Compress-Archive -Path $msiPath.FullName -DestinationPath "serial-monitor-${{ matrix.target }}.msi.zip"
127+ Move-Item -Path "serial-monitor-${{ matrix.target }}.msi.zip" -Destination $env:GITHUB_WORKSPACE
103128
104129 - name : Upload .deb and executable for Linux (Ubuntu)
105130 if : contains(matrix.os, 'ubuntu')
0 commit comments