version: "3" env: MEILI_HOST: http://localhost:7700 MEILI_MASTER_KEY: masterKey MEILI_INDEX: movies HTTP_ADDR: ":8080" vars: MEILI_DATA: .meili-data tasks: default: desc: List available tasks cmds: [task --list] tidy: desc: Sync go.mod/go.sum cmds: [go mod tidy] fmt: desc: Format the code cmds: [go fmt ./...] vet: desc: Run go vet cmds: [go vet ./...] test: desc: Run unit tests (no Meilisearch required) cmds: [go test ./...] test:integration: desc: Run integration tests against a live Meilisearch (needs meili:up) cmds: [go test -tags=integration -count=1 ./test/...] build: desc: Build both binaries into bin/ cmds: - go build -o bin/api ./cmd/api - go build -o bin/seed ./cmd/seed meili:up: desc: Start Meilisearch in Docker on :7700 cmds: - docker run -d --name meili-showcase -p 7700:7700 -e MEILI_MASTER_KEY=$MEILI_MASTER_KEY -e MEILI_ENV=development -v "$PWD/{{.MEILI_DATA}}:/meili_data" getmeili/meilisearch:v1.24 status: - docker ps --filter name=meili-showcase --filter status=running --format '{{"{{"}}.Names{{"}}"}}' | grep -q meili-showcase meili:down: desc: Stop and remove the Meilisearch container cmds: - docker rm -f meili-showcase meili:wait: desc: Block until Meilisearch answers /health cmds: - | for i in $(seq 1 60); do curl -fsS "$MEILI_HOST/health" >/dev/null 2>&1 && exit 0 sleep 0.5 done echo "meilisearch did not become healthy" >&2; exit 1 seed: desc: Create the index, apply settings and load data/movies.json deps: [meili:wait] cmds: [go run ./cmd/seed] run: desc: Run the HTTP API on $HTTP_ADDR deps: [meili:wait] cmds: [go run ./cmd/api] demo: desc: One-shot showcase - start Meilisearch, seed, run example queries cmds: - task: meili:up - task: meili:wait - task: seed - task: query query: desc: Run a few example searches against the running API or Meilisearch directly cmds: - ./scripts/demo-queries.sh clean: desc: Remove build artifacts and local index data cmds: - rm -rf bin {{.MEILI_DATA}} ci: desc: fmt + vet + test cmds: - task: fmt - task: vet - task: test