132 lines
4.9 KiB
YAML
132 lines
4.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 120
|
|
|
|
steps:
|
|
- name: Checkout application
|
|
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
|
|
|
|
- name: Set up OpenJDK 17
|
|
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: "17"
|
|
|
|
- name: Read pinned versions
|
|
id: versions
|
|
shell: bash
|
|
run: |
|
|
source core.properties
|
|
echo "go=$GO_VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
|
|
with:
|
|
go-version: ${{ steps.versions.outputs.go }}
|
|
cache: false
|
|
|
|
- name: Set up Android SDK
|
|
uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407 # v3
|
|
|
|
- name: Install pinned Android packages
|
|
shell: bash
|
|
run: |
|
|
source core.properties
|
|
sdkmanager --licenses >/dev/null < <(yes)
|
|
sdkmanager \
|
|
"platforms;android-$ANDROID_COMPILE_SDK" \
|
|
"build-tools;$ANDROID_BUILD_TOOLS" \
|
|
"ndk;$ANDROID_NDK_VERSION"
|
|
|
|
- name: Set up Gradle cache
|
|
uses: gradle/actions/setup-gradle@0b6dd653ba04f4f93bf581ec31e66cbd7dcb644d # v4
|
|
|
|
- name: Set up native core artifact cache
|
|
id: core-artifacts
|
|
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
with:
|
|
path: |
|
|
app/libs/libbox.aar
|
|
app/libs/libbox.properties
|
|
core-build/output
|
|
key: native-core-artifacts-${{ runner.os }}-${{ runner.arch }}-v1-${{ hashFiles('core.properties', 'core-patches/**', 'scripts/core-patchset.sh', 'scripts/build-core.sh', 'scripts/build-native-symbols.sh', 'scripts/verify-core-cache.sh', 'scripts/verify-core-version.sh', 'scripts/verify-fixtures.sh', 'audit/*.go', 'testdata/**', 'app/src/main/assets/rule-sets/**', 'app/src/main/res/raw/sing_box_extended_license.txt') }}
|
|
|
|
- name: Set up native core toolchain cache
|
|
if: steps.core-artifacts.outputs.cache-hit != 'true'
|
|
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
with:
|
|
path: |
|
|
~/.cache/go-build
|
|
core-build/gopath/bin
|
|
core-build/gopath/pkg/mod
|
|
core-build/source
|
|
key: native-core-toolchain-${{ runner.os }}-${{ runner.arch }}-v1-${{ hashFiles('core.properties') }}
|
|
restore-keys: |
|
|
native-core-toolchain-${{ runner.os }}-${{ runner.arch }}-v1-
|
|
|
|
- name: Verify, test and build
|
|
env:
|
|
ZAPRET_CORE_CACHE_HIT: ${{ steps.core-artifacts.outputs.cache-hit }}
|
|
run: scripts/ci-build.sh
|
|
|
|
- name: Run opt-in Android performance matrix
|
|
if: github.event_name == 'workflow_dispatch'
|
|
shell: bash
|
|
run: |
|
|
source core.properties
|
|
sudo apt-get update
|
|
sudo apt-get install -y socat
|
|
sdkmanager \
|
|
"platform-tools" \
|
|
"emulator" \
|
|
"system-images;android-$ANDROID_COMPILE_SDK;google_apis;x86_64"
|
|
printf 'no\n' | avdmanager create avd \
|
|
--force \
|
|
--name gate8_api36 \
|
|
--package "system-images;android-$ANDROID_COMPILE_SDK;google_apis;x86_64"
|
|
sudo chown "$(id -un)" /dev/kvm || true
|
|
emulator -avd gate8_api36 -no-window -no-audio -no-boot-anim \
|
|
-gpu swiftshader_indirect -no-snapshot -wipe-data > emulator.log 2>&1 &
|
|
adb wait-for-device
|
|
timeout 300 bash -c 'until [[ "$(adb shell getprop sys.boot_completed | tr -d "\r")" == 1 ]]; do sleep 2; done'
|
|
scripts/verify-gate8-performance.sh
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
with:
|
|
name: zapret-kvn-build
|
|
if-no-files-found: error
|
|
path: |
|
|
app/build/outputs/apk/**/*.apk
|
|
app/build/outputs/mapping/release/mapping.txt
|
|
app/build/APK-SHA256SUMS
|
|
app/build/permissions.txt
|
|
app/build/manifest-tree.txt
|
|
app/build/resources.txt
|
|
core-build/output/SHA256SUMS
|
|
core-build/output/core-version.txt
|
|
core-build/output/core-build-metadata.json
|
|
core-build/output/rule-set-benchmark.txt
|
|
core-build/output/sing-box-extended-LICENSE.txt
|
|
core-build/output/native-debug-symbols.zip
|
|
core-build/output/native-symbols-metadata.json
|
|
core-build/output/native-symbols-SHA256SUMS
|
|
build/release-candidate/security-report-*.json
|
|
build/gate8-performance/**
|
|
emulator.log
|