Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Github Actions #1

Merged
merged 8 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 194 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
name: CI

on: [push, pull_request]

env:
# Checks for the '[debug]' string in the commit message to compile as debug instead of release.
build_type: ${{ contains(github.event.head_commit.message, '[debug]') && 'Debug' || 'Release' }}
# Checks whether the event corresponds to a tag to activate the automatic creation of a release.
is_tagged: ${{ startsWith(github.ref, 'refs/tags/') }}

jobs:
# Checks source code formatting with clang before compiling.
Format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check
uses: jidicula/clang-format-action@v4.13.0
with:
clang-format-version: '18'
check-path: '.'
# Creates a cache for the model downloaded and transcribed
# into the C++ file for embedding in the binary.
Cache:
runs-on: ubuntu-latest
needs: Format
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache
uses: actions/cache@v4
with:
path: ./build/source
key: wvp-model-tiny
enableCrossOsArchive: true
- name: Configure
run: cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.build_type }}
# Compiles, tests and packages the plugin for Ubuntu.
Ubuntu:
runs-on: ubuntu-latest
needs: Cache
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache
uses: actions/cache@v4
with:
path: ./build/source
key: wvp-model-tiny
enableCrossOsArchive: true
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Configure
run: cmake -B ${{ github.workspace }}/build -G Ninja -DCMAKE_BUILD_TYPE=${{ env.build_type }}
- name: Build
run: cmake --build ${{ github.workspace }}/build
- name: Test
run: ctest -C ${{ env.build_type }} -VV --test-dir ${{ github.workspace }}/build
- name: Artifact
uses: actions/upload-artifact@v4.3.6
with:
name: Whisper-Linux
path: ${{ github.workspace }}/package/Whisper-Linux.tar.gz
- name: Release
uses: softprops/action-gh-release@v2
if: ${{ env.is_tagged == 'true' }}
with:
draft: true
prerelease: true
fail_on_unmatched_files: true
files: ${{ github.workspace }}/package/Whisper-Linux.tar.gz
# Compiles, tests and packages the plugin for Windows.
Windows:
runs-on: windows-latest
needs: Cache
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache
uses: actions/cache@v4
with:
path: ./build/source
key: wvp-model-tiny
enableCrossOsArchive: true
- name: Prepare
run: powershell -Command "& {[System.IO.File]::WriteAllBytes('${{ github.workspace }}\cert.p12', [System.Convert]::FromBase64String('${{ secrets.SECTIGO_CERT_P12}}'))}"
- name: Configure
run: cmake -B ${{ github.workspace }}/build -G "Visual Studio 17 2022" -A x64 -DVPP_NOTARIZE=ON -DVPP_CODESIGN_WINDOWS_KEYFILE=${{ github.workspace }}\cert.p12 -DVPP_CODESIGN_WINDOWS_KEYPASSWORD=${{ secrets.DEV_ID_PASSWORD }}
- name: Build
run: cmake --build ${{ github.workspace }}/build --config ${{ env.build_type }}
- name: Test
run: ctest -C ${{ env.build_type }} -VV --test-dir ${{ github.workspace }}/build
- name: Artifact
uses: actions/upload-artifact@v4.3.6
with:
name: Whisper-Windows
path: ${{ github.workspace }}/package/Whisper-Windows.exe
- name: Release
uses: softprops/action-gh-release@v2
if: ${{ env.is_tagged == 'true' }}
with:
draft: true
prerelease: true
fail_on_unmatched_files: true
files: ${{ github.workspace }}/package/Whisper-Windows.exe
# Compiles, tests and packages the plugin for MacOS.
MacOS:
runs-on: macos-latest
needs: Cache
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache
uses: actions/cache@v4
with:
path: ./build/source
key: wvp-model-tiny
enableCrossOsArchive: true
- name: Prepare
run: |
security create-keychain -p ${{ secrets.DEV_ID_PASSWORD }} buildagent
security unlock-keychain -p ${{ secrets.DEV_ID_PASSWORD }} buildagent
security list-keychains -s buildagent && security default-keychain -s buildagent
echo ${{ secrets.DEV_ID_APP_CERT }} | base64 --decode > ./cert.p12
security import ./cert.p12 -P ${{ secrets.DEV_ID_PASSWORD }} -A -t cert -f pkcs12 -k buildagent -T /usr/bin/codesign >/dev/null
rm ./cert.p12
echo ${{ secrets.DEV_ID_INST_CERT }} | base64 --decode > ./cert.p12
security import ./cert.p12 -P ${{ secrets.DEV_ID_PASSWORD }} -A -t cert -f pkcs12 -k buildagent -T /usr/bin/codesign >/dev/null
rm ./cert.p12
security set-key-partition-list -S "apple-tool:,apple:,codesign:" -s -k ${{ secrets.DEV_ID_PASSWORD }} buildagent >/dev/null
xcrun notarytool store-credentials "notary-installer" --apple-id ${{ secrets.DEV_USER_APPLE_ID }} --team-id ${{ secrets.DEV_TEAM_APPLE_ID }} --password ${{ secrets.DEV_SPEC_APP_PASSWORD }} >/dev/null
- name: Configure
run: cmake -B ${{ github.workspace }}/build -G "Xcode" -DVPP_CODESIGN_APPLE_KEYCHAIN_PROFILE_INSTALLER="notary-installer" -DVPP_NOTARIZE=ON
- name: Build
run: |
security unlock-keychain -p ${{ secrets.DEV_ID_PASSWORD }} buildagent
security set-keychain-settings -lut 7200 buildagent
set -o pipefail && cmake --build ${{ github.workspace }}/build --config ${{ env.build_type }} | xcbeautify --renderer github-actions
- name: Test
run: ctest -C ${{ env.build_type }} -VV --test-dir ${{ github.workspace }}/build
- name: Artifact
uses: actions/upload-artifact@v4.3.6
with:
name: Whisper-MacOS
path: ${{ github.workspace }}/package/Whisper-MacOS.pkg
- name: Release
uses: softprops/action-gh-release@v2
if: ${{ env.is_tagged == 'true' }}
with:
draft: true
prerelease: true
fail_on_unmatched_files: true
files: ${{ github.workspace }}/package/Whisper-MacOS.pkg
# Generates the documentation.
Doc:
runs-on: ubuntu-latest
needs: Cache
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install mdpdf -g
- name: Cache
uses: actions/cache@v4
with:
path: ./build/source
key: wvp-model-tiny
enableCrossOsArchive: true
- name: Configure
run: cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.build_type }}
- name: Build
run: |
cmake --build build --target wvp_manual
zip -jr Whisper-Manual.zip ${{ github.workspace }}/build/Manual
- name: Artifact
uses: actions/upload-artifact@v4.3.6
with:
name: Whisper-Manual
path: ${{ github.workspace }}/build/Manual
- name: Release
uses: softprops/action-gh-release@v2
if: ${{ env.is_tagged == 'true' }}
with:
draft: true
prerelease: true
fail_on_unmatched_files: true
files: ${{ github.workspace }}/Whisper-Manual.zip
151 changes: 0 additions & 151 deletions .gitlab-ci.yml

