Skip to content

Commit

Permalink
Adds expect script to run the demo app during CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dylon committed Feb 14, 2024
1 parent a94d962 commit 59a9ac9
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 10 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/run-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Run Demo

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all
# matrix combinations. Consider changing this to true when your workflow
# is stable.
fail-fast: false

matrix:
os: [ubuntu-latest]
build_type: [Debug, Release]

steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: false
environment-file: environment.yml
activate-environment: ll-cpp
miniforge-version: latest
use-mamba: true
channels: conda-forge

- name: Configure liblevenshtein-cpp
shell: bash -el {0}
run: >
cmake -B build
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
- name: Build liblevenshtein-cpp
shell: bash -el {0}
run: cmake --build build --config ${{ matrix.build_type }}

- name: Install liblevenshtein-cpp
shell: bash -el {0
run: cmake --install build --config ${{ matrix.build_type }}

- name: Configure liblevenshtein-demo
working-directory: example
shell: bash -el {0}
run: >
cmake -B build
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
- name: Build liblevenshtein-demo
working-directory: example
shell: bash -el {0}
run: cmake --build build --config ${{ matrix.build_type }}

- name: Run liblevenshtein-demo
working-directory: example
shell: bash -el {0
run: >
./scripts/run-demo.exp ./build/liblevenshtein-demo
--dictionary-path programming-languages.txt
--serialization-path build/programming-languages.pb
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
!/example/environment*.yml
!/example/programming-languages.txt

!/example/scripts/*.exp
!/example/scripts/*.sh

!/cmake/**/*.cmake

!/proto/CMakeLists.txt
Expand Down
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,20 @@ int main(int argc, char *argv[]) {
```

### Dependencies

For the most up-to-date list of dependencies, please reference
[environment.yml](environment.yml).

1. [CMake](https://cmake.org/)
2. [Make](https://www.gnu.org/software/make/)
3. C++ Compiler
- Linux
- [g++](https://gcc.gnu.org/)
- [clang++](https://clang.llvm.org/)
- MacOS
- [clang++](https://clang.llvm.org/)
- Windows
- [vc++](https://visualstudio.microsoft.com/)
3. C++ Compiler:
- Linux:
- [g++](https://gcc.gnu.org/)
- [clang++](https://clang.llvm.org/)
- MacOS:
- [clang++](https://clang.llvm.org/)
- Windows:
- [vc++](https://visualstudio.microsoft.com/)
4. [Protocol Buffers](https://protobuf.dev/)
5. [Google Test](https://github.com/google/googletest)
6. [RapidCheck](https://github.com/emil-e/rapidcheck)
Expand Down
2 changes: 0 additions & 2 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ set(CMAKE_COMPILE_WARNING_AS_ERROR ON)

set(CMAKE_VERBOSE_MAKEFILE ON)

include(GNUInstallDirs)

find_package(Protobuf REQUIRED)
find_package(liblevenshtein REQUIRED)

Expand Down
5 changes: 5 additions & 0 deletions example/scripts/run-demo.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env expect
spawn {*}$argv
expect -ex "query> " {send "jvaa\n"}
expect -ex "query> " {send "\n"}
expect eof

0 comments on commit 59a9ac9

Please sign in to comment.