Repository navigation
163 lines (163 loc) · 7.3 KB
/
Copy pathvalidate.yml
File metadata and controls
163 lines (163 loc) · 7.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Validate and release Friday
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: assistant-main-validation
cancel-in-progress: false
jobs:
validate:
runs-on: ubuntu-latest
timeout-minutes: 20
outputs:
release_ready: ${{ steps.release_policy.outputs.ready }}
steps:
- uses: actions/checkout@v4
- name: Check checkpoint publication policy
id: release_policy
run: |
set -euo pipefail
source release.properties
case "${RELEASE_READY:-1}" in
0) echo "ready=false" >> "$GITHUB_OUTPUT" ;;
1) echo "ready=true" >> "$GITHUB_OUTPUT" ;;
*) echo "Invalid RELEASE_READY"; exit 1 ;;
esac
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '8.11.1'
- name: Fetch pinned model and runtime
run: bash scripts/fetch-models.sh
- name: Match packaged ARM64 ONNX Runtime to pinned upstream archive
run: |
set -euo pipefail
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
curl --fail --location --retry 3 -o "$tmp/ort.zip" https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.28.2/onnxruntime-android-1.28.2.zip
echo "01518867f78241138b6aa25925802e843a4fa9085af8d303d49e35bbb52aff4d $tmp/ort.zip" | sha256sum -c -
python3 - "$tmp/ort.zip" <<'PY'
import sys, zipfile, hashlib
with zipfile.ZipFile(sys.argv[1]) as src, zipfile.ZipFile("app/libs/sherpa-onnx-2.0.3.aar") as aar:
expected = hashlib.sha256(src.read("jni/arm64-v8a/libonnxruntime.so")).hexdigest()
actual = hashlib.sha256(aar.read("jni/arm64-v8a/libonnxruntime.so")).hexdigest()
print("ORT upstream binary SHA-256:", expected)
print("ORT bundled binary SHA-256:", actual)
assert expected == actual, "ONNX Runtime binary provenance mismatch"
PY
- name: Prepare exact Eigen source and NDK notices
run: bash scripts/prepare-release-notices.sh
- name: Build the verified offline pack
run: |
set -euo pipefail
source scripts/release-env.sh
if [[ "$MODEL_PACK" == Friday-ASR-* ]]; then python3 scripts/make-model-pack.py; fi
if [[ "$MODEL_PACK" == Friday-KWS-* ]]; then bash scripts/prepare-kws-pack.sh; fi
- name: Prepare pinned offline installation payload
run: bash scripts/prepare-bootstrap-models.sh
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Decode positive and negative synthetic speech with pinned production models
run: |
set -euo pipefail
source release.properties
sudo apt-get update -qq
sudo apt-get install -y -qq flite espeak-ng
python3 -m venv "$RUNNER_TEMP/friday-acoustic"
"$RUNNER_TEMP/friday-acoustic/bin/pip" install --only-binary=:all: sherpa-onnx==2.0.3 numpy==2.2.6
BOOTSTRAP_MODELS=1 "$RUNNER_TEMP/friday-acoustic/bin/python" scripts/check-acoustic-models.py
if [[ "$BOOTSTRAP_MODELS" == 0 ]]; then
rm -f app/src/main/assets/bootstrap/asr.zip app/src/main/assets/bootstrap/kws.zip
fi
- name: Generate original feedback cues
run: python3 scripts/prepare-feedback.py
- name: Test and compile
run: gradle --no-daemon :app:testDebugUnitTest :app:assembleRelease
- name: Check package, permissions, components, native libraries and notices
run: bash scripts/check-release-apk.sh app/build/outputs/apk/release/app-release-unsigned.apk
- name: Sign release with permanent certificate
if: github.ref == 'refs/heads/main'
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: |
set -euo pipefail
umask 077
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
for var in KEYSTORE_BASE64 KEYSTORE_PASSWORD KEY_ALIAS KEY_PASSWORD; do
if [ -z "${!var}" ]; then echo "::error::Missing signing credential: $var"; exit 1; fi
done
if ! printf '%s' "$KEYSTORE_BASE64" | base64 --decode > "$tmp/keystore" 2>/dev/null; then
echo "::error::Invalid keystore encoding"; exit 1
fi
tools="$ANDROID_HOME/build-tools/35.0.0"
apk=app/build/outputs/apk/release/app-release-unsigned.apk
if ! "$tools/apksigner" sign --ks "$tmp/keystore" --ks-type PKCS12 --ks-key-alias "$KEY_ALIAS" --ks-pass env:KEYSTORE_PASSWORD --key-pass env:KEY_PASSWORD --out "$tmp/assistant.apk" "$apk" > "$tmp/sign.log" 2>&1; then
echo "::error::Existing keystore signing failed; verify format, alias and passwords"; exit 1
fi
source scripts/release-env.sh
out="$PWD/build/release"
cp "$tmp/assistant.apk" "$out/$APK_NAME"
bash scripts/check-release-apk.sh "$out/$APK_NAME" signed
(
cd "$out"
files=("$APK_NAME" eigen-5.0.1.tar.gz)
if [[ -n "$MODEL_PACK" ]]; then files+=("$MODEL_PACK"); fi
if [[ "${RECOVERY_PACKS:-0}" == 1 ]]; then files+=("Friday-ASR-zipformer2-en-v2.zip" "Friday-KWS-gigaspeech-en-v1.zip"); fi
sha256sum "${files[@]}" > SHA256SUMS.txt
)
printf 'Source: %s\nWorkflow: %s\nPackage: %s\nVersion: %s (%s)\nSigner SHA-256: %s\n' \
"$GITHUB_SHA" "$GITHUB_RUN_ID" "$PACKAGE_ID" "$VERSION_NAME" "$VERSION_CODE" "$SIGNER_SHA256" > "$out/BUILD-PROVENANCE.txt"
cat "$out/SHA256SUMS.txt"
cp docs/RELEASE_NOTES.md "$out/RELEASE-NOTES.md"
printf '\nSource commit %s. Actions run %s. ARM64 Android 15.\n' "$GITHUB_SHA" "$GITHUB_RUN_ID" >> "$out/RELEASE-NOTES.md"
- name: Stage verified public release files
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: verified-release
path: |
build/release/Friday-*-arm64.apk
build/release/Friday-ASR-*.zip
build/release/Friday-KWS-*.zip
build/release/eigen-5.0.1.tar.gz
build/release/SHA256SUMS.txt
build/release/BUILD-PROVENANCE.txt
build/release/RELEASE-NOTES.md
if-no-files-found: error
retention-days: 1
- name: Upload unit-test report
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report
path: app/build/test-results/testDebugUnitTest/
publish:
if: github.ref == 'refs/heads/main' && needs.validate.outputs.release_ready == 'true'
needs: validate
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/download-artifact@v4
with:
name: verified-release
path: build/release
- name: Publish normal release and verify downloaded assets
env:
GH_TOKEN: ${{ github.token }}
run: bash scripts/publish-release.sh