Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
f846c36
Adding $HOME/.local/bin to PATH
Jul 6, 2021
63f8b6e
Adding automatic-build mode to setup
Jul 15, 2021
de2aa03
Updaing docker build and usage
Jul 15, 2021
f922e53
Removing redundant requirements install
Jul 15, 2021
5da4247
Adding missing newline at the end of file
Jul 15, 2021
f5c78a4
Provide automatic tagging for image build
Jul 15, 2021
e60fffa
Improving version syntax
Jul 15, 2021
f15eaaf
Correcting version
Jul 15, 2021
8d5cb4b
Replacing old version variable with new one
Jul 15, 2021
861ad0a
Adding simple CI
Jul 19, 2021
f280c97
Correcting syntax
Jul 19, 2021
09eaafc
Correcting syntax
Jul 19, 2021
037b883
Correcting syntax
Jul 19, 2021
0010b4a
Correcting syntax
Jul 19, 2021
52dd465
Adding image build script for cpp
Jul 20, 2021
8c1f9b0
Adding cpp image build to CI
Jul 20, 2021
a7fe90e
Initializing submodules in image build step
Jul 20, 2021
d7390d9
Correcting image tagging
Jul 20, 2021
3ac7df2
Adding -dev prefix to dev images
Jul 20, 2021
439c3c8
Correcting images tags
Jul 20, 2021
5e2cc66
Adding workflow for publish deploy images
Jul 20, 2021
56952e0
Correcting setup script
Jul 20, 2021
f52165b
Adding CI tests
Jul 20, 2021
94fbf7a
Correcting syntax
Jul 20, 2021
95865e7
Correcting paths
Jul 20, 2021
d099bd8
Correcting arguments for cpp test
Jul 20, 2021
d0dc787
Correcting path
Jul 20, 2021
d43d290
Fixing shebang
Jul 20, 2021
797e062
Correcting --interim-results test
Jul 21, 2021
a14f019
Move image version to variable
Jul 21, 2021
d4e2f73
Adding context models test
Jul 21, 2021
e9ceb76
Modifying comments
Jul 21, 2021
9329758
Adding tests for run-on-docker script
Jul 21, 2021
54f1048
Removing copy of test files after test
Jul 21, 2021
9502f88
Adding tests for run-on-docker script
Jul 21, 2021
c3e2c31
Adding tests for run-on-docker scripts to CI
Jul 21, 2021
43edb1b
Enabling testing of custom images
Jul 22, 2021
d26e823
Temporary changes for debugging
Jul 22, 2021
fa69bd1
Temporary chnges for debugging
Jul 22, 2021
5931e4e
Temporary changes for debugging
Jul 22, 2021
62e5b61
Removing incorrect flags from docker run
Jul 22, 2021
c939de1
Reverting temporary changes
Jul 22, 2021
c702db6
Removing incorrect flags from docker run
Jul 22, 2021
5536ede
Enabling printing stderr for docker run
Jul 22, 2021
60b17d6
modify test names and improve output
Jul 22, 2021
4f9f24e
modify test names and improve output
Jul 22, 2021
4c46079
add temporary changes for testing badges
Jul 22, 2021
d788188
set ci status badge in readme
Jul 22, 2021
e7bbd0f
revert changes and return to the point when ci was passing
Jul 22, 2021
ad09822
print debug info in github runner
Jul 23, 2021
63c05a2
improve readability of output for debugging
Jul 23, 2021
80a8a24
show some more info for debugging
Jul 23, 2021
775a706
Remove -x mode from test script
Jul 23, 2021
20376a5
revert all changes since last ci fail
Jul 23, 2021
85a0434
revert all changes since last ci fail
Jul 23, 2021
fecd10d
revert all changes since last failed ci
Jul 23, 2021
c9535ea
Merge remote-tracking branch 'origin/master' into add-ci
Jul 26, 2021
0e1a059
correct accidentally omitted conflict in readme
Jul 26, 2021
ad2677a
Merge remote-tracking branch 'origin/master' into add-ci
Aug 2, 2021
439d63c
use test matrix, without publishing dev images
Aug 3, 2021
48cfc11
correct indents
Aug 3, 2021
d99c3f1
set directly ubuntu-20.04 as base OS for published images
Aug 3, 2021
a8fdc74
update httplib2 to 0.19.0
Aug 4, 2021
c973011
add multi-stage build for cpp image
Aug 18, 2021
5829619
remove pre-build proto sources
Aug 18, 2021
1018b72
set version number to 2.3.4
Aug 18, 2021
a51acf4
rename options and variables from 'ssl' to 'tls'
Aug 18, 2021
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
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: ci
on: [push, pull_request]
jobs:

