Skip to content

Commit fcfe78b

Browse files
committed
Fix: Build: Fix dependency installation for macOS
Ensure correct installation of build tools and OpenSSL on macOS by using `brew` commands and setting the `OPENSSL_DIR` environment variable.
1 parent bc28048 commit fcfe78b

File tree

1 file changed

+41
-16
lines changed

1 file changed

+41
-16
lines changed

.github/workflows/build.yml

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Build and Package
2-
description: Build and package the application
2+
33
on:
44
push:
55
branches:
@@ -8,7 +8,9 @@ on:
88
jobs:
99
build:
1010
runs-on: ${{ matrix.os }}
11+
continue-on-error: true # Allow other matrix jobs to continue if one fails
1112
strategy:
13+
fail-fast: false # Don't fail all jobs if one fails
1214
matrix:
1315
os: [ubuntu-latest, windows-latest, macos-latest]
1416
include:
@@ -31,58 +33,81 @@ jobs:
3133
with:
3234
target: ${{ matrix.target }}
3335

36+
- name: Cache cargo dependencies
37+
uses: actions/cache@v4
38+
with:
39+
path: |
40+
~/.cargo/bin/
41+
~/.cargo/registry/index/
42+
~/.cargo/registry/cache/
43+
~/.cargo/git/db/
44+
target/
45+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
46+
restore-keys: |
47+
${{ runner.os }}-cargo-
48+
3449
- name: Install dependencies (Linux)
3550
if: matrix.os == 'ubuntu-latest'
3651
run: |
3752
sudo apt-get update
38-
sudo apt-get install -y dpkg-dev
53+
sudo apt-get install -y dpkg-dev libssl-dev
3954
4055
- name: Install dependencies (macOS)
4156
if: matrix.os == 'macos-latest'
4257
run: |
4358
brew update
44-
brew install rustup-init
59+
brew install openssl@3
60+
echo "OPENSSL_DIR=$(brew --prefix openssl@3)" >> $GITHUB_ENV
61+
# Explicitly install and link needed build tools
62+
brew install rustup-init pkg-config
4563
4664
- name: Install dependencies (Windows)
4765
if: matrix.os == 'windows-latest'
4866
run: |
4967
choco install wixtoolset -y
50-
rustup target add x86_64-pc-windows-gnu
51-
rustup install stable-x86_64-pc-windows-gnu
68+
choco install openssl -y
5269
5370
- name: Build Rust project
5471
run: cargo build --release --target ${{ matrix.target }} --manifest-path app/Cargo.toml
72+
env:
73+
# For macOS cross-compilation
74+
PKG_CONFIG_ALLOW_CROSS: 1
5575

5676
- name: Package Debian (.deb)
57-
if: matrix.package_type == 'deb'
77+
if: matrix.package_type == 'deb' && success()
5878
run: |
59-
cargo install cargo-deb
79+
cargo install cargo-deb --force
6080
cargo deb --target ${{ matrix.target }} --manifest-path app/Cargo.toml
6181
env:
6282
DEB_BUILD_OPTIONS: nocheck
6383

64-
- name: Package Windows (.msi)
65-
if: matrix.package_type == 'windows'
84+
- name: Package Windows (.exe/.msi)
85+
if: matrix.package_type == 'windows' && success()
6686
run: |
67-
cargo install cargo-wix
87+
cargo install cargo-wix --force
6888
cd app
89+
cargo wix init
6990
cargo wix --release --target ${{ matrix.target }}
7091
shell: bash
7192

7293
- name: Package macOS (.dmg)
73-
if: matrix.package_type == 'mac'
94+
if: matrix.package_type == 'mac' && success()
7495
run: |
75-
cargo install cargo-bundle
96+
cargo install cargo-bundle --force
7697
cargo bundle --release --target ${{ matrix.target }} --manifest-path app/Cargo.toml
7798
env:
78-
BUNDLE_ID: com.example.my-app
79-
BUNDLE_NAME: MyApp
99+
BUNDLE_ID: com.singhropar.gitswift
100+
BUNDLE_NAME: gitswift
101+
PKG_CONFIG_ALLOW_CROSS: 1
102+
# Ensure OpenSSL is found during bundle process
103+
OPENSSL_DIR: ${{ env.OPENSSL_DIR }}
80104

81105
- name: Upload Artifacts
106+
if: success()
82107
uses: actions/upload-artifact@v4
83108
with:
84109
name: packages-${{ matrix.os }}
85110
path: |
86111
app/target/${{ matrix.target }}/release/*.deb
87-
app/target/wix/*.msi
88-
app/target/release/bundle/dmg/*.dmg
112+
app/target/wix/msi/*.msi
113+
app/target/release/bundle/dmg/*.dmg

0 commit comments

Comments
 (0)