Skip to content

Commit

Permalink
fix linux ci
Browse files Browse the repository at this point in the history
  • Loading branch information
louis030195 committed Jul 5, 2024
1 parent 22c0b54 commit f05c577
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 168 deletions.
167 changes: 14 additions & 153 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# testing locally with act cli

# ubuntu:
# act --privileged --container-architecture linux/amd64 -W .github/workflows/release.yml --env ACTIONS_RUNTIME_URL=http://host.docker.internal:8080/ --env ACTIONS_RUNTIME_TOKEN=foo --env ACTIONS_CACHE_URL=http://host.docker.internal:8080/ --artifact-server-path out -j build-ubuntu -P ubuntu-latest=-self-hosted --env-file .env --secret-file .secrets

# for mac target
# act --privileged --container-architecture linux/amd64 -W .github/workflows/release.yml --env ACTIONS_RUNTIME_URL=http://host.docker.internal:8080/ --env ACTIONS_RUNTIME_TOKEN=foo --env ACTIONS_CACHE_URL=http://host.docker.internal:8080/ --artifact-server-path out -j build-macos -P macos-latest=-self-hosted --env-file .env --secret-file .secrets

# run the whole thing
# act --privileged --container-architecture linux/amd64 -W .github/workflows/release.yml --env ACTIONS_RUNTIME_URL=http://host.docker.internal:8080/ --env ACTIONS_RUNTIME_TOKEN=foo --env ACTIONS_CACHE_URL=http://host.docker.internal:8080/ --artifact-server-path out -P ubuntu-latest=-self-hosted --env-file .env --secret-file .secrets

name: Release

on:
Expand All @@ -19,16 +8,14 @@ on:
jobs:
build-ubuntu:
runs-on: ubuntu-latest
outputs:
asset_path: ${{ steps.upload.outputs.asset_path }}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libavformat-dev libavfilter-dev libavdevice-dev ffmpeg libasound2-dev chrpath
sudo apt-get install -y libavformat-dev libavfilter-dev libavdevice-dev ffmpeg libasound2-dev
- name: Set up Rust
uses: actions-rs/toolchain@v1
Expand All @@ -51,156 +38,34 @@ jobs:
cp /usr/lib/x86_64-linux-gnu/libavutil.so* target/release/lib/
cp /usr/lib/x86_64-linux-gnu/libswresample.so* target/release/lib/
cp /usr/lib/x86_64-linux-gnu/libswscale.so* target/release/lib/
cp /usr/lib/x86_64-linux-gnu/libavfilter.so* target/release/lib/
cp /usr/lib/x86_64-linux-gnu/libavdevice.so* target/release/lib/
- name: Verify RPATH
- name: Create deployment package
run: |
chrpath -l target/release/pipe
- name: Set RPATH
run: |
chrpath -r '$ORIGIN/lib' target/release/pipe
mkdir -p screenpipe-linux
cp target/release/pipe screenpipe-linux/screenpipe
cp -r target/release/lib screenpipe-linux/
chmod +x screenpipe-linux/screenpipe
tar -czvf screenpipe-linux.tar.gz screenpipe-linux
- name: Upload Artifact
id: upload
uses: actions/upload-artifact@v2
with:
name: screenpipe-ubuntu
path: |
target/release/pipe
target/release/lib
# build-macos:
# runs-on: macos-latest
# outputs:
# asset_path: ${{ steps.upload.outputs.asset_path }}
# steps:
# - name: Checkout code
# uses: actions/checkout@v2

# - name: Build with dynamic FFmpeg
# run: |
# export PKG_CONFIG_PATH="/usr/local/opt/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH"
# export LIBRARY_PATH="$LIBRARY_PATH:/opt/homebrew/lib"
# export RUSTFLAGS="-C link-arg=-Wl,-rpath,@executable_path/../Frameworks"
# cargo build --release

# - name: Create app bundle
# run: |
# mkdir -p Screenpipe.app/Contents/MacOS
# mkdir -p Screenpipe.app/Contents/Frameworks

# # find the actual binary name
# BINARY_NAME=$(find target/release -type f -perm +111 -print | head -n 1)
# echo "Binary found: $BINARY_NAME"

# # copy the binary
# cp "$BINARY_NAME" Screenpipe.app/Contents/MacOS/screenpipe

