Use python-sdk make test
target to run all python-sdk tests
#16
Workflow file for this run
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: Tests | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
types: [opened, synchronize, reopened, labeled, unlabeled] | |
branches: | |
- 'main' | |
paths: | |
- 'server/**' | |
- 'python-sdk/**' | |
- '.github/workflows/tests.yaml' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
lint_server: | |
name: Lint Indexify Server | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Lint indexify-server | |
run: | | |
cd server | |
make check | |
build_server: | |
name: Build Indexify Server | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Copy rust-toolchain | |
run: cp server/rust-toolchain.toml . | |
- name: Setup Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
cache-directories: | | |
server/target | |
- name: Setup Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
cache-directories: | | |
server/target | |
- name: Build indexify-server | |
run: | | |
cd server | |
cargo build | |
- name: Lint indexify-server | |
run: | | |
cd server | |
make check | |
- name: Test indexify-server | |
run: | | |
cd server | |
cargo test --workspace -- --test-threads 1 | |
- name: Upload indexify-server | |
uses: actions/upload-artifact@v4 | |
with: | |
name: indexify-server | |
path: server/target/debug/indexify-server | |
lint_python_sdk: | |
name: Lint Indexify Python SDK | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
cache: 'poetry' | |
- name: Build python-sdk | |
run: | | |
cd python-sdk | |
make build | |
- name: Lint python-sdk | |
run: | | |
cd python-sdk | |
make check | |
acceptance_tests: | |
name: Run Acceptance Tests | |
needs: [build_server, lint_python_sdk] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download indexify-server | |
uses: actions/download-artifact@v4 | |
with: | |
name: indexify-server | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
cache: 'poetry' | |
- name: Build python-sdk | |
run: | | |
cd python-sdk | |
make build | |
- name: Lint python-sdk | |
run: | | |
cd python-sdk | |
make check | |
- name: Start Background Indexify Server | |
uses: JarvusInnovations/background-action@v1 | |
with: | |
run: | | |
chmod u+x ./indexify-server | |
RUST_LOG=debug ./indexify-server & | |
wait-on: | | |
tcp:localhost:8900 | |
tail: true | |
wait-for: 30s | |
log-output: true | |
# always logging the output to debug test failures. | |
log-output-if: true | |
- name: Start Background Indexify Executor | |
uses: JarvusInnovations/background-action@v1 | |
with: | |
run: | | |
cd python-sdk | |
poetry run indexify-cli executor & | |
wait-on: | | |
tcp:localhost:8900 | |
tail: true | |
wait-for: 10s | |
log-output: true | |
# always logging the output to debug test failures. | |
log-output-if: true | |
- name: Wait for readiness | |
run: | | |
serverReady=false | |
counter=0 | |
while [ "$serverReady" != true ]; do | |
output=$(curl --silent --fail http://localhost:8900/internal/executors | jq '. | length' 2>/dev/null) | |
if [[ $? -eq 0 && "$output" -ge 1 ]]; then | |
echo "Server ready with executors." | |
serverReady=true | |
else | |
echo 'Waiting for executors to join server...' | |
counter=$((counter+1)) | |
if [ $counter -gt 6 ]; then | |
echo "Timeout waiting for executors to join server." | |
exit 1 | |
fi | |
sleep 5 | |
fi | |
done | |
- name: Run All Tests | |
run: | | |
cd python-sdk | |
export INDEXIFY_URL=http://localhost:8900 | |
make test | |
last_release_acceptance_tests: | |
name: 'Last Release Acceptance Tests (trigger with label: ci_compat_test)' | |
if: contains(github.event.pull_request.labels.*.name, 'ci_compat_test') | |
needs: [build_server, lint_python_sdk] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Checkout latest | |
run: | | |
git fetch --tags | |
latestTag=$(git describe --tags "$(git rev-list --tags --max-count=1)") | |
git checkout $latestTag | |
- name: Download indexify-server | |
uses: actions/download-artifact@v4 | |
with: | |
name: indexify-server | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
cache: 'poetry' | |
- name: Build python-sdk | |
run: | | |
cd python-sdk | |
make build | |
- name: Start Background Indexify Server | |
uses: JarvusInnovations/background-action@v1 | |
with: | |
run: | | |
chmod u+x ./indexify-server | |
RUST_LOG=debug ./indexify-server & | |
wait-on: | | |
tcp:localhost:8900 | |
tail: true | |
wait-for: 30s | |
log-output: true | |
# always logging the output to debug test failures. | |
log-output-if: true | |
- name: Start Background Indexify Executor | |
uses: JarvusInnovations/background-action@v1 | |
with: | |
run: | | |
cd python-sdk | |
poetry run indexify-cli executor & | |
wait-on: | | |
tcp:localhost:8900 | |
tail: true | |
wait-for: 10s | |
log-output: true | |
# always logging the output to debug test failures. | |
log-output-if: true | |
- name: Wait for readiness | |
run: | | |
serverReady=false | |
counter=0 | |
while [ "$serverReady" != true ]; do | |
output=$(curl --silent --fail http://localhost:8900/internal/executors | jq '. | length' 2>/dev/null) | |
if [[ $? -eq 0 && "$output" -ge 1 ]]; then | |
echo "Server ready with executors." | |
serverReady=true | |
else | |
echo 'Waiting for executors to join server...' | |
counter=$((counter+1)) | |
if [ $counter -gt 6 ]; then | |
echo "Timeout waiting for executors to join server." | |
exit 1 | |
fi | |
sleep 5 | |
fi | |
done | |
- name: Run All Tests | |
run: | | |
cd python-sdk | |
export INDEXIFY_URL=http://localhost:8900 | |
make test |