Skip to content

Commit

Permalink
CI ONLY: #54
Browse files Browse the repository at this point in the history
Change-Id: I5a7f727c4be08ebdf911f78c39ffc578ddb670b4
  • Loading branch information
Fleker committed Nov 2, 2018
1 parent af83049 commit 3bc62d4
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 39 deletions.
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,37 +52,31 @@ cd third_party/protobuf
sudo make install
sudo ldconfig
export LDFLAGS="$LDFLAGS -lm"
cd ${GRPC_PATH}
make clean
make
LDFLAGS="-lm" make
sudo make install
sudo ldconfig
cd ${PROJECT_PATH}
git clone https://github.com/googleapis/googleapis.git
cd googleapis/
make LANGUAGE=cpp
GOOGLEAPIS_GENS_PATH=${PROJECT_PATH}/googleapis/gens make LANGUAGE=cpp
```

4. Make sure you setup environment variable `$GOOGLEAPIS_GENS_PATH`
```
export GOOGLEAPIS_GENS_PATH=${PROJECT_PATH}/googleapis/gens
```

5. Build this project
4. Build this project
```
cd ${PROJECT_PATH}
make run_assistant
```

6. Get credentials file. It must be an end-user's credentials.
5. Get credentials file. It must be an end-user's credentials.

* Go to the [Actions Console](https://console.actions.google.com/) and register your device model, following [these instructions](https://developers.google.com/assistant/sdk/guides/library/python/embed/register-device)
* Move it in this folder and rename it to `client_secret.json`
* run `get_credentials.sh` in this folder. It will create the file `credentials.json`.

7. Start one of the `run_assistant` samples:
6. Start one of the `run_assistant` samples:

```bash
./run_assistant_file --input ./resources/weather_in_mountain_view.raw --output ./response.wav --credentials ./credentials.json
Expand Down
24 changes: 11 additions & 13 deletions tests/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash
set -e
set -u
set -o pipefail
set -x
PROJECT_PATH=$(pwd)

Expand All @@ -14,11 +16,11 @@ sudo apt-get install -y libasound2-dev # For ALSA sound output
sudo apt-get install -y libcurl4-openssl-dev # CURL development library

# Step 3. Build protocol buffer, gRPC, and Google APIs
git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc
git clone -b "$(curl -L https://grpc.io/release)" https://github.com/grpc/grpc
GRPC_PATH=${PROJECT_PATH}/grpc
cd ${GRPC_PATH}
cd "${GRPC_PATH}"
# Checkout stable release of gRPC
git checkout v1.11.0
git checkout v1.15.0
git submodule update --init

echo "Compiling gRPC protobufs"
Expand All @@ -28,26 +30,22 @@ sudo make install
sudo ldconfig

echo "Compiling gRPC"
export LDFLAGS="$LDFLAGS -lm"
cd ${GRPC_PATH}
cd "${GRPC_PATH}"
make clean
make
LDFLAGS="-lm" make
sudo make install
sudo ldconfig

echo "Compiling Google APIs"
cd ${PROJECT_PATH}
cd "${PROJECT_PATH}"
git clone https://github.com/googleapis/googleapis.git
cd googleapis/
make LANGUAGE=cpp

# Step 4. Export environmental variable
export GOOGLEAPIS_GENS_PATH=${PROJECT_PATH}/googleapis/gens

# Step 5. Build assistant-grpc
# Step 4. Build assistant-grpc
echo "Compiling C++ Assistant"
cd ${PROJECT_PATH}
make run_assistant
cd "${PROJECT_PATH}"
GOOGLEAPIS_GENS_PATH=${PROJECT_PATH}/googleapis/gens make run_assistant

# If we get to this point, the project has successfully been built, and we can exit.
echo "Project built!"
10 changes: 8 additions & 2 deletions tests/clean-all.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/bin/bash
set -e
set -u
set -o pipefail
set -x

# Greedily cleans the project and system-wide dependencies
# This will put the development machine in a clean state
# to install development tools.
rm -f *.o run_assistant googleapis.ar ./src/*.o
git clean -xfd -e *.json
rm -rf ./grpc/ ./googleapis/
# https://github.com/grpc/grpc/pull/10706#issuecomment-302775038
sudo apt-get purge -y libc-ares-dev
Expand All @@ -17,4 +23,4 @@ sudo rm -rf /usr/local/bin/grpc_* \
/usr/local/lib/libgrpc* \
/usr/local/lib/pkgconfig/protobuf* \
/usr/local/lib/pkgconfig/grpc* \
/usr/local/share/grpc/
/usr/local/share/grpc/
9 changes: 6 additions & 3 deletions tests/integration_audio_file.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Tests that the command "weather in mountain view"
# will return some data including the name of the town
# to verify the Assistant SDK end-to-end.
#!/bin/bash
set -e
set -u
set -o pipefail
set -x

# Tests that the command "weather in mountain view"
# will return some data including the name of the town
# to verify the Assistant SDK end-to-end.
./run_assistant_file --input ./resources/weather_in_mountain_view.raw \
--output /tmp/google-assistant-sdk-audio-output.raw \
--credentials ./credentials.json \
Expand Down
11 changes: 7 additions & 4 deletions tests/integration_en_us.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Tests that the command "how do you say hi in spanish"
# will return "Hola" to verify the Assistant SDK
# end-to-end.
#!/bin/bash
set -e
set -u
set -o pipefail
set -x

echo "how do you say hi in spanish" | ./run_assistant_text \
# Tests that the command "How do you say hi in spanish?"
# will return "Hola" to verify the Assistant SDK
# end-to-end.
echo "How do you say hi in spanish?" | ./run_assistant_text \
--credentials ./credentials.json --verbose | grep "Hola"
11 changes: 7 additions & 4 deletions tests/integration_fr.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Tests that the command "how do you say hello in spanish"
# will return "buenos dias" to verify the Assistant SDK
# end-to-end.
#!/bin/bash
set -e
set -u
set -o pipefail
set -x

echo "comment dit-on bonjour en español" | ./run_assistant_text \
# Tests that the command "How do you say hello in spanish?"
# will return "Buenos dias" to verify the Assistant SDK
# end-to-end.
echo "Comment dit-on bonjour en espagnol?" | ./run_assistant_text \
--credentials ./credentials.json \
--locale "fr-FR" --verbose | grep "Buenos dias"
8 changes: 6 additions & 2 deletions tests/test_all.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/bin/bash
set -e
set -u
set -o pipefail
set -x

# Run all tests
# Expected usage:
# > cpp$ ./tests/test_all.sh
set -e
set -x

# Verify it builds
./tests/build.sh
Expand Down

0 comments on commit 3bc62d4

Please sign in to comment.