fix: sync Constants/DataStore/MainActivity with dsfkjlweuyr #223
This file contains hidden or 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
| name: CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| MIERU_VERSION: v3.34.1 | |
| MDVPN_REF: android-vpnservice-protect-hook | |
| MDVPN_COMMIT: d481d72d4b86783a87d536c214d2c68cc4e9320e | |
| NAIVE_VERSION: v149.0.7827.114-1 | |
| OLCRTC_REPO: https://github.com/hawkff/olcrtc.git | |
| OLCRTC_COMMIT: ad5cc1e3d60b657b15ccd26f8db91395bf9630d0 | |
| permissions: | |
| contents: write | |
| jobs: | |
| guard: | |
| name: Repo Guards | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Guard - lint baseline may only shrink | |
| run: bash ./scripts/check-lint-baseline.sh | |
| - name: Guard - release publication requires explicit opt-in | |
| run: bash scripts/check-release-publish-gate.sh --self-test | |
| test: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| needs: | |
| - libcore | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Setup Java | |
| uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Download LibCore | |
| uses: actions/download-artifact@v4 # v1 | |
| with: | |
| name: libcore-aar-ci | |
| path: app/libs | |
| - name: Gradle cache | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: ~/.gradle | |
| key: gradle-test-${{ hashFiles('**/*.gradle.kts') }}-ci | |
| - name: Unit Tests | |
| run: | | |
| echo "sdk.dir=${ANDROID_HOME}" > local.properties | |
| ./gradlew app:testOssDebugUnitTest | |
| lint: | |
| name: Android Lint | |
| runs-on: ubuntu-latest | |
| needs: | |
| - libcore | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Setup Java | |
| uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Download LibCore | |
| uses: actions/download-artifact@v4 # v1 | |
| with: | |
| name: libcore-aar-ci | |
| path: app/libs | |
| - name: Gradle cache | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: ~/.gradle | |
| key: gradle-lint-${{ hashFiles('**/*.gradle.kts') }}-ci | |
| - name: Lint | |
| run: | | |
| echo "sdk.dir=${ANDROID_HOME}" > local.properties | |
| ./gradlew app:lintOssDebug | |
| - name: Spotless | |
| run: ./gradlew spotlessCheck | |
| libcore: | |
| name: Native Build (LibCore) | |
| runs-on: ubuntu-latest | |
| needs: | |
| - guard | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Setup Java | |
| uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Golang Status | |
| run: find buildScript libcore -type f -name "*.sh" | xargs cat | sha1sum > golang_status | |
| - name: Libcore Status | |
| run: git ls-files libcore | xargs cat | sha1sum > libcore_status | |
| - name: LibCore Cache | |
| id: cache | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: | | |
| app/libs/libcore.aar | |
| key: ${{ hashFiles('.github/workflows/*', 'golang_status', 'libcore_status') }}-ci | |
| - name: Install Golang | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6 | |
| with: | |
| go-version: '1.26.4' | |
| - name: Native Build | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: ./run lib core | |
| - name: Upload LibCore | |
| uses: actions/upload-artifact@v4 # v1 | |
| with: | |
| name: libcore-aar-ci | |
| path: app/libs/libcore.aar | |
| retention-days: 1 | |
| if-no-files-found: error | |
| sidecars: | |
| name: Native Build (Sidecars) | |
| runs-on: ubuntu-latest | |
| needs: | |
| - guard | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Sidecars Status | |
| run: | | |
| git ls-files -s -- \ | |
| buildScript/lib/mieru.sh \ | |
| buildScript/lib/masterdnsvpn.sh \ | |
| buildScript/lib/naive.sh \ | |
| buildScript/lib/olcrtc.sh \ | |
| buildScript/lib/olcrtc-src/main.go \ | |
| buildScript/lib/olcrtc-src/main_test.go \ | |
| buildScript/lib/olcrtc-src/go.mod \ | |
| buildScript/init/env.sh \ | |
| buildScript/init/env_ndk.sh \ | |
| | sha1sum > sidecars_status | |
| - name: Sidecars Cache | |
| id: cache | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: | | |
| app/executableSo | |
| key: ${{ hashFiles('.github/workflows/*', 'sidecars_status') }}-${{ env.MIERU_VERSION }}-${{ env.MDVPN_COMMIT }}-${{ env.NAIVE_VERSION }}-${{ env.OLCRTC_COMMIT }}-sidecars-ci | |
| - name: Install Golang | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6 | |
| with: | |
| go-version: '1.26.4' | |
| - name: Mieru Build | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: ./run lib mieru | |
| - name: MasterDnsVPN Build | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: ./run lib masterdnsvpn | |
| - name: Naive Download | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: ./run lib naive | |
| - name: olcRTC Build | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: ./run lib olcrtc | |
| - name: Upload Sidecars | |
| uses: actions/upload-artifact@v4 # v1 | |
| with: | |
| name: sidecars-so-ci | |
| path: app/executableSo | |
| retention-days: 1 | |
| if-no-files-found: error | |
| build: | |
| name: Build OSS APK | |
| runs-on: ubuntu-latest | |
| needs: | |
| - libcore | |
| - sidecars | |
| - test | |
| - lint | |
| if: | | |
| !cancelled() && | |
| !contains(needs.*.result, 'failure') && | |
| !contains(needs.*.result, 'cancelled') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Setup Java | |
| uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Golang Status | |
| run: find buildScript libcore -type f -name "*.sh" | xargs cat | sha1sum > golang_status | |
| - name: Libcore Status | |
| run: git ls-files libcore | xargs cat | sha1sum > libcore_status | |
| - name: LibCore Cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| app/libs/libcore.aar | |
| key: ${{ hashFiles('.github/workflows/*', 'golang_status', 'libcore_status') }}-ci | |
| - name: Download LibCore | |
| uses: actions/download-artifact@v4 # v1 | |
| with: | |
| name: libcore-aar-ci | |
| path: app/libs | |
| - name: Download Sidecars | |
| uses: actions/download-artifact@v4 # v1 | |
| with: | |
| name: sidecars-so-ci | |
| path: app/executableSo | |
| - name: Verify Sidecar Artifacts | |
| run: | | |
| for abi in arm64-v8a armeabi-v7a x86 x86_64; do | |
| for so in libmieru.so libmasterdnsvpn.so libnaive.so libolcrtc.so; do | |
| if [ ! -f "app/executableSo/$abi/$so" ]; then | |
| echo "Error: missing app/executableSo/$abi/$so (sidecar artifact missing)" >&2 | |
| exit 1 | |
| fi | |
| done | |
| done | |
| - name: Gradle cache | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: ~/.gradle | |
| key: gradle-oss-${{ hashFiles('**/*.gradle.kts') }}-ci | |
| - name: Gradle Build | |
| env: | |
| BUILD_PLUGIN: none | |
| KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
| KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }} | |
| ALIAS_NAME: ${{ secrets.ALIAS_NAME }} | |
| ALIAS_PASS: ${{ secrets.ALIAS_PASS }} | |
| run: | | |
| echo "sdk.dir=${ANDROID_HOME}" > local.properties | |
| echo "ndk.dir=${ANDROID_HOME}/ndk/25.0.8775105" >> local.properties | |
| if [ -z "$KEYSTORE_BASE64" ] || [ -z "$KEYSTORE_PASS" ] || [ -z "$ALIAS_NAME" ]; then | |
| echo "::error:: 未設定簽名憑證!請在 GitHub Secrets 中設定 KEYSTORE_BASE64 / KEYSTORE_PASS / ALIAS_NAME / ALIAS_PASS" | |
| exit 1 | |
| fi | |
| echo "::notice:: 使用用戶自訂簽名 (alias=$ALIAS_NAME)" | |
| # 從 GitHub Secrets 還原 keystore 檔案 | |
| echo "$KEYSTORE_BASE64" | base64 -d > release.keystore | |
| # 執行初始化腳本 | |
| ./run init action gradle | |
| # 寫入簽名配置到 local.properties 供 Gradle 讀取 | |
| echo "KEYSTORE_PASS=$KEYSTORE_PASS" >> local.properties | |
| echo "ALIAS_NAME=$ALIAS_NAME" >> local.properties | |
| echo "ALIAS_PASS=$ALIAS_PASS" >> local.properties | |
| # 使用用戶自訂 keystore 簽名打包 | |
| KEYSTORE_PASS="$KEYSTORE_PASS" ALIAS_NAME="$ALIAS_NAME" ALIAS_PASS="$ALIAS_PASS" \ | |
| ./gradlew app:assembleOssRelease | |
| # 5. 尋找 APK 路徑並寫入環境變量 | |
| APK=$(find app/build/outputs/apk -name '*arm64-v8a*.apk') | |
| APK=$(dirname $APK) | |
| echo "APK=$APK" >> $GITHUB_ENV | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: APKs | |
| path: ${{ env.APK }} | |
| - name: Delete old nightly release | |
| continue-on-error: true | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release delete nightly --yes --cleanup-tag 2>/dev/null || true | |
| # Wait a moment for GitHub to process the deletion | |
| sleep 3 | |
| - name: Release APK | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: nightly | |
| name: Nightly Build | |
| body: Automated build from main branch. Updated on every push. | |
| files: ${{ env.APK }}/*.apk | |
| prerelease: true | |
| make_latest: true |