# # copy ffmpeg dylibs
# cp /opt/homebrew/opt/ffmpeg/lib/libavcodec.dylib Screenpipe.app/Contents/Frameworks/
# cp /opt/homebrew/opt/ffmpeg/lib/libavformat.dylib Screenpipe.app/Contents/Frameworks/
# cp /opt/homebrew/opt/ffmpeg/lib/libavutil.dylib Screenpipe.app/Contents/Frameworks/
# cp /opt/homebrew/opt/ffmpeg/lib/libswresample.dylib Screenpipe.app/Contents/Frameworks/
# cp /opt/homebrew/opt/ffmpeg/lib/libswscale.dylib Screenpipe.app/Contents/Frameworks/

# # update rpath
# install_name_tool -change /opt/homebrew/opt/ffmpeg/lib/libavcodec.dylib @executable_path/../Frameworks/libavcodec.dylib Screenpipe.app/Contents/MacOS/screenpipe
# install_name_tool -change /opt/homebrew/opt/ffmpeg/lib/libavformat.dylib @executable_path/../Frameworks/libavformat.dylib Screenpipe.app/Contents/MacOS/screenpipe
# install_name_tool -change /opt/homebrew/opt/ffmpeg/lib/libavutil.dylib @executable_path/../Frameworks/libavutil.dylib Screenpipe.app/Contents/MacOS/screenpipe
# install_name_tool -change /opt/homebrew/opt/ffmpeg/lib/libswresample.dylib @executable_path/../Frameworks/libswresample.dylib Screenpipe.app/Contents/MacOS/screenpipe
# install_name_tool -change /opt/homebrew/opt/ffmpeg/lib/libswscale.dylib @executable_path/../Frameworks/libswscale.dylib Screenpipe.app/Contents/MacOS/screenpipe

# # list contents for debugging
# echo "Contents of Screenpipe.app/Contents/MacOS:"
# ls -l Screenpipe.app/Contents/MacOS
# echo "Contents of Screenpipe.app/Contents/Frameworks:"
# ls -l Screenpipe.app/Contents/Frameworks

# - name: Import Code Signing Certificates
# env:
# MACOS_SIGNING_KEY: ${{ secrets.MACOS_SIGNING_KEY }}
# MACOS_SIGNING_KEY_PASSWORD: ${{ secrets.MACOS_SIGNING_KEY_PASSWORD }}
# run: |
# # create variables
# CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
# KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db

# # import certificate from secrets
# echo -n "$MACOS_SIGNING_KEY" | base64 --decode --output $CERTIFICATE_PATH

# echo "Certificate file size: $(wc -c < $CERTIFICATE_PATH)"

# # create temporary keychain
# security create-keychain -p "temp_password" $KEYCHAIN_PATH
# security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
# security unlock-keychain -p "temp_password" $KEYCHAIN_PATH

# # import certificate to keychain
# security import $CERTIFICATE_PATH -P "$MACOS_SIGNING_KEY_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
# security import $CERTIFICATE_PATH -P "$MACOS_SIGNING_KEY_PASSWORD" -A -t priv -f pkcs12 -k $KEYCHAIN_PATH

# # add keychain to search list
# security list-keychain -d user -s $KEYCHAIN_PATH

# # set key partition list
# security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "temp_password" $KEYCHAIN_PATH

# echo "Keychain contents:"
# security dump-keychain $KEYCHAIN_PATH

# echo "Codesigning identities:"
# security find-identity -v -p codesigning $KEYCHAIN_PATH

# - name: Sign app bundle
# env:
# MACOS_SIGNING_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY }}
# run: |
# echo "Available codesigning identities:"
# security find-identity -v -p codesigning

# echo "Attempting to sign with identity: $MACOS_SIGNING_IDENTITY"
# codesign --force --options runtime --deep --verbose --timestamp --sign "$MACOS_SIGNING_IDENTITY" Screenpipe.app

# - name: Copy icon
# run: cp assets/Assets.xcassets/AppIcon.appiconset/1024-mac.png ./AppIcon.png

# - name: Create DMG
# run: create-dmg --volname "Screenpipe" --window-pos 200 120 --window-size 600 300 --icon-size 100 --icon "Screenpipe.app" 175 120 --hide-extension "Screenpipe.app" --app-drop-link 425 120 --volicon "AppIcon.png" "Screenpipe.dmg" "Screenpipe.app"