test-python-service:
name: Test Python service
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
runs-on: ${{ matrix.os }}

steps:
- name: checkout code
uses: actions/checkout@v2

- name: set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: initialize submodules
run: git submodule update --init --recursive --progress --depth 1

- name: build docker image
run: |
cd python
./build_docker_image.sh "${GITHUB_REF##*/}"

- name: run tests
run: |
docker run --rm dictation-client-python:"${GITHUB_REF##*/}" ./tests/test_service_with_script_for_local_usage.sh
./python/tests/test_service_with_script_for_docker_usage.sh dictation-client-python:"${GITHUB_REF##*/}"


test-cpp-service:
name: Test C++ service
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
runs-on: ${{ matrix.os }}

steps:
- name: checkout code
uses: actions/checkout@v2

- name: initialize submodules
run: git submodule update --init --recursive --progress --depth 1

- name: build docker image
run: |
cd cpp
./build_docker_image.sh "${GITHUB_REF##*/}"

- name: run tests
run: |
docker run --rm dictation-client-cpp:"${GITHUB_REF##*/}" ./cpp/tests/test_service_with_script_for_local_usage.sh
./cpp/tests/test_service_with_script_for_docker_usage.sh dictation-client-cpp:"${GITHUB_REF##*/}"
48 changes: 48 additions & 0 deletions .github/workflows/publish-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish deploy images
on:
release:
types: [published]

jobs:

python-build:
name: Build and publish Python image
runs-on: ubuntu-20.04

