Skip to content

Commit

Permalink
Use bash script to test doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
uglide committed Apr 20, 2023
1 parent 490f962 commit e7e2e70
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 26 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/doctests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Documentation Tests

on:
push:
pull_request:

workflow_dispatch:

permissions:
contents: read

jobs:
doctests:
runs-on: ubuntu-latest
services:
redis-stack:
image: redis/redis-stack-server:latest
options: >-
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2.3.0
with:
node-version: 18
- name: Install Packages
run: npm ci
- name: Build
run: npm run build-all
- run: |
sudo apt update
sudo apt install -y redis-tools
- name: run tests
run: |
sh doctests/run_examples.sh
2 changes: 1 addition & 1 deletion examples/docs/README.md → doctests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ See https://github.com/redis-stack/redis-stack-website#readme for more details.

Just include necessary assertions in the example file and run
```bash
node tests.js
sh doctests/run_examples.sh
```
to test all examples in the current folder.

Expand Down
15 changes: 15 additions & 0 deletions doctests/run_examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh


basepath=`readlink -f $1`
if [ $? -ne 0 ]; then
basepath=`readlink -f $(dirname $0)`
fi
echo "No path specified, using ${basepath}"

set -e
cd ${basepath}
for i in `ls ${basepath}/*.mjs`; do
redis-cli flushdb
node $i
done
File renamed without changes.
25 changes: 0 additions & 25 deletions examples/docs/tests.js

This file was deleted.

0 comments on commit e7e2e70

Please sign in to comment.