This file was deleted.

31 changes: 15 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,25 +135,24 @@ if(CLANG_FORMAT_EXE)
add_custom_target(wvp_check_format ${CLANG_FORMAT_EXE} --Werror --dry-run --verbose -style=file ${WVP_SOURCES})
add_custom_target(wvp_apply_format ${CLANG_FORMAT_EXE} -i -style=file ${WVP_SOURCES})
else()
message(WARNING "Clang Format targets cannot be generated because clang-format is not found")
message(STATUS "Clang Format targets cannot be generated because clang-format is not found")
endif()

### Manual ###
if(APPLE)
find_program(MDPDF_EXE "mdpdf")
find_program(SED_EXE "sed")
if(MDPDF_EXE)
set(WVP_MANUAL_PATH ${CMAKE_CURRENT_BINARY_DIR}/whisper-manual.md)
add_custom_target(wvp_manual
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/docs/whisper-manual.md ${WVP_MANUAL_PATH}
COMMAND ${SED_EXE} -i "" "s/APPVERSION/${CMAKE_PROJECT_VERSION_MAJOR}/g" "${WVP_MANUAL_PATH}"
COMMAND ${SED_EXE} -i "" -e "s|src=\"images|src=\"${CMAKE_CURRENT_SOURCE_DIR}/docs/images|g" "${WVP_MANUAL_PATH}"
COMMAND ${MDPDF_EXE} ${WVP_MANUAL_PATH}
VERBATIM
)
else()
message(WARNING "Manual target cannot be generated because mdpdf is not found")
endif()
set(WVP_MANUAL_DIR ${CMAKE_CURRENT_BINARY_DIR}/Manual)
file(MAKE_DIRECTORY ${WVP_MANUAL_DIR})
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/docs/whisper-manual.md MANUAL_CONTENT)
string(REPLACE "APPVERSION" "${WVP_BUILD_TAG} (${GIT_COMMIT_ID})" MANUAL_CONTENT ${MANUAL_CONTENT})
string(REPLACE "src=\"../resource/" "src=\"./" MANUAL_CONTENT ${MANUAL_CONTENT})
file(WRITE ${WVP_MANUAL_DIR}/whisper-manual.md ${MANUAL_CONTENT})
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/_deps/whisper_cpp-src/models/download-ggml-model.cmd DESTINATION ${WVP_MANUAL_DIR})
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/_deps/whisper_cpp-src/models/download-ggml-model.sh DESTINATION ${WVP_MANUAL_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/resource/Screenshot.png DESTINATION ${WVP_MANUAL_DIR})
find_program(MDPDF_EXE "mdpdf")
if(MDPDF_EXE)
add_custom_target(wvp_manual COMMAND ${MDPDF_EXE} ${WVP_MANUAL_DIR}/whisper-manual.md --debug VERBATIM)
else()
message(STATUS "Manual target cannot be generated because mdpdf is not found")
endif()

### Install ###
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Whisper Vamp Plugin

<p align="center">
<a href="https://github.com/Ircam-Partiels/whisper-vamp-plugin/actions/workflows/ci.yml"><img src="https://github.com/Ircam-Partiels/whisper-vamp-plugin/actions/workflows/ci.yml/badge.svg" alt="Workflows"></a>
</p>

The Whisper plug-in is an implementation of the [Whisper](https://github.com/openai/whisper) speech recognition model developed by [OpenAI](https://openai.com/) as a [Vamp plug-in](https://www.vamp-plugins.org/). The Whisper plug-in analyses the text in the audio stream and generates markers corresponding to the tokens (words and/or syllables) found.

The Whisper Vamp Plugin has been designed for use in the [Partiels](https://forum.ircam.fr/projects/detail/partiels/) application and requires the [Ircam Vamp Extension](https://github.com/Ircam-Partiels/ircam-vamp-extension).
Expand Down
Loading