Sync with Original Repo #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
#- wf # enable this for pipeline fine-tuning only (includes many testing commits which one can typically do to feature branch and then squash) | |
permissions: | |
contents: read | |
env: | |
CARGO_TERM_COLOR: always | |
MSServiceRegion: westeurope | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: cargo build --verbose | |
lint: | |
runs-on: ubuntu-latest | |
needs: ["build"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run fmt | |
run: cargo fmt -- --check | |
- name: Run clippy | |
run: cargo clippy -- -Dwarnings | |
unit-tests: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
needs: ["lint"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run tests on ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: cargo test --lib --verbose | |
- name: Run tests on windows | |
if: matrix.os == 'windows-latest' | |
run: cargo test --lib --verbose -- --skip bindgen_test_layout__azac_empty | |
- name: Run tests on macos | |
id: run-tests-on-macos | |
if: matrix.os == 'macos-latest' | |
run: | | |
cargo build --tests | |
speechSdkDir=$(find ./target/debug/build -type d -name "sdk_output") | |
speechSdkFrameworkPath="$speechSdkDir/MicrosoftCognitiveServicesSpeech.xcframework/macos-arm64_x86_64" | |
export DYLD_FALLBACK_FRAMEWORK_PATH="$speechSdkFrameworkPath" | |
cargo test --lib --verbose | |
integration-tests: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
environment: integration | |
env: | |
MSSubscriptionKey: ${{ secrets.MSSubscriptionKey }} | |
needs: ["unit-tests"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build tests | |
run: cargo build --tests | |
- name: Install tree on mac | |
if: matrix.os == 'macos-latest' | |
run: brew install --force --quiet tree | |
- name: List FS | |
run: tree | |
- name: Add SpeechSDK DLL folder to PATH (windows) | |
if: matrix.os == 'windows-latest' | |
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path | |
run: | | |
$speechSdkDir=Get-ChildItem -Path ./target/debug/build -Recurse -Directory -Filter sdk_output| Select-Object -ExpandProperty FullName | |
$speechSdkDLLFolder="$speechSdkDir\runtimes\win-x64\native" | |
echo $speechSdkDLLFolder | |
echo $speechSdkDLLFolder | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Add SpeechSDK LIB folder to PATH (ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
speechSdkDir=$(find ./target/debug/build -type d -name "sdk_output") | |
speechSdkDLLFolder="$speechSdkDir/lib/x64" | |
echo $speechSdkDLLFolder | |
ls -la $speechSdkDLLFolder | |
echo $speechSdkDLLFolder >> $GITHUB_PATH | |
- name: Add SpeechSDK LIB folder to DYLD_FALLBACK_FRAMEWORK_PATH (macos) | |
id: populate-dyld-fallback-framework | |
if: matrix.os == 'macos-latest' | |
run: | | |
speechSdkDir=$(find ./target/debug/build -type d -name "sdk_output") | |
speechSdkFrameworkPath="$speechSdkDir/MicrosoftCognitiveServicesSpeech.xcframework/macos-arm64_x86_64" | |
export DYLD_FALLBACK_FRAMEWORK_PATH="$speechSdkFrameworkPath" | |
echo "DYLD_FALLBACK_FRAMEWORK_PATH=$speechSdkFrameworkPath" >> $GITHUB_OUTPUT | |
- name: Run integration tests on windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
echo $env:Path | |
cargo test --test integration_test | |
- name: Run integration tests on ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
echo $PATH | |
cargo test --test integration_test | |
- name: Run integration tests on macos | |
if: matrix.os == 'macos-latest' | |
env: | |
DYLD_FALLBACK_FRAMEWORK_PATH: ${{ steps.populate-dyld-fallback-framework.outputs.DYLD_FALLBACK_FRAMEWORK_PATH }} | |
run: | | |
echo $DYLD_FALLBACK_FRAMEWORK_PATH | |
cargo test --test integration_test |