mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-10-29 16:05:35 +00:00
* fix(peers): don't report unmeasured connections as 1 ms to peer center A freshly established connection has no latency sample yet, so its WindowLatency reports 0 and direct_peer_info advertised the peer as max(1, 0) = 1 ms. With latency_first enabled, every node could then route through a slow or lossy link until the next report (up to ~60 s), and a flapping link re-advertised 1 ms on every reconnect. Skip connections that have no latency sample yet. A peer with no measured connection is left out of the report; it is reported once its first sample arrives, because the peer list changes then. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci(mobile): use the Android command-line tools build ID setup-android expects a download build ID, not the displayed tools version. The value 12.0 becomes 12 and produces a URL that returns 404 when the runner cannot reuse a preinstalled SDK. Request build 11076708, which provides the same command-line tools 12.0. Keep the runner and other tool versions unchanged. Validate the workflow YAML and confirm the archive URL returns HTTP 200. --------- Co-authored-by: imoulei <188999141+imoulei@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: KKRainbow <5665404+KKRainbow@users.noreply.github.com>
165 lines
5.6 KiB
YAML
165 lines
5.6 KiB
YAML
name: EasyTier Mobile
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: ["develop", "main", "releases/**"]
|
|
pull_request:
|
|
branches: ["develop", "main"]
|
|
types: [opened, synchronize, reopened, ready_for_review]
|
|
|
|
concurrency:
|
|
# A new PR or branch push must not cancel a full build.
|
|
group: ${{ github.workflow }}-${{ (github.event_name == 'workflow_dispatch' || startsWith(github.ref_name, 'releases/')) && 'full' || 'check' }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
defaults:
|
|
run:
|
|
# necessary for windows
|
|
shell: bash
|
|
|
|
jobs:
|
|
pre_job:
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
|
|
env:
|
|
RELEVANT_PATHS: >-
|
|
["Cargo.toml", "Cargo.lock", "rust-toolchain.toml", ".cargo/**",
|
|
"pnpm-lock.yaml", "pnpm-workspace.yaml", "package.json", "easytier/**",
|
|
"easytier-core/**", "easytier-proto/**", "easytier-rpc-build/**",
|
|
"easytier-gui/**", "tauri-plugin-vpnservice/**",
|
|
"easytier-web/frontend-lib/**", ".github/workflows/mobile.yml",
|
|
".github/actions/**"]
|
|
outputs:
|
|
full_build: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.ref_name, 'releases/') }}
|
|
# Release builds must run even if they only change release metadata.
|
|
should_skip: >-
|
|
${{
|
|
(
|
|
steps.skip_check.outputs.should_skip == 'true' ||
|
|
(
|
|
github.event_name == 'pull_request' &&
|
|
steps.path_filter.outputs.relevant != 'true'
|
|
)
|
|
) &&
|
|
github.event_name != 'workflow_dispatch' &&
|
|
!startsWith(github.ref_name, 'releases/')
|
|
}}
|
|
steps:
|
|
- id: skip_check
|
|
if: github.event_name != 'workflow_dispatch' && !startsWith(github.ref_name, 'releases/')
|
|
uses: fkirc/skip-duplicate-actions@v5
|
|
with:
|
|
concurrent_skipping: 'same_content_newer'
|
|
skip_after_successful_duplicate: 'true'
|
|
paths: ${{ env.RELEVANT_PATHS }}
|
|
|
|
- id: path_filter
|
|
if: >-
|
|
github.event_name == 'pull_request' &&
|
|
steps.skip_check.outputs.should_skip != 'true'
|
|
uses: dorny/paths-filter@v4
|
|
with:
|
|
filters: |
|
|
relevant: ${{ env.RELEVANT_PATHS }}
|
|
|
|
build-mobile:
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
ARCH: ${{ fromJSON(needs.pre_job.outputs.full_build == 'true' && '["aarch64", "armv7", "i686", "x86_64"]' || '["aarch64"]') }}
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
NAME: easytier
|
|
TARGET: ${{ matrix.ARCH == 'armv7' && 'armv7-linux-androideabi' || format('{0}-linux-android', matrix.ARCH) }}
|
|
ARCH: ${{ matrix.ARCH }}
|
|
OSS_BUCKET: ${{ secrets.ALIYUN_OSS_BUCKET }}
|
|
needs: pre_job
|
|
if: needs.pre_job.outputs.should_skip != 'true'
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- name: Set current ref as env variable
|
|
run: |
|
|
echo "GIT_DESC=$(git log -1 --format=%cd.%h --date=format:%Y-%m-%d_%H:%M:%S)" >> $GITHUB_ENV
|
|
|
|
- uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'oracle'
|
|
java-version: '21'
|
|
|
|
- name: Setup Android SDK
|
|
uses: android-actions/setup-android@v3
|
|
with:
|
|
cmdline-tools-version: '11076708'
|
|
packages: 'build-tools;34.0.0 ndk;26.0.10792818 platform-tools platforms;android-34 '
|
|
|
|
- name: Setup Android Environment
|
|
run: |
|
|
echo "$ANDROID_HOME/platform-tools" >> $GITHUB_PATH
|
|
echo "$ANDROID_HOME/ndk/26.0.10792818/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH
|
|
echo "NDK_HOME=$ANDROID_HOME/ndk/26.0.10792818/" >> $GITHUB_ENV
|
|
|
|
- name: Prepare build environment
|
|
uses: ./.github/actions/prepare-build
|
|
with:
|
|
target: ${{ env.TARGET }}
|
|
gui: false
|
|
pnpm: true
|
|
pnpm-build-filter: easytier-gui...
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
# The prefix cache key, this can be changed to start a new cache manually.
|
|
# default: "v0-rust"
|
|
prefix-key: ""
|
|
shared-key: mobile-${{ env.TARGET }}-${{ needs.pre_job.outputs.full_build }}
|
|
cache-targets: "true"
|
|
save-if: ${{ github.event_name != 'pull_request' }}
|
|
|
|
- name: Check Android ARM64
|
|
if: needs.pre_job.outputs.full_build != 'true'
|
|
run: cargo check --locked --lib --target "$TARGET" --package easytier-gui --features custom-protocol
|
|
|
|
- name: Build
|
|
if: needs.pre_job.outputs.full_build == 'true'
|
|
run: |
|
|
cd easytier-gui
|
|
pnpm tauri android build --apk --target "$ARCH" --split-per-abi
|
|
|
|
- name: Collect artifact
|
|
if: needs.pre_job.outputs.full_build == 'true'
|
|
run: |
|
|
mkdir -p ./artifacts/objects/
|
|
mv easytier-gui/src-tauri/gen/android/app/build/outputs/apk/*/release/*.apk ./artifacts/objects/
|
|
|
|
if [[ $GITHUB_REF_TYPE =~ ^tag$ ]]; then
|
|
TAG=$GITHUB_REF_NAME
|
|
else
|
|
TAG=$GITHUB_SHA
|
|
fi
|
|
|
|
mv ./artifacts/objects/* ./artifacts/
|
|
rm -rf ./artifacts/objects/
|
|
|
|
- name: Archive artifact
|
|
if: needs.pre_job.outputs.full_build == 'true'
|
|
uses: actions/upload-artifact@v5
|
|
with:
|
|
name: easytier-mobile-android-${{ matrix.ARCH }}
|
|
path: |
|
|
./artifacts/*
|
|
|
|
mobile-result:
|
|
runs-on: ubuntu-latest
|
|
needs: [ pre_job, build-mobile ]
|
|
if: ${{ always() }}
|
|
steps:
|
|
- name: Mark result as failed
|
|
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
|
|
run: exit 1
|