forked from 2dust/v2rayNG
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build and cache libtun2socks and libv2ray (2dust#4167)
* build libtun2socks * Clean up binaries * test cache altrepo for testing * switch to original repo
- Loading branch information
1 parent
4fb8c2f
commit 02038a5
Showing
5 changed files
with
83 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,42 +13,112 @@ jobs: | |
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
- name: Prepare build dir | ||
run: | | ||
mkdir ${{ github.workspace }}/build | ||
- name: Fetch AndroidLibV2rayLite | ||
run: | | ||
cd ${{ github.workspace }}/build | ||
git clone --depth=1 -b master https://github.com/2dust/AndroidLibV2rayLite.git | ||
cd AndroidLibV2rayLite | ||
git submodule update --init | ||
- name: Restore cached libtun2socks | ||
id: cache-libtun2socks-restore | ||
uses: actions/cache/restore@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '21' | ||
path: ${{ github.workspace }}/build/AndroidLibV2rayLite/libs | ||
key: libtun2socks-${{ runner.os }}-${{ hashFiles('build/AndroidLibV2rayLite/.gitmodules') }}-${{ hashFiles('build/AndroidLibV2rayLite/.git/modules/badvpn/HEAD') }}-${{ hashFiles('build/AndroidLibV2rayLite/.git/modules/libancillary/HEAD') }} | ||
|
||
- name: Setup Android NDK | ||
if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true' | ||
uses: nttld/setup-ndk@v1 | ||
id: setup-ndk | ||
# Same version as https://gitlab.com/fdroid/fdroiddata/metadata/com.v2ray.ang.yml | ||
with: | ||
ndk-version: r27 | ||
|
||
- name: Build libtun2socks | ||
if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true' | ||
run: | | ||
cd ${{ github.workspace }}/build/AndroidLibV2rayLite | ||
bash compile-tun2socks.sh | ||
tar -xvzf libtun2socks.so.tgz | ||
cp -r libs/* ${{ github.workspace }}/V2rayNG/app/libs/ | ||
env: | ||
NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | ||
|
||
- name: Save libtun2socks | ||
if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: ${{ github.workspace }}/build/AndroidLibV2rayLite/libs | ||
key: libtun2socks-${{ runner.os }}-${{ hashFiles('build/AndroidLibV2rayLite/.gitmodules') }}-${{ hashFiles('build/AndroidLibV2rayLite/.git/modules/badvpn/HEAD') }}-${{ hashFiles('build/AndroidLibV2rayLite/.git/modules/libancillary/HEAD') }} | ||
|
||
- name: Copy libtun2socks | ||
run: | | ||
cp -r ${{ github.workspace }}/build/AndroidLibV2rayLite/libs/* ${{ github.workspace }}/V2rayNG/app/libs/ | ||
- name: Fetch AndroidLibXrayLite | ||
run: | | ||
cd ${{ github.workspace }}/build | ||
git clone --depth=1 -b main https://github.com/2dust/AndroidLibXrayLite.git | ||
- name: Restore cached libv2ray | ||
id: cache-libv2ray-restore | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ${{ github.workspace }}/build/AndroidLibXrayLite/ | ||
key: libv2ray-${{ runner.os }}-${{ hashFiles('build/AndroidLibXrayLite/.git/refs/heads/main') }} | ||
|
||
- name: Setup Golang | ||
if: steps.cache-libv2ray-restore.outputs.cache-hit != 'true' | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.23.4' | ||
cache: false | ||
|
||
- name: Patch Go use 600296 | ||
if: steps.cache-libv2ray-restore.outputs.cache-hit != 'true' | ||
#https://go-review.googlesource.com/c/go/+/600296 | ||
run: | | ||
cd "$(go env GOROOT)" | ||
curl "https://go-review.googlesource.com/changes/go~600296/revisions/5/patch" | base64 -d | patch --verbose -p 1 | ||
- name: Install gomobile | ||
if: steps.cache-libv2ray-restore.outputs.cache-hit != 'true' | ||
run: | | ||
go install golang.org/x/mobile/cmd/[email protected] | ||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | ||
- name: Setup Android environment | ||
uses: android-actions/setup-android@v3 | ||
|
||
- name: Build dependencies | ||
- name: Build libv2ray | ||
if: steps.cache-libv2ray-restore.outputs.cache-hit != 'true' | ||
run: | | ||
mkdir ${{ github.workspace }}/build | ||
cd ${{ github.workspace }}/build | ||
git clone --depth=1 -b main https://github.com/2dust/AndroidLibXrayLite.git | ||
cd AndroidLibXrayLite | ||
cd ${{ github.workspace }}/build/AndroidLibXrayLite | ||
gomobile init | ||
go mod tidy -v | ||
gomobile bind -v -androidapi 21 -ldflags='-s -w' ./ | ||
cp *.aar ${{ github.workspace }}/V2rayNG/app/libs/ | ||
- name: Save libv2ray | ||
if: steps.cache-libv2ray-restore.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: ${{ github.workspace }}/build/AndroidLibXrayLite/ | ||
key: libv2ray-${{ runner.os }}-${{ hashFiles('build/AndroidLibXrayLite/.git/refs/heads/main') }} | ||
|
||
- name: Copy libv2ray | ||
run: | | ||
cp -r ${{ github.workspace }}/build/AndroidLibXrayLite/*.aar ${{ github.workspace }}/V2rayNG/app/libs/ | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '21' | ||
|
||
- name: Setup Android environment | ||
uses: android-actions/setup-android@v3 | ||
|
||
- name: Decode Keystore | ||
uses: timheuer/base64-to-file@v1 | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.