From 3e76cb62b719db218b23587f430987fa5aca53e8 Mon Sep 17 00:00:00 2001 From: Hiddify Date: Wed, 19 Jul 2023 12:57:16 +0200 Subject: [PATCH] new: make better ci and building applications --- .github/workflows/ci.yml | 63 ++++++++++++++++------- Makefile | 48 +++++++++++++++-- distribute_options.yaml | 51 +++++++++++++++++- ios/packaging/ios/make_config.yaml | 42 +++++++++++++++ linux/packaging/appimage/make_config.yaml | 42 +++++++++++++++ macos/packaging/dmg/make_config.yaml | 10 ++++ windows/packaging/exe/make_config.yaml | 3 +- windows/packaging/msix/make_config.yaml | 6 +++ 8 files changed, 240 insertions(+), 25 deletions(-) create mode 100644 ios/packaging/ios/make_config.yaml create mode 100644 linux/packaging/appimage/make_config.yaml create mode 100644 macos/packaging/dmg/make_config.yaml create mode 100644 windows/packaging/msix/make_config.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a970a7f2..d36bde6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,8 +8,34 @@ on: jobs: build: - runs-on: ubuntu-latest + continue-on-error: true + strategy: + fail-fast: false + matrix: + include: + - platform: android + os: ubuntu-latest + targets: aab,apk + - platform: windows + os: windows-latest + targets: exe + + - platform: linux + os: ubuntu-latest + targets: appimage + + - platform: macos + os: macos-latest + targets: dmg + + - platform: ios + os: macos-latest + targets: ipa + + + + runs-on: ${{ matrix.os }} steps: - name: checkout uses: actions/checkout@v3 @@ -29,12 +55,14 @@ jobs: platform: x64 - name: Setup Java + if: ${{ matrix.platform }} == "android" uses: actions/setup-java@v3 with: distribution: "zulu" java-version: 11 - name: Setup Android SDK + if: ${{ matrix.platform }} == "android" uses: android-actions/setup-android@v2 - name: Get Dependencies @@ -46,27 +74,24 @@ jobs: make gen make translate - - name: Generate Libs + - name: Generate Android Libs + if: ${{ matrix.platform }} == "android" run: | - make android-libs windows-libs + make android-libs + + - name: Generate Windows Libs + if: ${{ matrix.platform }} == "windows" + run: | + make windows-libs - - name: Release Android + - name: Release ${{ matrix.platform }} run: | - make release-android - find ./ -type f -name "*.apk" -exec cp {} . \; + make ${{ matrix.platform }}-libs + make ${{ matrix.platform }}-release + mkdir out + find ./ -type f -name "$(echo '*.${{ matrix.targets }}'| tr ',' ' ')" -exec cp {} out \; - uses: actions/upload-artifact@v3 with: - name: apk - path: ./*.apk - - - name: Release Windows - run: | - dart pub global activate flutter_distributor - flutter_distributor package --platform windows --targets exe - find ./ -type f -name "*.exe" -exec cp {} . \; - - - uses: actions/upload-artifact@v3 - with: - name: exe - path: ./*.exe + name: ${{ matrix.platform }} + path: ./out \ No newline at end of file diff --git a/Makefile b/Makefile index 98baa882..6981c2f6 100644 --- a/Makefile +++ b/Makefile @@ -9,8 +9,48 @@ gen: translate: dart run slang -android-libs: android-x64 android-arm android-arm64 +android-release: + flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi + +windows-release: + dart pub global activate flutter_distributor + flutter_distributor package --platform windows --targets exe + + +linux-release: + dart pub global activate flutter_distributor + which locate + if [ $? =! 0 ];then + sudo apt install locate + fi + which appimagetool + if [ $? =! 0 ];then + wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" + chmod +x appimagetool + mv appimagetool /usr/local/bin/ + fi + flutter_distributor package --platform linux --targets appimage + +macos-release: + dart pub global activate flutter_distributor + npm install -g appdmg + flutter_distributor package --platform macos --targets dmg + +ios-release: + flutter_distributor package --platform ios --targets ipa --build-export-options-plist ios/exportOptions.plist + + + + + + + + + + + +android-libs: android-x64 android-arm android-arm64 android-x64: cd core && env GOOS=android GOARCH=amd64 CC=$(NDK_BIN)/x86_64-linux-android21-clang $(GOBUILD) -o $(ANDROID_OUT)/x86_64/libclash.so # building android x64 clash libs @@ -23,5 +63,7 @@ android-arm64: windows-libs: cd core && env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc $(GOBUILD) -o dist/libclash.dll # building windows clash libs -release-android: - flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi + + + + diff --git a/distribute_options.yaml b/distribute_options.yaml index 9ff44987..43870fb2 100644 --- a/distribute_options.yaml +++ b/distribute_options.yaml @@ -6,9 +6,56 @@ releases: package: platform: windows target: exe - - name: release-android-bundle + + - name: release-android-apk package: platform: android target: apk build_args: - target-platform: android-arm,android-arm64,android-x64 \ No newline at end of file + target-platform: android-arm,android-arm64,android-x64 + + - name: release-android-bundle + package: + platform: android + target: aab + build_args: + target-platform: android-arm,android-arm64,android-x64 + + + - name: release-linux + package: + platform: windows + target: exe + + - name: release-ios-ipa + package: + platform: ios + target: ipa + + + - name: Release-Android + jobs: + - name: release-android-apk + package: + platform: android + target: apk + build_args: + target-platform: android-arm,android-arm64,android-x64 + + - name: release-android-bundle + package: + platform: android + target: aab + build_args: + target-platform: android-arm,android-arm64,android-x64 + + - name: Release-Linux + - name: release-linux + package: + platform: windows + target: exe + + - name: release-ios-ipa + package: + platform: ios + target: ipa \ No newline at end of file diff --git a/ios/packaging/ios/make_config.yaml b/ios/packaging/ios/make_config.yaml new file mode 100644 index 00000000..d9858857 --- /dev/null +++ b/ios/packaging/ios/make_config.yaml @@ -0,0 +1,42 @@ +display_name: Hiddify + +icon: ..\..\assets\images\logo_round.ico + +keywords: + - Hiddify + - Proxy + - VPN + - V2ray + - Nekoray + - Xray + - Psiphon + - OpenVPN + +generic_name: Hiddify + +actions: + - name: Start + label: start + arguments: + - --start + - name: Stop + label: stop + arguments: + - --stop + +categories: + - Internet + +startup_notify: true + +# You can specify the shared libraries that you want to bundle with your app +# +# flutter_distributor automatically detects the shared libraries that your app +# depends on, but you can also specify them manually here. +# +# The following example shows how to bundle the libcurl library with your app. +# +# include: +# - libcurl.so.4 +include: [] + diff --git a/linux/packaging/appimage/make_config.yaml b/linux/packaging/appimage/make_config.yaml new file mode 100644 index 00000000..d9858857 --- /dev/null +++ b/linux/packaging/appimage/make_config.yaml @@ -0,0 +1,42 @@ +display_name: Hiddify + +icon: ..\..\assets\images\logo_round.ico + +keywords: + - Hiddify + - Proxy + - VPN + - V2ray + - Nekoray + - Xray + - Psiphon + - OpenVPN + +generic_name: Hiddify + +actions: + - name: Start + label: start + arguments: + - --start + - name: Stop + label: stop + arguments: + - --stop + +categories: + - Internet + +startup_notify: true + +# You can specify the shared libraries that you want to bundle with your app +# +# flutter_distributor automatically detects the shared libraries that your app +# depends on, but you can also specify them manually here. +# +# The following example shows how to bundle the libcurl library with your app. +# +# include: +# - libcurl.so.4 +include: [] + diff --git a/macos/packaging/dmg/make_config.yaml b/macos/packaging/dmg/make_config.yaml new file mode 100644 index 00000000..5175ab65 --- /dev/null +++ b/macos/packaging/dmg/make_config.yaml @@ -0,0 +1,10 @@ +title: Hiddify +contents: + - x: 448 + y: 344 + type: link + path: "/Applications" + - x: 192 + y: 344 + type: file + path: hiddify.app diff --git a/windows/packaging/exe/make_config.yaml b/windows/packaging/exe/make_config.yaml index be04fb83..c99b93a6 100644 --- a/windows/packaging/exe/make_config.yaml +++ b/windows/packaging/exe/make_config.yaml @@ -6,4 +6,5 @@ create_desktop_icon: true install_dir_name: "{autopf64}\\hiddify" setup_icon_file: ..\..\assets\images\logo_round.ico locales: - - en \ No newline at end of file + - en + - fa \ No newline at end of file diff --git a/windows/packaging/msix/make_config.yaml b/windows/packaging/msix/make_config.yaml new file mode 100644 index 00000000..4d05d779 --- /dev/null +++ b/windows/packaging/msix/make_config.yaml @@ -0,0 +1,6 @@ +display_name: Hiddify +publisher_display_name: Hiddify +identity_name: app.hiddify.com +msix_version: 1.0.0.0 +logo_path: ..\..\assets\images\logo_round.ico +capabilities: internetClient, privateNetworkClientServer \ No newline at end of file