Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matrix #4253

Closed
wants to merge 10 commits into from
Closed

matrix #4253

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 15 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
abi: [arm64-v8a, armeabi-v7a, x86_64, x86]

steps:
- name: Checkout code
Expand All @@ -26,7 +29,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/AndroidLibXrayLite/libs
key: libtun2socks-${{ runner.os }}-${{ hashFiles('.git/modules/AndroidLibXrayLite/modules/badvpn/HEAD') }}-${{ hashFiles('.git/modules/AndroidLibXrayLite/modules/libancillary/HEAD') }}
key: libtun2socks-${{ runner.os }}-${{ matrix.abi }}-${{ hashFiles('.git/modules/AndroidLibXrayLite/modules/badvpn/HEAD') }}-${{ hashFiles('.git/modules/AndroidLibXrayLite/modules/libancillary/HEAD') }}

- name: Setup Android NDK
uses: nttld/setup-ndk@v1
Expand All @@ -52,7 +55,7 @@ jobs:
if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true'
run: |
cd ${{ github.workspace }}/AndroidLibXrayLite
bash compile-tun2socks.sh
bash compile-tun2socks.sh ${{ matrix.abi }}
tar -xvzf libtun2socks.so.tgz
env:
NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
Expand All @@ -62,7 +65,7 @@ jobs:
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/AndroidLibXrayLite/libs
key: libtun2socks-${{ runner.os }}-${{ hashFiles('.git/modules/AndroidLibXrayLite/modules/badvpn/HEAD') }}-${{ hashFiles('.git/modules/AndroidLibXrayLite/modules/libancillary/HEAD') }}
key: libtun2socks-${{ runner.os }}-${{ matrix.abi }}-${{ hashFiles('.git/modules/AndroidLibXrayLite/modules/badvpn/HEAD') }}-${{ hashFiles('.git/modules/AndroidLibXrayLite/modules/libancillary/HEAD') }}

- name: Copy libtun2socks
run: |
Expand All @@ -89,13 +92,14 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/hysteria/libs
key: libhysteria2-${{ runner.os }}-${{ hashFiles('.git/modules/hysteria/HEAD') }}-${{ hashFiles('libhysteria2.sh') }}
key: libhysteria2-${{ runner.os }}-${{ matrix.abi }}-${{ hashFiles('.git/modules/hysteria/HEAD') }}-${{ hashFiles('libhysteria2.sh') }}

- name: Setup Golang
if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true'
uses: actions/setup-go@v5
with:
go-version-file: 'AndroidLibXrayLite/go.mod'
cache-dependency-path: 'hysteria/app/go.sum'

- name: Patch Go use 600296
if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true'
Expand All @@ -107,7 +111,7 @@ jobs:
- name: Build libhysteria2
if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true'
run: |
bash libhysteria2.sh
bash libhysteria2.sh ${{ matrix.abi }}
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}

Expand All @@ -116,7 +120,7 @@ jobs:
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/hysteria/libs
key: libhysteria2-${{ runner.os }}-${{ hashFiles('.git/modules/hysteria/HEAD') }}-${{ hashFiles('libhysteria2.sh') }}
key: libhysteria2-${{ runner.os }}-${{ matrix.abi }}-${{ hashFiles('.git/modules/hysteria/HEAD') }}-${{ hashFiles('libhysteria2.sh') }}

- name: Copy libhysteria2
run: |
Expand All @@ -143,30 +147,16 @@ jobs:
cd ${{ github.workspace }}/V2rayNG
chmod 755 gradlew
./gradlew licenseFdroidReleaseReport
./gradlew assembleRelease -Pandroid.injected.signing.store.file=${{ steps.android_keystore.outputs.filePath }} -Pandroid.injected.signing.store.password=${{ secrets.APP_KEYSTORE_PASSWORD }} -Pandroid.injected.signing.key.alias=${{ secrets.APP_KEYSTORE_ALIAS }} -Pandroid.injected.signing.key.password=${{ secrets.APP_KEY_PASSWORD }}
./gradlew assembleRelease -PABI_FILTERS=${{ matrix.abi }} -Pandroid.injected.signing.store.file=${{ steps.android_keystore.outputs.filePath }} -Pandroid.injected.signing.store.password=${{ secrets.APP_KEYSTORE_PASSWORD }} -Pandroid.injected.signing.key.alias=${{ secrets.APP_KEYSTORE_ALIAS }} -Pandroid.injected.signing.key.password=${{ secrets.APP_KEY_PASSWORD }}
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}

- name: Upload arm64-v8a APK
- name: Upload APK
uses: actions/upload-artifact@v4
if: ${{ success() }}
if: ${{ success() }}
with:
name: arm64-v8a
path: ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/*/release/*arm64-v8a*.apk

- name: Upload armeabi-v7a APK
uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: armeabi-v7a
path: ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/*/release/*armeabi-v7a*.apk

- name: Upload x86 APK
uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: x86-apk
path: ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/*/release/*x86*.apk
name: ${{ matrix.abi }}
path: ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/*/release/*${{ matrix.abi }}*.apk

- name: Upload to release
uses: svenstaro/upload-release-action@v2
Expand Down
2 changes: 1 addition & 1 deletion AndroidLibXrayLite
22 changes: 22 additions & 0 deletions libhysteria2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ targets=(
"i686-linux-android21 386 x86"
)

if [ "$#" -eq 1 ]; then
abi_filter=$1
case $abi_filter in
arm64-v8a|armeabi-v7a|x86_64|x86)
filtered_targets=()
for target in "${targets[@]}"; do
IFS=' ' read -r _ _ abi <<< "$target"
if [ "$abi" == "$abi_filter" ]; then
filtered_targets+=("$target")
break
fi
done
targets=("${filtered_targets[@]}")
;;
*)
echo "Invalid ABI specified: $abi_filter"
echo "Valid options are: arm64-v8a, armeabi-v7a, x86_64, x86"
exit 1
;;
esac
fi

cd "hysteria" || exit

for target in "${targets[@]}"; do
Expand Down
Loading