Change build setup

This commit is contained in:
problematicconsumer
2023-09-22 14:16:21 +03:30
parent 1f0c06df96
commit 84673ed4b0
5 changed files with 58 additions and 327 deletions

View File

@@ -1,4 +1,4 @@
name: CI & Build name: Build
on: on:
push: push:
branches: branches:
@@ -9,13 +9,15 @@ on:
- '**.md' - '**.md'
- 'docs/**' - 'docs/**'
- '.github/**' - '.github/**'
- '!.github/workflows/ci.yml' - '!.github/workflows/build.yml'
pull_request: pull_request:
branches: branches:
- main - main
concurrency: concurrency:
group: ${{ github.ref }}-${{ github.workflow }} group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true cancel-in-progress: true
env:
CHANNEL: ${{ github.ref_type == 'tag' && endsWith(github.ref_name, 'dev') && 'dev' || github.ref_type != 'tag' && 'dev' || 'prod' }}
jobs: jobs:
build: build:
permissions: write-all permissions: write-all
@@ -56,20 +58,6 @@ jobs:
- name: checkout - name: checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
# - name: Cache Flutter dependencies
# uses: actions/cache@v3
# with:
# path: |
# ~/.pub-cache
# ~/.gradle/caches
# ~/.gradle/wrapper
# ~/.npm
# ~/.cache
# ~/go/pkg/mod
# key: ${{ runner.os }}-pub-cache-${{ hashFiles('**/pubspec.lock') }}
# restore-keys: |
# ${{ runner.os }}-pub-cache-
- name: Setup Flutter - name: Setup Flutter
uses: subosito/flutter-action@v2 uses: subosito/flutter-action@v2
with: with:
@@ -118,8 +106,6 @@ jobs:
make gen make gen
- name: Get Libs ${{ matrix.platform }} - name: Get Libs ${{ matrix.platform }}
env:
BRANCH: ${{ github.ref_type == 'tag' && 'RELEASE' || 'DEVELOP' }}
run: | run: |
make ${{ matrix.platform }}-libs make ${{ matrix.platform }}-libs
@@ -145,12 +131,12 @@ jobs:
- name: Release ${{ matrix.platform }} - name: Release ${{ matrix.platform }}
env: env:
BRANCH: ${{ github.ref_type == 'tag' && 'RELEASE' || 'DEVELOP' }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
run: | run: |
make ${{ matrix.platform }}-release make ${{ matrix.platform }}-release
- name: Upload Debug Symbols - name: Upload Debug Symbols
if: ${{ github.ref_type == 'tag' }}
env: env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
@@ -215,7 +201,7 @@ jobs:
upload-draft: upload-draft:
permissions: write-all permissions: write-all
if: ${{ github.ref_type=='branch' }} if: ${{ github.ref_type == 'branch' }}
needs: [build] needs: [build]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -238,8 +224,7 @@ jobs:
- name: Create or Update Draft Release - name: Create or Update Draft Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
if: github.ref_type != 'tag' if: ${{ github.ref_type != 'tag' }}
#&& success()
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
@@ -250,7 +235,7 @@ jobs:
upload-release: upload-release:
permissions: write-all permissions: write-all
if: ${{ github.ref_type=='tag' }} if: ${{ github.ref_type == 'tag' }}
needs: [build] needs: [build]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -269,7 +254,7 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
prerelease: ${{ contains(github.ref_name,'dev') }} prerelease: ${{ CHANNEL == 'dev' }}
tag_name: ${{ github.ref_name }} tag_name: ${{ github.ref_name }}
files: ./out/* files: ./out/*

View File

@@ -1,251 +0,0 @@
name: build
on:
workflow_dispatch:
# release:
# types: [ published ]
# workflow_run:
# workflows: ["build"]
# types:
# - completed
jobs:
get-release:
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.get-release.outputs.tag_name }}
upload_url: ${{ steps.get-release.outputs.upload_url }}
steps:
- uses: actions/checkout@v3
- uses: thebritican/fetch-latest-release@v2.0.0
id: get-release
build-windows:
runs-on: windows-latest
needs: [ get-release ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "^1.20"
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.2'
channel: 'stable'
- name: Build
env:
VERSION: ${{ needs.get-release.outputs.tag_name }}
run: |
cd core
go build -ldflags="-w -s" -buildmode=c-shared -o ./dist/libclash.dll mapleafgo.cn/clash_for_flutter/core
cd ../
dart pub global activate flutter_distributor
flutter_distributor package --platform=windows --targets=exe
- uses: actions/upload-artifact@v3
with:
name: android
path: dist/*/*
retention-days: 2
- name: Upload
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.get-release.outputs.upload_url }}
asset_path: dist/*/*
overwrite: true
build-android:
runs-on: ubuntu-latest
needs: [ get-release ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4.0.1
with:
go-version: "^1.20"
- name: Set up MinGW
uses: egor-tensin/setup-mingw@v2
with:
platform: x64
- name: Setup Java
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
run: |
flutter pub get
- name: Generate
run: |
dart run build_runner build --delete-conflicting-outputs
dart run slang
- name: Generate Libs Android
run: |
make android-libs
- name: Release Android
run: |
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
- name: Copy to out
run: |
mkdir out
IFS=',' read -r -a EXT_ARRAY <<< "${{ matrix.targets }}"
# Loop over extensions
for EXT in "${EXT_ARRAY[@]}"; do
# Find all files with this extension in SRC_DIR, and copy them to DST_DIR
find "." -type f -name "*.$EXT" -exec cp {} "out" \;
done
- uses: actions/upload-artifact@v3
with:
name: android
path: ./out
retention-days: 2
- name: Upload
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.get-release.outputs.upload_url }}
asset_path: out/*
overwrite: true
build-linux:
runs-on: ubuntu-20.04
needs: [ get-release ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "^1.20"
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.2'
channel: 'stable'
- run: |
sudo apt-get update -y
sudo apt-get install -y locate ninja-build libgtk-3-dev libayatana-appindicator3-dev libnotify-dev \
binutils coreutils desktop-file-utils fakeroot fuse libgdk-pixbuf2.0-dev patchelf python3-pip python3-setuptools squashfs-tools strace util-linux zsync
- name: Build
env:
VERSION: ${{ needs.get-release.outputs.tag_name }}
run: |
curl -L https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -o /usr/local/bin/appimagetool
chmod +x /usr/local/bin/appimagetool
cd core
go build -ldflags="-w -s" -buildmode=c-shared -o ./dist/libclash.so mapleafgo.cn/clash_for_flutter/core
cd ../
dart pub global activate flutter_distributor
flutter_distributor package --platform=linux --targets=appimage,zip
- uses: actions/upload-artifact@v3
with:
name: linux
path: dist/*/*
retention-days: 2
- name: Upload
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.get-release.outputs.upload_url }}
asset_path: dist/*/*
overwrite: true
build-macos-arm64-lib:
runs-on: ubuntu-latest
needs: [ get-release ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "^1.20"
- run: mkdir -p ~/image-cache
- id: image-cache
uses: actions/cache@v3
with:
path: ~/image-cache
key: image-cache-xgo-v1.20
- if: steps.image-cache.outputs.cache-hit != 'true'
run: |
docker pull techknowlogick/xgo:go-1.20.x
docker save -o ~/image-cache/xgo.tar techknowlogick/xgo:go-1.20.x
- if: steps.image-cache.outputs.cache-hit == 'true'
run: docker load -i ~/image-cache/xgo.tar
- name: Build
run: |
cd core
go install src.techknowlogick.com/xgo@latest
xgo --targets=darwin/arm64 -ldflags="-w -s" -buildmode=c-shared -out=libclash .
mv libclash-*.dylib libclash.dylib
- uses: actions/upload-artifact@v3
with:
name: macos-arm64-lib
path: core/libclash.dylib
retention-days: 2
build-macos:
runs-on: macos-latest
needs: [ get-release, build-macos-arm64-lib ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "^1.20"
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.2'
channel: 'stable'
- name: Install appdmg
run: npm install -g appdmg
- name: Mkdir Frameworks
run: mkdir -p macos/Frameworks
- uses: actions/download-artifact@v3
with:
name: macos-arm64-lib
path: macos/Frameworks
- name: Build
env:
VERSION: ${{ needs.get-release.outputs.tag_name }}
run: |
PROJECT_DIR=$(pwd)
dart pub global activate flutter_distributor
flutter_distributor package --platform=macos --targets=dmg
mv dist/$VERSION/*-macos.dmg dist/$VERSION/macos-arm64.dmg
cd $PROJECT_DIR/core
go build -ldflags="-w -s" -buildmode=c-shared -o ./dist/libclash.dylib mapleafgo.cn/clash_for_flutter/core
cp -f ./dist/libclash.dylib $PROJECT_DIR/macos/Frameworks/libclash.dylib
cd $PROJECT_DIR
flutter_distributor package --platform=macos --targets=dmg
mv dist/$VERSION/*-macos.dmg dist/$VERSION/macos-amd64.dmg
- uses: actions/upload-artifact@v3
with:
name: macos
path: dist/*/*
retention-days: 2
- name: Upload
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.get-release.outputs.upload_url }}
asset_path: dist/*/*
overwrite: true

View File

@@ -5,21 +5,19 @@ ANDROID_OUT=./android/app/libs
DESKTOP_OUT=./libcore/bin DESKTOP_OUT=./libcore/bin
GEO_ASSETS_DIR=./assets/core GEO_ASSETS_DIR=./assets/core
# BRANCH=$(shell git branch --show-current)
VERSION=$(shell git describe --tags --abbrev=0 || echo "unknown version")
CORE_NAME=hiddify-libcore CORE_NAME=hiddify-libcore
ifeq ($(BRANCH),RELEASE) ifeq ($(CHANNEL),prod)
CORE_URL=https://github.com/hiddify/hiddify-next-core/releases/download/v$(core.version) CORE_URL=https://github.com/hiddify/hiddify-next-core/releases/download/v$(core.version)
else else
CORE_URL=https://github.com/hiddify/hiddify-next-core/releases/download/draft CORE_URL=https://github.com/hiddify/hiddify-next-core/releases/download/draft
endif endif
ifeq ($(BRANCH),RELEASE) ifeq ($(CHANNEL),prod)
FLAVOR=prod FLAVOR=prod
else else
FLAVOR=dev FLAVOR=dev
endif endif
TARGET=lib/main_$(FLAVOR).dart TARGET=lib/main_$(FLAVOR).dart
BUILD_ARGS=--dart-define sentry_dsn=$(SENTRY_DSN) BUILD_ARGS=--dart-define sentry_dsn=$(SENTRY_DSN)
DISTRIBUTOR_ARGS=--skip-clean --build-target $(TARGET) --build-dart-define sentry_dsn=$(SENTRY_DSN) DISTRIBUTOR_ARGS=--skip-clean --build-target $(TARGET) --build-dart-define sentry_dsn=$(SENTRY_DSN)
@@ -99,9 +97,7 @@ build-ios-libs: #not tested
make -C libcore -f Makefile ios && mv $(BINDIR)/$(CORE_NAME)-ios.xcframework $(DESKTOP_OUT)/libcore.xcframework make -C libcore -f Makefile ios && mv $(BINDIR)/$(CORE_NAME)-ios.xcframework $(DESKTOP_OUT)/libcore.xcframework
release: # Create a new tag for release.
release: ## Create a new tag for release.
@echo "previous version was $$(git describe --tags $$(git rev-list --tags --max-count=1))" @echo "previous version was $$(git describe --tags $$(git rev-list --tags --max-count=1))"
@echo "WARNING: This operation will creates version tag and push to github" @echo "WARNING: This operation will creates version tag and push to github"
@bash -c '\ @bash -c '\
@@ -109,17 +105,16 @@ release: ## Create a new tag for release.
echo $$TAG &&\ echo $$TAG &&\
[[ "$$TAG" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(\.dev)?$$ ]] || { echo "Incorrect tag. e.g., 1.2.3 or 1.2.3.dev"; exit 1; } && \ [[ "$$TAG" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(\.dev)?$$ ]] || { echo "Incorrect tag. e.g., 1.2.3 or 1.2.3.dev"; exit 1; } && \
IFS="." read -r -a VERSION_ARRAY <<< "$$TAG" && \ IFS="." read -r -a VERSION_ARRAY <<< "$$TAG" && \
BUILD_NUMBER=$$(( $${VERSION_ARRAY[0]} * 10000 + $${VERSION_ARRAY[1]} * 100 + $${VERSION_ARRAY[2]} )) && \
VERSION_STR="$${VERSION_ARRAY[0]}.$${VERSION_ARRAY[1]}.$${VERSION_ARRAY[2]}" && \ VERSION_STR="$${VERSION_ARRAY[0]}.$${VERSION_ARRAY[1]}.$${VERSION_ARRAY[2]}" && \
echo "version: $${VERSION_STR}+$${BUILD_NUMBER}" && \ echo "version: $${VERSION_STR}" && \
sed -i "s/version: .*/version: $${VERSION_STR}+$${BUILD_NUMBER}/g" pubspec.yaml && \ sed -i "s/version: .*/version: $${VERSION_STR}/g" pubspec.yaml && \
git tag $${TAG} > /dev/null && \ git tag $${TAG} > /dev/null && \
gitchangelog > changelog.md || { git tag -d $${TAG}; echo "Please run pip install git gitchangelog pystache mustache markdown"; exit 2; } && \ gitchangelog > changelog.md || { git tag -d $${TAG}; echo "Please run pip install git gitchangelog pystache mustache markdown"; exit 2; } && \
git tag -d $${TAG} > /dev/null && \ git tag -d $${TAG} > /dev/null && \
git add pubspec.yaml changelog.md && \ git add pubspec.yaml changelog.md && \
# ./update_translations.sh && \ # ./update_translations.sh && \
# git add assets/translations/* && \ # git add assets/translations/* && \
git commit -m "release: version $${TAG} 🚀" && \ git commit -m "release: version $${TAG}" && \
echo "creating git tag : v$${TAG}" && \ echo "creating git tag : v$${TAG}" && \
git tag v$${TAG} && \ git tag v$${TAG} && \
git push -u origin HEAD --tags && \ git push -u origin HEAD --tags && \

