Skip to content

Commit f9a9d39

Browse files
committed
ci : extract coreml job into coreml.yml
1 parent 6b756d4 commit f9a9d39

2 files changed

Lines changed: 64 additions & 38 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ on:
4343
- '.github/workflows/build-wasm.yml' # handled by build-wasm.yml
4444
- '.github/workflows/build-android.yml' # handled by build-android.yml
4545
- '.github/workflows/quantize.yml' # handled by quantize.yml
46+
- '.github/workflows/coreml.yml' # handled by coreml.yml
4647

4748
concurrency:
4849
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
@@ -71,44 +72,6 @@ jobs:
7172
# cmake -B build
7273
# cmake --build build --config Release
7374

74-
coreml-base-en:
75-
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') ||
76-
startsWith(github.ref, 'refs/tags/v') }}
77-
runs-on: macos-latest
78-
79-
steps:
80-
- name: Checkout with full history
81-
uses: actions/checkout@v6
82-
with:
83-
fetch-depth: 0
84-
85-
- name: Set environment variables
86-
id: set_vars
87-
run: |
88-
BUILD_NUMBER=$(git rev-list --count HEAD)
89-
SHORT_HASH=$(git rev-parse --short=7 HEAD)
90-
if [[ "${{ github.ref_type }}" == "tag" ]]; then
91-
TAG_NAME="${{ github.ref_name }}"
92-
elif [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
93-
TAG_NAME="b${BUILD_NUMBER}"
94-
else
95-
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
96-
TAG_NAME="${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}"
97-
fi
98-
echo "MODEL_NAME=base.en" >> $GITHUB_ENV
99-
echo "GEN_MODEL_NAME=whisper-${TAG_NAME}-ggml-base.en-encoder.mlmodelc" >> $GITHUB_ENV
100-
101-
- name: Download model
102-
run: |
103-
./models/download-ggml-model.sh ${{ env.MODEL_NAME }}
104-
105-
- name: Generate CoreML model
106-
run: |
107-
python3.11 -m venv venv
108-
source venv/bin/activate
109-
pip install ane_transformers openai-whisper coremltools
110-
./models/generate-coreml-model.sh ${{ env.MODEL_NAME }}
111-
11275
vad:
11376
runs-on: ubuntu-latest
11477

.github/workflows/coreml.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CI (coreml)
2+
3+
on:
4+
workflow_dispatch: # allows manual triggering
5+
push:
6+
branches:
7+
- master
8+
tags:
9+
- 'v*'
10+
paths: ['.github/workflows/coreml.yml',
11+
'**/CMakeLists.txt',
12+
'**/*.h',
13+
'**/*.hpp',
14+
'**/*.c',
15+
'**/*.cpp',
16+
'**/*.swift',
17+
'**/*.m',
18+
'**/*.mm',
19+
'**/*.metal']
20+
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
23+
cancel-in-progress: true
24+
25+
env:
26+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
27+
28+
jobs:
29+
coreml-base-en:
30+
runs-on: macos-latest
31+
32+
steps:
33+
- name: Checkout with full history
34+
uses: actions/checkout@v6
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Set environment variables
39+
id: set_vars
40+
run: |
41+
BUILD_NUMBER=$(git rev-list --count HEAD)
42+
SHORT_HASH=$(git rev-parse --short=7 HEAD)
43+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
44+
TAG_NAME="${{ github.ref_name }}"
45+
elif [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
46+
TAG_NAME="b${BUILD_NUMBER}"
47+
else
48+
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
49+
TAG_NAME="${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}"
50+
fi
51+
echo "MODEL_NAME=base.en" >> $GITHUB_ENV
52+
echo "GEN_MODEL_NAME=whisper-${TAG_NAME}-ggml-base.en-encoder.mlmodelc" >> $GITHUB_ENV
53+
54+
- name: Download model
55+
run: |
56+
./models/download-ggml-model.sh ${{ env.MODEL_NAME }}
57+
58+
- name: Generate CoreML model
59+
run: |
60+
python3.11 -m venv venv
61+
source venv/bin/activate
62+
pip install ane_transformers openai-whisper coremltools
63+
./models/generate-coreml-model.sh ${{ env.MODEL_NAME }}

0 commit comments

Comments
 (0)