Adding support for Universal Binary for MacOS on M1 (#450) #530
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
code-style: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Install Linux Dependencies | |
if: ${{ runner.os == 'Linux' }} | |
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libssl-dev libasound2-dev | |
- name: Check Formatting | |
run: cargo clippy -- -D warnings | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macOS-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Install Linux Dependencies | |
if: ${{ runner.os == 'Linux' }} | |
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libssl-dev libasound2-dev | |
- name: Run Tests | |
run: cargo test | |
continue-on-error: true | |
- name: Build Release | |
run: cargo build --release | |
- name: Build aarch64 for MacOS | |
if: ${{ runner.os == 'macOS' }} | |
run: | | |
rustup target add aarch64-apple-darwin | |
cargo build --release --target aarch64-apple-darwin | |
- name: Bundle macOS Release | |
if: ${{ runner.os == 'macOS' }} | |
run: | | |
cargo install cargo-bundle | |
cargo bundle --release | |
working-directory: psst-gui | |
- name: Create macOS universal binary | |
if: ${{ runner.os == 'macOS' }} | |
run: lipo target/release/psst-gui target/aarch64-apple-darwin/release/psst-gui -create -output target/release/bundle/osx/Psst.app/Contents/MacOS/psst-gui | |
- name: Create macOS Disk Image | |
if: ${{ runner.os == 'macOS' }} | |
run: | | |
hdiutil create Psst-uncompressed.dmg -volname "Psst" -srcfolder target/release/bundle/osx | |
hdiutil convert Psst-uncompressed.dmg -format UDZO -o Psst.dmg | |
- name: Make Linux Binary Executable | |
if: ${{ runner.os == 'Linux' }} | |
run: chmod +x target/release/psst-gui | |
- name: Upload Linux Binary | |
uses: actions/upload-artifact@v3 | |
if: ${{ runner.os == 'Linux' }} | |
with: | |
name: psst-gui | |
path: target/release/psst-gui | |
- name: Upload macOS Disk Image | |
uses: actions/upload-artifact@v3 | |
if: ${{ runner.os == 'macOS' }} | |
with: | |
name: Psst.dmg | |
path: ./Psst.dmg | |
- name: Upload Windows Executable | |
uses: actions/upload-artifact@v3 | |
if: ${{ runner.os == 'Windows' }} | |
with: | |
name: Psst.exe | |
path: target/release/psst-gui.exe | |
deb: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Download Linux Binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: psst-gui | |
path: ${{runner.workspace}} | |
- name: Move Binary | |
run: mkdir -p ${{runner.workspace}}/pkg/usr/bin/; mv ${{runner.workspace}}/psst-gui $_ | |
- name: Move Desktop Entry | |
run: mkdir -p ${{runner.workspace}}/pkg/usr/share/applications/; mv .pkg/psst.desktop $_ | |
- name: Add Icons | |
run: | | |
LOGOS=$(cd ./psst-gui/assets/ && ls logo_*.png) | |
for LOGO in $LOGOS | |
do | |
LOGO_SIZE=$(echo "${LOGO}" | grep -oE '[[:digit:]]{2,}') | |
mkdir -p "${{runner.workspace}}/pkg/usr/share/icons/hicolor/${LOGO_SIZE}x${LOGO_SIZE}/" | |
cp "./psst-gui/assets/${LOGO}" "$_/psst.png" | |
done | |
- name: Set Permissions | |
run: chmod 755 ${{runner.workspace}}/pkg/usr/bin/psst-gui | |
- name: Move License | |
run: mkdir -p ${{runner.workspace}}/pkg/usr/share/doc/psst-gui/; mv .pkg/copyright $_ | |
- name: Move Package Config | |
run: mkdir -p ${{runner.workspace}}/pkg/; mv .pkg/DEBIAN $_/ | |
- name: Set Version | |
run: "echo Version: $(git rev-list --count HEAD) >> ${{runner.workspace}}/pkg/DEBIAN/control" | |
- name: Build Package | |
run: cat ${{runner.workspace}}/pkg/DEBIAN/control && dpkg-deb -b ${{runner.workspace}}/pkg/ psst_$(git rev-list --count HEAD)_amd64.deb | |
- name: Upload Debian Package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: psst-deb | |
path: "*.deb" | |
appimage: | |
if: false # Disable temporarily: https://github.com/jpochyla/psst/actions/runs/3897410142/jobs/6655282029 | |
runs-on: ubuntu-latest | |
needs: deb | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Download Debian Package | |
uses: actions/download-artifact@v3 | |
with: | |
name: psst-deb | |
path: ${{runner.workspace}} | |
- name: Install Dependencies | |
run: sudo apt-get update && sudo apt-get install -y libfuse2 | |
- name: Create Workspace | |
run: mkdir -p ${{runner.workspace}}/appimage | |
- name: Download the Latest pkg2appimage | |
run: | | |
latest_release_appimage_url=$(wget -q https://api.github.com/repos/AppImageCommunity/pkg2appimage/releases/latest -O - | jq -r '.assets[0].browser_download_url') | |
wget --directory-prefix=${{runner.workspace}}/appimage -c $latest_release_appimage_url | |
- name: Create Path to pkg2appimage | |
run: | | |
pkg2appimage_executable=$(ls ${{runner.workspace}}/appimage) | |
app_path=${{runner.workspace}}/appimage/${pkg2appimage_executable} | |
chmod +x ${app_path} | |
echo "app_path=${app_path}" >> $GITHUB_ENV | |
- name: Create Path to pkg2appimage's Recipe File | |
run: | | |
recipe_path=${{runner.workspace}}/psst/.pkg/APPIMAGE/pkg2appimage-ingredients.yml | |
echo "recipe_path=${recipe_path}" >> $GITHUB_ENV | |
- name: Run pkg2appimage | |
run: | | |
${{env.app_path}} ${{env.recipe_path}} | |
- name: Upload AppImage | |
uses: actions/upload-artifact@v3 | |
with: | |
name: psst-appimage | |
path: ${{runner.workspace}}/out/*.AppImage |