steps:
- name: checkout code
uses: actions/checkout@v2
- name: build docker image and push to repository
env:
REPOSITORY: jaredharet/private
DOCKER_LOGIN: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASS }}
run: |
cd python
VERSION_TAG=$(awk < VERSION.py '/__version__/ { print $NF }' | cut -d\" -f2)
./build_docker_image.sh "${VERSION_TAG}"
docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" docker.io
docker tag dictation-client-python:"${VERSION_TAG}" "${REPOSITORY}":dictation-client-python-"${VERSION_TAG}"
docker push "${REPOSITORY}":dictation-client-python-"${VERSION_TAG}"

cpp-build:
name: Build and publish C++ image
runs-on: ubuntu-20.04

steps:
- name: checkout code
uses: actions/checkout@v2
- name: initialize submodules
run: git submodule update --init --recursive --progress --depth 1
- name: build docker image and push to repository
env:
REPOSITORY: jaredharet/private
DOCKER_LOGIN: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASS }}
run: |
cd cpp
VERSION_TAG=$(awk < libdictation-client/VERSION.h '/LIBDICTATION_CLIENT_VERSION/ { print $NF }' | cut -d\" -f2)
./build_docker_image.sh "${VERSION_TAG}"
docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" docker.io
docker tag dictation-client-cpp:"${VERSION_TAG}" "${REPOSITORY}":dictation-client-cpp-"${VERSION_TAG}"
docker push "${REPOSITORY}":dictation-client-cpp-"${VERSION_TAG}"
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This changelog is intended for tracking content changes in whole repository.
We are using single version and changelog for all components.
Dev note: Remember to synchronize version in files: `python/VERSION.py` and `cpp/libdictation-client/VERSION.h`

## [2.3.4] - 2020-05-12
### Changed
- [CPP, python] - renamed `ssl-dir` option [bool] to `tls-dir`.

## [2.3.3] - 2021-08-01
### Changed
- [CPP] Upgrade Boost version to 1.74.0
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# dictation-client

![ci Actions Status](https://github.com/JaredHaret/dictation-client/workflows/ci/badge.svg)

Dictation ASR gRPC client

Contents:
Expand Down
2 changes: 1 addition & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.5)

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules" ${CMAKE_MODULE_PATH})

project(dictation VERSION 1.0 LANGUAGES CXX)
project(dictation-client VERSION 2.3.4 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 14)

Expand Down
20 changes: 19 additions & 1 deletion Dockerfile-cpp → cpp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 AS build-stage

ARG DEBIAN_FRONTEND=noninteractive

LABEL dictation_client_cpp_build_stage_tmp=true

ADD ./cpp /dictation-client/cpp
ADD ./proto /dictation-client/proto
ADD ./tools /dictation-client/tools
Expand Down Expand Up @@ -36,3 +38,19 @@ RUN ./tools/install_boost.sh 4 \
RUN ./tools/build_googleapis.sh && cd cpp && ./make_proto.sh

RUN cd cpp && cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release && cmake --build build -- -j 4

RUN strip cpp/build/dictation_client

# ----------------------------------------------------------------------------------------------------- #

FROM ubuntu:20.04

ARG DEBIAN_FRONTEND=noninteractive

LABEL maintainer="<jan.wozniak@techmo.pl>"

COPY --from=build-stage /dictation-client/cpp/build/dictation_client /dictation-client/cpp/build/dictation_client
COPY --from=build-stage /dictation-client/submodules/ /dictation-client/submodules/
COPY --from=build-stage /opt /opt

WORKDIR /dictation-client
8 changes: 5 additions & 3 deletions cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ In this case open project repository in web browser, go to the `submodules` dire

### Build docker image

To prepare the docker image with C++ implementation of the Dictation Client, open project's main directory and run following command:
To prepare the docker image with C++ implementation of the Dictation Client, use the building script:

```
docker build -f Dockerfile-cpp -t dictation-client-cpp:2.3.2 .
./build_docker_image.sh
```
(To set custom image tag, use the tag name as optional argument, e.g.: `./build_docker_image.sh custom_tag`)

**Note:** The build process may take a several dozen minutes (for shorter build time use the python implementation instead).

When the build process is complete, following a message will be shown:
```
Successfully tagged dictation-client-cpp:2.3.2
Successfully tagged dictation-client-cpp:2.3.4
```

### Run Dictation client
Expand Down
21 changes: 21 additions & 0 deletions cpp/build_docker_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# coding=utf-8

set -euo pipefail
IFS=$'\n\t'

SCRIPT=$(realpath "$0")
SCRIPTPATH=$(dirname "${SCRIPT}")

COMMIT_TAG=""

if [[ "$#" -eq 0 ]]
then
COMMIT_TAG=$(awk < "${SCRIPTPATH}"/libdictation-client/VERSION.h '/LIBDICTATION_CLIENT_VERSION/ { print $NF }' | cut -d\" -f2)
else
COMMIT_TAG="$1"
fi

docker build -f "${SCRIPTPATH}/Dockerfile" -t dictation-client-cpp:"${COMMIT_TAG}" "${SCRIPTPATH}/.."

docker rmi "$(docker images --filter=label=dictation_client_cpp_build_stage_tmp=true -q)"
6 changes: 3 additions & 3 deletions cpp/dictation-client/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ po::options_description CreateOptionsDescription(void) {
("help", "Print help message.")
("service-address", po::value<std::string>()->required(),
"IP address and port (address:port) of a service the client will connect to.")
("ssl-dir", po::value<std::string>()->default_value(""),
"If set to a path with ssl credential files (client.crt, client.key, ca.crt), use ssl authentication. Otherwise use insecure channel (default).")
("tls-dir", po::value<std::string>()->default_value(""),
"If set to a path with SSL/TLS credential files (client.crt, client.key, ca.crt), use SSL/TLS authentication. Otherwise use insecure channel (default).")
("wav-path", po::value<std::string>()->required(),
"Path to wave file with audio content to be sent to service via RPC.")
("session-id", po::value<std::string>()->default_value(""),
Expand Down Expand Up @@ -129,7 +129,7 @@ int main(int argc, const char *const argv[]) {

techmo::dictation::DictationClient dictation_client{
userOptions["service-address"].as<std::string>(),
userOptions["ssl-dir"].as<std::string>(),
userOptions["tls-dir"].as<std::string>(),
};

if (userOptions.count("streaming")) {
Expand Down
49 changes: 27 additions & 22 deletions cpp/docker/run_dictation_client_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
# This script sends request to dictation service using dictation client inside docker container
# Requires "dictation-client-cpp:$IMAGE_VERSION" docker image loaded locally


set -euo pipefail
IFS=$'\n\t'

IMAGE_VERSION=2.3.2
IMAGE_VERSION="2.3.4"

SCRIPT=$(realpath "$0")
SCRIPTPATH=$(dirname "${SCRIPT}")
Expand All @@ -19,23 +18,26 @@ usage() {
echo "
Dictation ASR gRPC client ${IMAGE_VERSION}
Dictation ASR gRPC client options:

-h, --help Print help message.
-s=ADDRESS, --service-address=ADDRESS
--custom-image=IMAGE:TAG
Uses a custom docker image instead of the default.
-s=ADDRESS, --service-address=ADDRESS
IP address and port (address:port) of a service the client will connect to.
--tls If set, uses tls authentication, otherwise use insecure channel (default). The tls credential files (client.crt, client.key, ca.crt) should be placed inside 'tls' directory.
-f=WAVE, --filename=WAVE
--tls If set, uses SSL/TLS authentication, otherwise use insecure channel (default). The tls credential files (client.crt, client.key, ca.crt) should be placed inside 'tls' directory.
-f=WAVE, --filename=WAVE
Path to wave file with audio content to be sent to service via RPC.
--session-id=SESSION_ID
--session-id=SESSION_ID
Session ID to be passed to the service. If not specified, the service will generate a default session ID itself.
--grpc-timeout=GRPC_TIMEOUT
Timeout in milliseconds used to set gRPC deadline - how long the client is willing to wait for a reply from the server. If not specified, the service will set the deadline to a very large number.
--streaming If present, will perform asynchronous RPC. This is obligatory for audio content larger than 3.5 MB.
--time-offsets If true, returns also recognized word time offsets.
--single-utterance If set - the recognizer will detect a single spoken utterance.
--interim-results If set - messages with temporal results will be shown.
--service-settings=SETTINGS
--service-settings=SETTINGS
Semicolon-separated list of key=value pairs defining settings to be sent to service via gRPC request.
--max-alternatives=MAX_ALTERNATIVES
--max-alternatives=MAX_ALTERNATIVES
Maximum number of recognition hypotheses to be returned.
--context-phrase=CONTEXT_PHRASE
Specifies which context model to use.
Expand All @@ -47,22 +49,25 @@ while getopts "f:hs:-:" optchar; do
case "${optchar}" in
-)
case "${OPTARG}" in
help)
usage; exit 0
custom-image=*)
docker_image=${OPTARG#*=}
;;
help)
usage; exit 0
;;
tls)
opts+=( "--ssl-dir" "/volume/tls" )
tls)
opts+=( "--tls-dir" "/volume/tls" )
;;
time-offsets)
time-offsets)
opts+=( "--time-offsets=true" )
;;
single-utterance)
single-utterance)
opts+=( "--single-utterance=true" )
;;
interim-results)
interim-results)
opts+=( "--interim-results=true" )
;;
streaming)
streaming)
opts+=( "--streaming" )
;;
filename=*)
Expand All @@ -81,25 +86,25 @@ while getopts "f:hs:-:" optchar; do
fi
;;
esac;;
f)
f)
val=${OPTARG#*=}
opt=${OPTARG%=$val}
opts+=( "--wav-path" "/volume/wav/${val##*/}" )
;;
h)
usage; exit 0
h)
usage; exit 0
;;
s)
s)
val=${OPTARG#*=}
opt=${OPTARG%=$val}
opts+=( "--service-address" "${val}" )
;;
*)
usage
usage
exit 1
;;
esac
done

docker run --rm -it -v "${SCRIPTPATH}:/volume" --network host "${docker_image}" \
docker run --rm -v "${SCRIPTPATH}:/volume" --network host "${docker_image}" \
./cpp/build/dictation_client "${opts[@]}"
2 changes: 1 addition & 1 deletion cpp/libdictation-client/VERSION.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
static constexpr auto LIBDICTATION_CLIENT_VERSION = "2.3.3";
static constexpr auto LIBDICTATION_CLIENT_VERSION = "2.3.4";
Loading