View File

@@ -2,57 +2,59 @@
<p align="center"><img src="assets/images/logo.svg" width="168"/></p> <p align="center"><img src="assets/images/logo.svg" width="168"/></p>
<p align="center" style="font-size: 20px">Hiddify Multi-platform Proxy Client</p> <p align="center" style="font-size: 16px">Multi-platform, Sing-box (universal proxy toolchain) client</p>
<p align="center" style="font-size: 20px">⚠️ Hiddify Next is still in early development phase ⚠️</p>
<p align="center" style="font-size: 16px">Windows, Android, Linux and macOS are supported (PR for iOS welcome)</p>
## Download Hiddify Next Pre-Release ## Features
- Android: [Universal](https://github.com/hiddify/hiddify-next/releases/download/draft/hiddify-android-universal.apk) - [Arm64](https://github.com/hiddify/hiddify-next/releases/download/draft/hiddify-android-arm64.apk) - [Arm7](https://github.com/hiddify/hiddify-next/releases/download/draft/hiddify-android-arm7.apk) - [x86_64](https://github.com/hiddify/hiddify-next/releases/download/draft/hiddify-android-x86_64.apk)
- Windows: [x64 Setup](https://github.com/hiddify/hiddify-next/releases/download/draft/hiddify-windows-x64-setup.exe) - [x64 Portable](https://github.com/hiddify/hiddify-next/releases/download/draft/hiddify-windows-x64-portable.zip)
- Linux: [x64 AppImage](https://github.com/hiddify/hiddify-next/releases/download/draft/hiddify-linux-x64.AppImage.zip)
- macOS: [Universal (x64, M1, M2)](https://github.com/hiddify/hiddify-next/releases/download/draft/hiddify-macos-universal.dmg)
- Multi-platform support: Android, Windows, Linux and macOS (PRs for iOS are welcome)
- Easy to use with a simple UI
- Sing-box, Clash, Clash meta, V2ray configs supported
## Support ## Download
- V2Ray Subscription link (e.g., vless:// vmess:// ss:// trojan:// tuic://)
- Clash / Clash Meta link For latest releases (including pre-releases), visit [releases page](https://github.com/hiddify/hiddify-next/releases)
- Singbox Config
- Android: [Universal](https://github.com/hiddify/hiddify-next/releases/latest/download/hiddify-android-universal.apk) - [Arm64](https://github.com/hiddify/hiddify-next/releases/latest/download/hiddify-android-arm64.apk) - [Arm7](https://github.com/hiddify/hiddify-next/releases/latest/download/hiddify-android-arm7.apk) - [x86_64](https://github.com/hiddify/hiddify-next/releases/latest/download/hiddify-android-x86_64.apk)
- Windows: [x64 Setup](https://github.com/hiddify/hiddify-next/releases/latest/download/hiddify-windows-x64-setup.exe) - [x64 Portable](https://github.com/hiddify/hiddify-next/releases/latest/download/hiddify-windows-x64-portable.zip)
- Linux: [x64 AppImage](https://github.com/hiddify/hiddify-next/releases/latest/download/hiddify-linux-x64.AppImage.zip)
- macOS: [Universal (x64, M series)](https://github.com/hiddify/hiddify-next/releases/latest/download/hiddify-macos-universal.dmg)
## Build from source ## Build from source
Hiddify Next relies on [core library](https://github.com/hiddify/hiddify-next-core) made with GO. if you're interested in building/contributing to that as well follow instructions there. Hiddify Next relies on [core library](https://github.com/hiddify/hiddify-next-core) made with GO. if you're interested in building/contributing to that as well follow instructions there.
### requirements: ### requirements:
- Flutter v3.13+
- Make
- Android SDK
<!-- - GO v1.21+ -->
<!-- - GCC -->
<!-- - MinGW-w64 -->
<!-- - Android SDK (with CMake and NDK) -->
This project uses [flutter_distributor](https://github.com/leanflutter/flutter_distributor) for packaging. - Flutter v3.13+
- Make
- Android SDK
```shell This project uses [flutter_distributor](https://github.com/leanflutter/flutter_distributor) for packaging.
# fetch dependencies and build generated files
$ make get gen
# fetch geo assets ```shell
$ make get-geo-assets # fetch dependencies and build generated files
$ make get translate gen
for platform in [windows linux macos android]: # fetch geo assets
$ make get-geo-assets
for platform in [windows linux macos android]:
# fetch native libraries for respective platforms, follow core lib instructions for building # fetch native libraries for respective platforms, follow core lib instructions for building
$ make $platform-libs $ make $platform-libs
$ make release-$platform $ make release-$platform
# example: # example:
$ make windows-libs $ make windows-libs
$ make windows-release $ make windows-release
``` ```
## Acknowledgements ## Acknowledgements
- [Singbox](https://github.com/SagerNet/sing-box)
- [Clash](https://github.com/Dreamacro/clash) - [Singbox](https://github.com/SagerNet/sing-box)
- [Clash Meta](https://github.com/MetaCubeX/Clash.Meta) - [Clash](https://github.com/Dreamacro/clash)
- [FClash](https://github.com/Fclash/Fclash) - [Clash Meta](https://github.com/MetaCubeX/Clash.Meta)
- [Others](./pubspec.yaml) - [FClash](https://github.com/Fclash/Fclash)
- [Others](./pubspec.yaml)

Submodule libcore updated: 1b31bd7a4b...00bc20b86a