mirror of
https://github.com/xweiba/location-spoofer.git
synced 2026-09-22 14:50:43 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4712f7fb2 | ||
|
|
393c7cc215 |
@@ -0,0 +1,23 @@
|
||||
name: Contract Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
contract-tests:
|
||||
runs-on: macos-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run contract tests
|
||||
run: ./Tests/run_all_contract_tests.sh
|
||||
@@ -28,6 +28,9 @@ jobs:
|
||||
- name: Install XcodeGen
|
||||
run: brew install xcodegen
|
||||
|
||||
- name: Run contract tests
|
||||
run: ./Tests/run_all_contract_tests.sh
|
||||
|
||||
- name: Build unsigned IPA
|
||||
run: ./build.sh
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.PHONY: setup core ipa-unsigned verify-ipa
|
||||
.PHONY: setup core ipa-unsigned verify-ipa test
|
||||
|
||||
setup:
|
||||
./Scripts/setup.sh
|
||||
@@ -12,3 +12,6 @@ ipa-unsigned: core
|
||||
verify-ipa:
|
||||
@test -n "$(IPA)" || (echo "Usage: make verify-ipa IPA=/absolute/path/to/signed.ipa" >&2; exit 2)
|
||||
./Scripts/verify-ipa.sh --signed "$(IPA)"
|
||||
|
||||
test:
|
||||
./Tests/run_all_contract_tests.sh
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ responses in a controlled test environment.
|
||||
[](project.yml)
|
||||
[](project.yml)
|
||||
[](Core/go.mod)
|
||||
[](docs/CHANGELOG.md)
|
||||
[](docs/CHANGELOG.md)
|
||||
|
||||
[Features](#feature-overview) ·
|
||||
[How It Works](#how-it-works) ·
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
[](project.yml)
|
||||
[](project.yml)
|
||||
[](Core/go.mod)
|
||||
[](docs/CHANGELOG.md)
|
||||
[](docs/CHANGELOG.md)
|
||||
|
||||
[功能概览](#功能概览) ·
|
||||
[工作原理](#工作原理) ·
|
||||
|
||||
@@ -23,7 +23,7 @@ struct AppRemoteConfiguration: Decodable, Equatable {
|
||||
let communityPromptClients: [String]
|
||||
|
||||
static let fallback = AppRemoteConfiguration(
|
||||
latestVersion: "1.0.5",
|
||||
latestVersion: "1.0.7",
|
||||
minimumSupportedVersion: "1.0.0",
|
||||
communityPromptClients: [
|
||||
ThirdPartyProxyClient.surge.rawValue,
|
||||
|
||||
@@ -62,7 +62,7 @@ final class AppRemoteConfigurationTests: XCTestCase {
|
||||
func testFallbackMatchesCurrentProjectPolicy() {
|
||||
let configuration = AppRemoteConfiguration.fallback
|
||||
|
||||
XCTAssertEqual(configuration.latestVersion, "1.0.5")
|
||||
XCTAssertEqual(configuration.latestVersion, "1.0.7")
|
||||
XCTAssertEqual(configuration.minimumSupportedVersion, "1.0.0")
|
||||
XCTAssertFalse(configuration.requestsCommunityPrompt(for: .shadowrocket))
|
||||
for client in ThirdPartyProxyClient.allCases where client != .shadowrocket {
|
||||
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
passed=0
|
||||
failed=0
|
||||
failed_scripts=()
|
||||
|
||||
for script in "$ROOT"/Tests/*_test.sh; do
|
||||
name="$(basename "$script")"
|
||||
echo "==> $name"
|
||||
if bash "$script"; then
|
||||
echo "PASS: $name"
|
||||
passed=$((passed + 1))
|
||||
else
|
||||
echo "FAIL: $name"
|
||||
failed_scripts+=("$name")
|
||||
failed=$((failed + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
echo "----------------------------------------"
|
||||
echo "Contract tests: $passed passed / $failed failed"
|
||||
if [ "$failed" -gt 0 ]; then
|
||||
echo "Failed scripts:"
|
||||
for name in "${failed_scripts[@]}"; do
|
||||
echo " - $name"
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "PASS: all contract tests"
|
||||
@@ -33,6 +33,15 @@ assert set(config["communityPromptClients"]) == {
|
||||
}
|
||||
PY
|
||||
|
||||
LATEST_VERSION="$(python3 -c 'import json, sys; print(json.load(open(sys.argv[1], encoding="utf-8"))["latestVersion"])' "$ROOT/version.txt")"
|
||||
|
||||
grep -Fq "latestVersion: \"$LATEST_VERSION\"" "$CONFIG" \
|
||||
|| fail "Shared/AppRemoteConfiguration.swift fallback latestVersion must match version.txt ($LATEST_VERSION)"
|
||||
grep -Fq "version-v$LATEST_VERSION" "$ROOT/README.md" \
|
||||
|| fail "README.md version badge must match version.txt ($LATEST_VERSION)"
|
||||
grep -Fq "version-v$LATEST_VERSION" "$ROOT/README.en.md" \
|
||||
|| fail "README.en.md version badge must match version.txt ($LATEST_VERSION)"
|
||||
|
||||
grep -q 'static let fallback = AppRemoteConfiguration' "$CONFIG" \
|
||||
|| fail "the app must ship a built-in remote-configuration fallback"
|
||||
grep -q 'timeoutIntervalForRequest = 1.5' "$CONFIG" \
|
||||
|
||||
Reference in New Issue
Block a user