mirror of
https://github.com/xweiba/location-spoofer.git
synced 2026-09-21 22:30:46 +08:00
ci: 契约测试接入 CI 与 make test
This commit is contained in:
@@ -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
|
- name: Install XcodeGen
|
||||||
run: brew install xcodegen
|
run: brew install xcodegen
|
||||||
|
|
||||||
|
- name: Run contract tests
|
||||||
|
run: ./Tests/run_all_contract_tests.sh
|
||||||
|
|
||||||
- name: Build unsigned IPA
|
- name: Build unsigned IPA
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.PHONY: setup core ipa-unsigned verify-ipa
|
.PHONY: setup core ipa-unsigned verify-ipa test
|
||||||
|
|
||||||
setup:
|
setup:
|
||||||
./Scripts/setup.sh
|
./Scripts/setup.sh
|
||||||
@@ -12,3 +12,6 @@ ipa-unsigned: core
|
|||||||
verify-ipa:
|
verify-ipa:
|
||||||
@test -n "$(IPA)" || (echo "Usage: make verify-ipa IPA=/absolute/path/to/signed.ipa" >&2; exit 2)
|
@test -n "$(IPA)" || (echo "Usage: make verify-ipa IPA=/absolute/path/to/signed.ipa" >&2; exit 2)
|
||||||
./Scripts/verify-ipa.sh --signed "$(IPA)"
|
./Scripts/verify-ipa.sh --signed "$(IPA)"
|
||||||
|
|
||||||
|
test:
|
||||||
|
./Tests/run_all_contract_tests.sh
|
||||||
|
|||||||
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"
|
||||||
Reference in New Issue
Block a user