# - name: Notarize DMG
# env:
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
# TEAM_ID: ${{ secrets.TEAM_ID }}
# run: |
# xcrun notarytool submit Screenpipe.dmg --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$TEAM_ID" --wait
# xcrun stapler staple Screenpipe.dmg

# - name: Upload Artifact
# id: upload
# uses: actions/upload-artifact@v2
# with:
# name: screenpipe-macos
# path: Screenpipe.dmg
name: screenpipe-linux
path: screenpipe-linux.tar.gz

release:
runs-on: ubuntu-latest
needs: [build-ubuntu] #, build-macos] # todo windows
needs: [build-ubuntu]
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: screenpipe-ubuntu
path: ./artifacts/ubuntu

# - name: Download Artifacts
# uses: actions/download-artifact@v2
# with:
# name: screenpipe-macos
# path: ./artifacts/macos
name: screenpipe-linux

- name: Set Version
shell: bash
Expand All @@ -213,8 +78,4 @@ jobs:
GH_TOKEN: ${{ secrets.PAT }}
run: |
gh release create ${{ env.RELEASE_VERSION }} --title ${{ env.RELEASE_VERSION }} --generate-notes
mv ./artifacts/ubuntu/pipe ./artifacts/ubuntu/screenpipe-ubuntu
tar -czvf ./artifacts/ubuntu/screenpipe-ubuntu-with-libs.tar.gz -C ./artifacts/ubuntu screenpipe-ubuntu lib
# mv ./artifacts/macos/screenpipe ./artifacts/macos/screenpipe-macos
# gh release upload ${{ env.RELEASE_VERSION }} ./artifacts/ubuntu/* ./artifacts/macos/*
gh release upload ${{ env.RELEASE_VERSION }} ./artifacts/ubuntu/screenpipe-ubuntu-with-libs.tar.gz
gh release upload ${{ env.RELEASE_VERSION }} screenpipe-linux.tar.gz
30 changes: 15 additions & 15 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,12 @@ ARCH=$(uname -m)
case $OS in
Linux*)
case $ARCH in
# x86_64) BINARY="screenpipe-x86_64-unknown-linux-gnu";;
# aarch64) BINARY="screenpipe-aarch64-unknown-linux-gnu";;
x86_64) BINARY="screenpipe-linux";;
# aarch64) BINARY="screenpipe-linux";;
x86_64) BINARY="screenpipe-linux.tar.gz";;
*) echo "Unsupported architecture: $ARCH"; exit 1;;
esac
;;
Darwin*)
case $ARCH in
# x86_64) BINARY="screenpipe-x86_64-apple-darwin";;
# arm64) BINARY="screenpipe-aarch64-apple-darwin";;
# x86_64) BINARY="screenpipe-macos";;
arm64) BINARY="screenpipe-macos";;
*) echo "Unsupported architecture: $ARCH"; exit 1;;
esac
Expand All @@ -39,11 +33,17 @@ mkdir -p $HOME/.local/bin

echo "Downloading $BINARY"

# Download the latest release binary to the local bin directory
curl -L "https://github.com/$REPO/releases/download/$LATEST_RELEASE/$BINARY" -o $HOME/.local/bin/screenpipe

# Make the binary executable
chmod +x $HOME/.local/bin/screenpipe

echo "screenpipe installed successfully! Please add $HOME/.local/bin to your PATH if it's not already included."

if [ "$OS" = "Linux" ]; then
# Download and extract the tarball for Linux
curl -L "https://github.com/$REPO/releases/download/$LATEST_RELEASE/$BINARY" -o /tmp/screenpipe-linux.tar.gz
tar -xzvf /tmp/screenpipe-linux.tar.gz -C $HOME/.local/bin
mv $HOME/.local/bin/screenpipe-linux/* $HOME/.local/bin/
rm -rf $HOME/.local/bin/screenpipe-linux /tmp/screenpipe-linux.tar.gz
chmod +x $HOME/.local/bin/screenpipe
else
# Download the binary for macOS
curl -L "https://github.com/$REPO/releases/download/$LATEST_RELEASE/$BINARY" -o $HOME/.local/bin/screenpipe
chmod +x $HOME/.local/bin/screenpipe
fi

echo "screenpipe installed successfully! Please add $HOME/.local/bin to your PATH if it's not already included."

0 comments on commit f05c577

Please sign in to comment.