2024-06-20 19:23:17 +08:00
name : playground
2024-03-17 11:20:25 +08:00
2024-03-17 11:17:23 +08:00
on :
2024-03-30 18:27:23 +08:00
#schedule:
2024-03-30 16:55:28 +08:00
# schedule build every night
2024-03-30 18:27:23 +08:00
# - cron: "0/6 * * * *"
2024-03-17 11:20:25 +08:00
workflow_dispatch :
2024-03-17 11:17:23 +08:00
env :
2024-05-01 12:35:58 +08:00
RUST_VERSION : "1.75" # https://github.com/rustdesk/rustdesk/discussions/7503
2024-03-17 11:17:23 +08:00
CARGO_NDK_VERSION : "3.1.2"
LLVM_VERSION : "15.0.6"
2024-07-12 10:14:25 +08:00
FLUTTER_VERSION : "3.22.2"
2024-03-17 11:17:23 +08:00
FLUTTER_RUST_BRIDGE_VERSION : "1.80.1"
# for arm64 linux because official Dart SDK does not work
FLUTTER_ELINUX_VERSION : "3.16.9"
2024-05-01 14:22:51 +08:00
TAG_NAME : "nightly"
2024-03-17 11:17:23 +08:00
VCPKG_BINARY_SOURCES : "clear;x-gha,readwrite"
2024-07-03 15:53:17 +08:00
# vcpkg version: 2024.06.15
2024-07-14 03:46:48 +08:00
VCPKG_COMMIT_ID : "f7423ee180c4b7f40d43402c2feb3859161ef625"
2024-06-28 09:59:10 +08:00
VERSION : "1.2.7"
2024-05-01 14:06:44 +08:00
NDK_VERSION : "r26d"
2024-03-17 11:17:23 +08:00
#signing keys env variable checks
2024-05-01 12:58:27 +08:00
ANDROID_SIGNING_KEY : "${{ secrets.ANDROID_SIGNING_KEY }}"
MACOS_P12_BASE64 : "${{ secrets.MACOS_P12_BASE64 }}"
2024-03-17 11:17:23 +08:00
# To make a custom build with your own servers set the below secret values
2024-05-01 12:58:27 +08:00
RS_PUB_KEY : "${{ secrets.RS_PUB_KEY }}"
RENDEZVOUS_SERVER : "${{ secrets.RENDEZVOUS_SERVER }}"
API_SERVER : "${{ secrets.API_SERVER }}"
UPLOAD_ARTIFACT : "${{ inputs.upload-artifact }}"
2024-03-17 11:17:23 +08:00
SIGN_BASE_URL : "${{ secrets.SIGN_BASE_URL }}"
jobs :
2024-07-12 10:07:55 +08:00
build-for-macOS :
name : ${{ matrix.job.target }}
runs-on : ${{ matrix.job.os }}
strategy :
fail-fast : false
matrix :
job :
2024-07-14 04:28:22 +08:00
- {
target : x86_64-apple-darwin,
os : macos-13, #macos-latest or macos-14 use M1 now, https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#:~:text=14%20GB-,macos%2Dlatest%20or%20macos%2D14,-The%20macos%2Dlatestlabel
extra-build-args : "" ,
arch : x86_64,
flutter : "3.13.9" ,
ref : "f6509e3fd6917aa976bad2fc684182601ebf2434" ,
2024-07-14 04:56:03 +08:00
bridge : "1.80.1" ,
2024-07-14 04:28:22 +08:00
date : "20231219"
}
- {
target : x86_64-apple-darwin,
os : macos-13, #macos-latest or macos-14 use M1 now, https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#:~:text=14%20GB-,macos%2Dlatest%20or%20macos%2D14,-The%20macos%2Dlatestlabel
extra-build-args : "" ,
arch : x86_64,
flutter : "3.10.6" ,
ref : "f6509e3fd6917aa976bad2fc684182601ebf2434" ,
2024-07-14 04:56:03 +08:00
bridge : "1.80.1" ,
2024-07-14 04:28:22 +08:00
date : "20231219"
}
2024-07-12 10:07:55 +08:00
- {
target : x86_64-apple-darwin,
os : macos-13, #macos-latest or macos-14 use M1 now, https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#:~:text=14%20GB-,macos%2Dlatest%20or%20macos%2D14,-The%20macos%2Dlatestlabel
extra-build-args : "" ,
arch : x86_64,
2024-07-14 03:46:48 +08:00
flutter : "3.10.6" ,
2024-07-13 11:15:00 +08:00
ref : "85ddfc0739f052cab0029c46b899b959ee94eeb8" ,
2024-07-13 11:33:15 +08:00
bridge : "1.80.1" ,
2024-07-13 11:15:00 +08:00
date : "20231119"
2024-07-12 23:44:25 +08:00
}
2024-07-14 03:47:15 +08:00
- {
target : x86_64-apple-darwin,
os : macos-13, #macos-latest or macos-14 use M1 now, https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#:~:text=14%20GB-,macos%2Dlatest%20or%20macos%2D14,-The%20macos%2Dlatestlabel
extra-build-args : "" ,
arch : x86_64,
flutter : "3.13.9" ,
ref : "85ddfc0739f052cab0029c46b899b959ee94eeb8" ,
bridge : "1.80.1" ,
date : "20231119"
}
2024-07-12 10:07:55 +08:00
steps :
- name : Export GitHub Actions cache environment variables
uses : actions/github-script@v6
with :
script : |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name : Checkout source code
uses : actions/checkout@v3
2024-07-12 23:44:25 +08:00
with :
ref : ${{ matrix.job.ref }}
2024-07-12 10:07:55 +08:00
- name : Import the codesign cert
if : env.MACOS_P12_BASE64 != null
uses : apple-actions/import-codesign-certs@v1
with :
p12-file-base64 : ${{ secrets.MACOS_P12_BASE64 }}
p12-password : ${{ secrets.MACOS_P12_PASSWORD }}
keychain : rustdesk
- name : Check sign and import sign key
if : env.MACOS_P12_BASE64 != null
run : |
security default-keychain -s rustdesk.keychain
security find-identity -v
- name : Import notarize key
if : env.MACOS_P12_BASE64 != null
uses : timheuer/base64-to-file@v1.2
with :
# https://gregoryszorc.com/docs/apple-codesign/stable/apple_codesign_rcodesign.html#notarizing-and-stapling
fileName : rustdesk.json
fileDir : ${{ github.workspace }}
encodedString : ${{ secrets.MACOS_NOTARIZE_JSON }}
- name : Install rcodesign tool
if : env.MACOS_P12_BASE64 != null
shell : bash
run : |
pushd /tmp
wget https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.22.0/apple-codesign-0.22.0-macos-universal.tar.gz
tar -zxvf apple-codesign-0.22.0-macos-universal.tar.gz
mv apple-codesign-0.22.0-macos-universal/rcodesign /usr/local/bin
popd
- name : Install build runtime
run : |
brew install llvm create-dmg nasm cmake gcc wget ninja pkg-config
- name : Install flutter
uses : subosito/flutter-action@v2
with :
channel : "stable"
2024-07-12 10:41:13 +08:00
flutter-version : ${{ matrix.job.flutter }}
2024-07-12 10:07:55 +08:00
- name : Install Rust toolchain
uses : dtolnay/rust-toolchain@v1
with :
toolchain : ${{ env.RUST_VERSION }}
targets : ${{ matrix.job.target }}
components : "rustfmt"
- uses : Swatinem/rust-cache@v2
with :
prefix-key : ${{ matrix.job.os }}
- name : Install flutter rust bridge deps
shell : bash
run : |
2024-07-14 04:56:03 +08:00
sed -i '' 's/3.1.0/2.17.0/g' flutter/pubspec.yaml;
2024-07-13 11:33:15 +08:00
cargo install flutter_rust_bridge_codegen --version ${{ matrix.job.bridge }} --features "uuid"
2024-07-12 23:44:25 +08:00
# below works for mac to make buildable on 3.13.9
# pushd flutter/lib; find . -name "*.dart" | xargs -I{} sed -i '' 's/textScaler: TextScaler.linear(\(.*\)),/textScaleFactor: \1,/g' {}; popd;
2024-07-12 10:07:55 +08:00
pushd flutter && flutter pub get && popd
~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart --c-output ./flutter/macos/Runner/bridge_generated.h
- name : Setup vcpkg with Github Actions binary cache
uses : lukka/run-vcpkg@v11
with :
vcpkgGitCommitId : ${{ env.VCPKG_COMMIT_ID }}
- name : Install vcpkg dependencies
run : |
$VCPKG_ROOT/vcpkg install --x-install-root="$VCPKG_ROOT/installed"
2024-07-13 16:08:07 +08:00
- name : Restore from cache and install vcpkg
uses : lukka/run-vcpkg@v7
2024-07-14 03:46:48 +08:00
if : false
2024-07-13 16:08:07 +08:00
with :
setupOnly : true
vcpkgGitCommitId : ${{ env.VCPKG_COMMIT_ID }}
- name : Install vcpkg dependencies
2024-07-14 03:46:48 +08:00
if : false
2024-07-13 16:08:07 +08:00
run : |
$VCPKG_ROOT/vcpkg install libvpx libyuv opus aom
2024-07-12 10:07:55 +08:00
- name : Show version information (Rust, cargo, Clang)
shell : bash
run : |
clang --version || true
rustup -V
rustup toolchain list
rustup default
cargo -V
rustc -V
- name : Build rustdesk
run : |
2024-07-13 01:03:43 +08:00
./build.py --flutter ${{ matrix.job.extra-build-args }}
2024-07-12 10:07:55 +08:00
- name : create unsigned dmg
run : |
CREATE_DMG="$(command -v create-dmg)"
CREATE_DMG="$(readlink -f "$CREATE_DMG")"
sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG"
create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app
- name : Codesign app and create signed dmg
2024-07-12 10:41:13 +08:00
if : env.MACOS_P12_BASE64 != null
2024-07-12 10:07:55 +08:00
run : |
# Patch create-dmg to give more attempts to unmount image
CREATE_DMG="$(command -v create-dmg)"
CREATE_DMG="$(readlink -f "$CREATE_DMG")"
sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG"
# Unlock keychain
security default-keychain -s rustdesk.keychain
security unlock-keychain -p ${{ secrets.MACOS_P12_PASSWORD }} rustdesk.keychain
# start sign the rustdesk.app and dmg
rm -rf *.dmg || true
codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict ./flutter/build/macos/Build/Products/Release/RustDesk.app -vvv
create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app
codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict rustdesk-${{ env.VERSION }}.dmg -vvv
# notarize the rustdesk-${{ env.VERSION }}.dmg
rcodesign notary-submit --api-key-path ${{ github.workspace }}/rustdesk.json --staple rustdesk-${{ env.VERSION }}.dmg
- name : Rename rustdesk
run : |
for name in rustdesk*??.dmg; do
2024-07-12 23:44:25 +08:00
mv "$name" "${name%%.dmg}-${{ matrix.job.arch }}-flutter${{ matrix.job.flutter }}-flutter${{ matrix.job.date }}.dmg"
2024-07-12 10:07:55 +08:00
done
- name : Publish DMG package
uses : softprops/action-gh-release@v1
with :
prerelease : true
tag_name : ${{ env.TAG_NAME }}
files : |
2024-07-12 10:44:04 +08:00
rustdesk*-${{ matrix.job.arch }}*.dmg
2024-07-12 10:07:55 +08:00
2024-06-20 19:16:51 +08:00
build-rustdesk-android :
2024-07-12 10:07:55 +08:00
if : false
2024-06-20 19:16:51 +08:00
name : build rustdesk android apk ${{ matrix.job.target }}
runs-on : ${{ matrix.job.os }}
2024-04-26 19:00:38 +08:00
strategy :
fail-fast : false
2024-04-30 12:02:20 +08:00
matrix :
job :
- {
2024-05-02 16:50:11 +08:00
arch : aarch64,
2024-06-20 19:16:51 +08:00
target : aarch64-linux-android,
os : ubuntu-20.04,
openssl-arch : android-arm64,
2024-06-21 17:42:58 +08:00
ref : master, # latest
2024-04-30 12:02:20 +08:00
}
2024-03-17 11:17:23 +08:00
steps :
2024-05-01 12:25:53 +08:00
- name : Checkout source code
uses : actions/checkout@v3
2024-06-20 19:16:51 +08:00
with :
2024-06-20 19:48:40 +08:00
ref : ${{ matrix.job.ref }}
2024-05-01 12:25:53 +08:00
2024-06-20 19:16:51 +08:00
- name : Install dependencies
2024-05-01 12:25:53 +08:00
run : |
2024-06-20 19:16:51 +08:00
sudo apt-get update
sudo apt-get install -y \
clang \
cmake \
curl \
gcc-multilib \
git \
g++ \
g++-multilib \
libappindicator3-dev \
libasound2-dev \
libc6-dev \
libclang-10-dev \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libgtk-3-dev \
libpam0g-dev \
libpulse-dev \
libva-dev \
libvdpau-dev \
libxcb-randr0-dev \
libxcb-shape0-dev \
libxcb-xfixes0-dev \
libxdo-dev \
libxfixes-dev \
llvm-10-dev \
nasm \
2024-06-20 21:28:27 +08:00
yasm \
2024-06-20 19:16:51 +08:00
ninja-build \
openjdk-11-jdk-headless \
pkg-config \
tree \
wget
2024-05-01 12:25:53 +08:00
2024-06-20 19:16:51 +08:00
- name : Install flutter
uses : subosito/flutter-action@v2
2024-05-01 12:25:53 +08:00
with :
2024-06-20 19:16:51 +08:00
channel : "stable"
flutter-version : ${{ env.FLUTTER_VERSION }}
2024-05-02 16:50:11 +08:00
2024-06-20 19:16:51 +08:00
- name : Install Rust toolchain
uses : dtolnay/rust-toolchain@v1
2024-05-01 12:25:53 +08:00
with :
2024-06-20 19:16:51 +08:00
toolchain : ${{ env.RUST_VERSION }}
components : "rustfmt"
2024-05-01 12:25:53 +08:00
2024-06-20 19:16:51 +08:00
- name : Install flutter rust bridge deps
2024-05-02 16:50:11 +08:00
run : |
2024-06-20 19:16:51 +08:00
git config --global core.longpaths true
cargo install flutter_rust_bridge_codegen --version ${{ env.FLUTTER_RUST_BRIDGE_VERSION }} --features "uuid"
2024-06-21 01:29:00 +08:00
sed -i 's/uni_links_desktop/#uni_links_desktop/g' flutter/pubspec.yaml
2024-06-21 17:42:58 +08:00
pushd flutter/lib; find . | grep dart | xargs sed -i 's/textScaler: TextScaler.linear(\(.*\)),/textScaleFactor : \1,/g'; popd;
2024-06-20 19:23:17 +08:00
pushd flutter ; flutter pub get ; popd
2024-06-20 19:16:51 +08:00
~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart
2024-05-02 16:50:11 +08:00
2024-06-20 19:16:51 +08:00
- uses : nttld/setup-ndk@v1
id : setup-ndk
2024-05-02 18:14:42 +08:00
with :
2024-06-21 00:15:21 +08:00
ndk-version : ${{ env.NDK_VERSION }}
2024-06-20 19:16:51 +08:00
add-to-path : true
2024-05-02 18:14:42 +08:00
2024-06-20 19:16:51 +08:00
- name : Setup vcpkg with Github Actions binary cache
uses : lukka/run-vcpkg@v11
with :
vcpkgDirectory : /opt/artifacts/vcpkg
vcpkgGitCommitId : ${{ env.VCPKG_COMMIT_ID }}
- name : Install vcpkg dependencies
run : |
case ${{ matrix.job.target }} in
aarch64-linux-android)
./flutter/build_android_deps.sh arm64-v8a
;;
armv7-linux-androideabi)
./flutter/build_android_deps.sh armeabi-v7a
;;
esac
shell : bash
2024-06-20 21:53:43 +08:00
- name : Clone deps
shell : bash
run : |
pushd /opt
git clone https://github.com/rustdesk-org/rustdesk_thirdparty_lib.git --depth=1
2024-06-20 23:21:08 +08:00
ls -ls /opt/artifacts/vcpkg/installed/arm64-android/lib/
2024-06-21 00:15:21 +08:00
# cp -rf /opt/rustdesk_thirdparty_lib/vcpkg/* /opt/artifacts/vcpkg/
2024-06-20 23:21:08 +08:00
ls -ls /opt/artifacts/vcpkg/installed/arm64-android/lib/
2024-06-20 21:53:43 +08:00
2024-06-20 19:16:51 +08:00
- name : Build rustdesk lib
env :
ANDROID_NDK_HOME : ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_NDK_ROOT : ${{ steps.setup-ndk.outputs.ndk-path }}
run : |
rustup target add ${{ matrix.job.target }}
cargo install cargo-ndk --version ${{ env.CARGO_NDK_VERSION }}
case ${{ matrix.job.target }} in
aarch64-linux-android)
./flutter/ndk_arm64.sh
mkdir -p ./flutter/android/app/src/main/jniLibs/arm64-v8a
cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/librustdesk.so
;;
armv7-linux-androideabi)
./flutter/ndk_arm.sh
mkdir -p ./flutter/android/app/src/main/jniLibs/armeabi-v7a
cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/armeabi-v7a/librustdesk.so
;;
esac
2024-05-02 17:03:20 +08:00
2024-06-20 19:16:51 +08:00
- name : Build rustdesk
shell : bash
env :
JAVA_HOME : /usr/lib/jvm/java-11-openjdk-amd64
2024-05-02 17:03:20 +08:00
run : |
2024-06-20 19:16:51 +08:00
export PATH=/usr/lib/jvm/java-11-openjdk-amd64/bin:$PATH
# temporary use debug sign config
sed -i "s/signingConfigs.release/signingConfigs.debug/g" ./flutter/android/app/build.gradle
case ${{ matrix.job.target }} in
aarch64-linux-android)
mkdir -p ./flutter/android/app/src/main/jniLibs/arm64-v8a
cp ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/
cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/librustdesk.so
# build flutter
pushd flutter
flutter build apk --release --target-platform android-arm64 --split-per-abi
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ../rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.apk
;;
armv7-linux-androideabi)
mkdir -p ./flutter/android/app/src/main/jniLibs/armeabi-v7a
cp ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++_shared.so ./flutter/android/app/src/main/jniLibs/armeabi-v7a/
cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/armeabi-v7a/librustdesk.so
# build flutter
pushd flutter
flutter build apk --release --target-platform android-arm --split-per-abi
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk ../rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.apk
;;
esac
popd
mkdir -p signed-apk; pushd signed-apk
2024-06-20 21:28:27 +08:00
mv ../rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.apk ./rustdesk-test-${{ matrix.job.ref }}-${{ matrix.job.ndk }}.apk
2024-05-02 17:03:20 +08:00
2024-06-20 19:16:51 +08:00
- uses : r0adkll/sign-android-release@v1
name : Sign app APK
if : env.ANDROID_SIGNING_KEY != null
id : sign-rustdesk
2024-05-02 16:50:11 +08:00
with :
2024-06-20 19:16:51 +08:00
releaseDirectory : ./signed-apk
signingKeyBase64 : ${{ secrets.ANDROID_SIGNING_KEY }}
alias : ${{ secrets.ANDROID_ALIAS }}
keyStorePassword : ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
keyPassword : ${{ secrets.ANDROID_KEY_PASSWORD }}
env :
# override default build-tools version (29.0.3) -- optional
BUILD_TOOLS_VERSION : "30.0.2"
2024-05-02 16:50:11 +08:00
2024-06-20 19:16:51 +08:00
- name : Publish signed apk package
2024-04-30 12:02:20 +08:00
uses : softprops/action-gh-release@v1
with :
prerelease : true
tag_name : ${{ env.TAG_NAME }}
files : |
2024-06-20 19:16:51 +08:00
${{steps.sign-rustdesk.outputs.signedReleaseFile}}