Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksongoode committed Jul 3, 2024
1 parent 97f849e commit fa771dd
Showing 1 changed file with 58 additions and 44 deletions.
102 changes: 58 additions & 44 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
include:
- os: ubuntu-latest
targets: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]
- os: macOS-latest
- os: windows-latest
arch: [x86_64, aarch64]

runs-on: ${{ matrix.os }}
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
Expand All @@ -49,68 +49,82 @@ jobs:
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libssl-dev libasound2-dev

- name: Setup ARM Linux build environment
if: runner.os == 'Linux'
run: |
sudo apt-get install -y gcc-aarch64-linux-gnu qemu-user-static
rustup target add aarch64-unknown-linux-gnu
- name: Run Tests
run: cargo test
continue-on-error: true

- name: Build and Package (Linux)
- name: Build Release (Windows)
if: runner.os == 'Windows'
run: cargo build --release

- name: Build Release (Linux)
if: runner.os == 'Linux'
run: |
targets=("x86_64-unknown-linux-gnu" "aarch64-unknown-linux-gnu")
for target in "${targets[@]}"; do
cargo build --release --target $target
arch=$(echo $target | cut -d'-' -f1)
chmod +x target/$target/release/psst-gui
zip -j psst-gui-$arch.zip target/$target/release/psst-gui
echo "artifact_$arch=psst-gui-$arch.zip" >> $GITHUB_OUTPUT
done
rustup target add aarch64-unknown-linux-gnu
cargo build --release --target x86_64-unknown-linux-gnu --target aarch64-unknown-linux-gnu
- name: Build and Package (macOS)
- name: Build Release (macOS)
if: runner.os == 'macOS'
run: |
targets=("x86_64-apple-darwin" "aarch64-apple-darwin")
rustup target add x86_64-apple-darwin aarch64-apple-darwin
cargo build --release --target x86_64-apple-darwin --target aarch64-apple-darwin
for target in "${targets[@]}"; do
rustup target add $target
cargo build --release --target $target
done
- name: Cache cargo-bundle
if: runner.os == 'macOS'
id: cache-cargo-bundle
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-bundle
key: ${{ runner.os }}-cargo-bundle-${{ hashFiles('**/Cargo.lock') }}

lipo -create -output target/release/psst-gui \
target/x86_64-apple-darwin/release/psst-gui \
target/aarch64-apple-darwin/release/psst-gui
- name: Install cargo-bundle
if: runner.os == 'macOS' && steps.cache-cargo-bundle.outputs.cache-hit != 'true'
run: cargo install cargo-bundle

# Bundle the app
cargo bundle --release
- name: Bundle macOS Release
if: runner.os == 'macOS'
run: cargo bundle --release
working-directory: psst-gui

# Create universal binary in the bundle
- name: Create macOS universal binary
if: runner.os == 'macOS'
run: |
lipo -create -output target/release/bundle/osx/Psst.app/Contents/MacOS/psst-gui \
target/x86_64-apple-darwin/release/psst-gui \
target/aarch64-apple-darwin/release/psst-gui
# Create DMG
hdiutil create -volname "Psst" -srcfolder target/release/bundle/osx -ov -format UDZO Psst.dmg
- name: Create macOS Disk Image
if: runner.os == 'macOS'
run: hdiutil create -volname "Psst" -srcfolder target/release/bundle/osx -ov -format UDZO Psst.dmg

# Zip the DMG
zip -j Psst.dmg.zip Psst.dmg
echo "artifact_macos=Psst.dmg.zip" >> $GITHUB_OUTPUT
- name: Upload macOS Disk Image
uses: actions/upload-artifact@v4
if: runner.os == 'macOS'
with:
name: Psst.dmg
path: ./Psst.dmg

- name: Build and Package (Windows)
if: runner.os == 'Windows'
- name: Make Linux Binaries Executable
if: runner.os == 'Linux'
run: |
cargo build --release
zip -j psst-gui-win64.zip target/release/psst-gui.exe
echo "artifact_win64=psst-gui-win64.zip" >> $GITHUB_OUTPUT
chmod +x target/x86_64-unknown-linux-gnu/release/psst-gui
chmod +x target/aarch64-unknown-linux-gnu/release/psst-gui
- name: Upload Artifacts
- name: Upload Linux Binaries
uses: actions/upload-artifact@v4
if: runner.os == 'Linux'
with:
name: psst-gui-${{ runner.os }}
name: psst-gui-linux
path: |
psst-gui-*.zip
Psst.dmg.zip
target/x86_64-unknown-linux-gnu/release/psst-gui
target/aarch64-unknown-linux-gnu/release/psst-gui
- name: Upload Windows Executable
uses: actions/upload-artifact@v4
if: runner.os == 'Windows'
with:
name: Psst.exe
path: target/release/psst-gui.exe

deb:
runs-on: ubuntu-latest
Expand Down

0 comments on commit fa771dd

Please sign in to comment.