Skip to content

Commit bfac95d

Browse files
committed
Fix: Dependency installation on macOS
Ensure OpenSSL, pkg-config, rustup-init, llvm, and other dependencies are correctly installed on macOS by leveraging `brew` to manage package installations.
1 parent e31c696 commit bfac95d

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,60 +56,76 @@ jobs:
5656
if: matrix.os == 'macos-latest'
5757
run: |
5858
brew update
59-
brew install openssl@3 pkg-config
59+
brew install openssl@3 rustup-init pkg-config llvm
6060
echo "OPENSSL_DIR=$(brew --prefix openssl@3)" >> $GITHUB_ENV
6161
echo "OPENSSL_LIB_DIR=$(brew --prefix openssl@3)/lib" >> $GITHUB_ENV
6262
echo "OPENSSL_INCLUDE_DIR=$(brew --prefix openssl@3)/include" >> $GITHUB_ENV
6363
echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV
64+
echo "CC=$(brew --prefix llvm)/bin/clang" >> $GITHUB_ENV
65+
echo "CXX=$(brew --prefix llvm)/bin/clang++" >> $GITHUB_ENV
6466
6567
- name: Install dependencies (Windows)
6668
if: matrix.os == 'windows-latest'
6769
run: |
6870
choco install wixtoolset -y
6971
choco install openssl -y
7072
71-
- name: Build Rust project
72-
run: cargo build --release --locked --target ${{ matrix.target }} --manifest-path app/Cargo.toml
73+
74+
- name: Build Rust project (Windows/Linux)
75+
if: matrix.package_type != 'mac'
76+
run: |
77+
cargo build --release --locked --target ${{ matrix.target }} --manifest-path app/Cargo.toml
78+
env:
79+
PKG_CONFIG_ALLOW_CROSS: 1
80+
81+
- name: Build Rust project (macOS)
82+
if: matrix.package_type == 'mac'
83+
run: |
84+
cargo build --release --locked --target ${{ matrix.target }} --manifest-path app/Cargo.toml
7385
env:
7486
PKG_CONFIG_ALLOW_CROSS: 1
7587
OPENSSL_DIR: ${{ env.OPENSSL_DIR }}
7688
OPENSSL_LIB_DIR: ${{ env.OPENSSL_LIB_DIR }}
7789
OPENSSL_INCLUDE_DIR: ${{ env.OPENSSL_INCLUDE_DIR }}
90+
91+
7892

7993
- name: Package Debian (.deb)
8094
if: matrix.package_type == 'deb'
8195
run: |
8296
cargo install cargo-deb --force
83-
cargo deb --target ${{ matrix.target }} --manifest-path app/Cargo.toml
97+
cargo deb --target ${{ matrix.target }} --manifest-path app/Cargo.toml
8498
env:
8599
DEB_BUILD_OPTIONS: nocheck
86100

87101
- name: Package Windows (.exe/.msi)
88102
if: matrix.package_type == 'windows'
89103
run: |
90104
cargo install cargo-wix --force
91-
cd app
92-
cargo wix --release
105+
cargo wix -- --release --target ${{ matrix.target }} --manifest-path app/Cargo.toml
93106
shell: bash
94107

95108
- name: Package macOS (.dmg)
96109
if: matrix.package_type == 'mac'
97110
run: |
111+
cd app
98112
cargo install cargo-bundle --force
99-
cargo bundle --release --target ${{ matrix.target }} --manifest-path app/Cargo.toml
113+
cargo bundle --release --target ${{ matrix.target }}
100114
env:
101115
BUNDLE_ID: com.singhropar.gitswift
102116
BUNDLE_NAME: gitswift
103-
MACOSX_DEPLOYMENT_TARGET: 11.0
117+
MACOSX_DEPLOYMENT_TARGET: 10.12
104118
OPENSSL_DIR: ${{ env.OPENSSL_DIR }}
105119
OPENSSL_LIB_DIR: ${{ env.OPENSSL_LIB_DIR }}
106120
OPENSSL_INCLUDE_DIR: ${{ env.OPENSSL_INCLUDE_DIR }}
121+
CC: ${{ env.CC }}
122+
CXX: ${{ env.CXX }}
107123

108124
- name: Upload Artifacts
109125
uses: actions/upload-artifact@v4
110126
with:
111127
name: packages-${{ matrix.os }}
112128
path: |
113129
app/target/${{ matrix.target }}/debian/*.deb
114-
app/target/wix/*.msi
115-
app/target/release/bundle/dmg/*.dmg
130+
target/wix/*.msi
131+
app/target/release/bundle/dmg/*.dmg

0 commit comments

Comments
 (0)