diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml new file mode 100644 index 000000000..6cee4ace8 --- /dev/null +++ b/.github/workflows/cli.yml @@ -0,0 +1,12 @@ +name: CLI + +jobs: + run_tests: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Test CLI + run: | + chmod +x ./integration_tests/run_integration_tests.sh + ./integration_tests/run_integration_tests.sh + shell: bash diff --git a/.gitignore b/.gitignore index f32e18bc8..8622207a0 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,8 @@ dist/ # Data to ignore. /data demo_data/ +# Artifacts from integration test data. +test_data/ # Ignore pickled concept models. data/concept/**/*.pkl diff --git a/integration_tests/run_integration_tests.sh b/integration_tests/run_integration_tests.sh new file mode 100755 index 000000000..d8ab9d3b2 --- /dev/null +++ b/integration_tests/run_integration_tests.sh @@ -0,0 +1,24 @@ +# Bash-based integration tests for lilac. + +set -e # Fail if any of the commands below fail. + +# Make sure the CLI succeeds for test_data. +mkdir -p test_data +touch test_data/lilac.yml + +FREE_PORT=$(python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'); + + +poetry run lilac start test_data --port $FREE_PORT & +pid="$!" # need to get the pid of the vlc process. +sleep 4 + +# Make a test request using curl +curl --fail "http://localhost:$FREE_PORT/" + +# Save curl's exit code (-f option causes it to return one on HTTP errors) +curl_exit_code=$? + +kill $pid + +exit 0 diff --git a/scripts/test.sh b/scripts/test.sh index 6d176356b..18834facf 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -5,3 +5,4 @@ set -e ./scripts/test_ts.sh ./scripts/test_py.sh +./integration_tests/run_integration_tests.sh