File: examples-wasm.yml

package info (click to toggle)
whisper.cpp 1.8.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 32,228 kB
  • sloc: cpp: 188,765; ansic: 121,729; lisp: 10,221; sh: 4,272; objc: 2,159; ruby: 1,682; python: 1,177; javascript: 594; makefile: 144
file content (97 lines) | stat: -rw-r--r-- 2,756 bytes parent folder | download
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
name: Examples WASM
on:
  push:
    branches: ["master"]

  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: "pages"
  cancel-in-progress: false

jobs:
  deploy-wasm-github-pages:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Pages
        uses: actions/configure-pages@v4

      - name: Setup emsdk
        uses: mymindstorm/setup-emsdk@v14

      - name: Build WASM Examples
        # Enable for real build later in whisper.cpp
        run: |
          mkdir -p build-em && cd build-em
          emcmake cmake .. -DCMAKE_BUILD_TYPE=Release
          make -j

      - name: Create staging directory
        run: mkdir -p staging

      - name: Create .nojekyll file in staging directory
        run: touch staging/.nojekyll

      - name: Copy application files
        run: |
          build_dir=build-em/bin

          ls ${build_dir}

          # command.wasm
          target_dir=staging/command.wasm
          mkdir -p ${target_dir}
          cp ${build_dir}/command.wasm/{index.html,command.js,helpers.js} ${target_dir}
          cp ${build_dir}/libcommand.js ${target_dir}

          # bench.wasm
          target_dir=staging/bench.wasm
          mkdir -p ${target_dir}
          cp ${build_dir}/bench.wasm/{index.html,bench.js,helpers.js} ${target_dir}
          cp ${build_dir}/libbench.js ${target_dir}

          # stream.wasm
          target_dir=staging/stream.wasm
          mkdir -p ${target_dir}
          cp ${build_dir}/stream.wasm/{index.html,stream.js,helpers.js} ${target_dir}
          cp ${build_dir}/libstream.js ${target_dir}

          # wchess.wasm
          target_dir=staging/wchess.wasm
          mkdir -p ${target_dir}
          cp -r ${build_dir}/wchess.wasm/{index.html,css,img,js} ${target_dir}
          cp ${build_dir}/wchess.wasm.js ${target_dir}

          # whisper.wasm (this will be the main example page)
          target_dir=staging
          mkdir -p ${target_dir}
          cp ${build_dir}/whisper.wasm/{index.html,main.js,helpers.js} ${target_dir}
          cp ${build_dir}/libmain.js ${target_dir}

          # Copy Cross-Origin Isolation service worker
          cp -v examples/coi-serviceworker.js staging/

      - name: List files in staging directory (for debugging)
        run: |
          echo "Files in staging directory:"
          find staging -type f | sort

      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: ./staging

      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4