Skip to content

Merge pull request #21 from cristian-recoseanu/add-badges #5

Merge pull request #21 from cristian-recoseanu/add-badges

Merge pull request #21 from cristian-recoseanu/add-badges #5

Workflow file for this run

name: API Testing
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Clone nmos-testing Repository
run: git clone https://github.com/AMWA-TV/nmos-testing.git nmos-testing
- name: Install nmos-testing Requirements
run: |
python -m pip install --upgrade pip
pip install -r nmos-testing/requirements.txt
- name: Verify Python and Packages
run: |
python --version
pip --version
pip list
- name: Install dependencies and build
run: cargo build
- name: Start App
run: |
cargo run &
echo $! > node_pid.txt
- name: Wait for app to be ready
run: |
for i in {1..20}; do
if nc -z localhost 3000; then
echo "Server is up!"
exit 0
fi
echo "Waiting for server..."
sleep 2
done
echo "Server did not start in time."
exit 1
- name: Copy and show UserConfig.py
run: |
mkdir -p nmos-testing/nmostesting
cp nmos-testing-config/UserConfig.py nmos-testing/nmostesting/UserConfig.py
echo "Contents of copied UserConfig.py:"
cat nmos-testing/nmostesting/UserConfig.py
- name: Run IS-12 Test Suite
working-directory: nmos-testing
run: |
mkdir -p ../test_results
python nmos-test.py suite IS-12-01 \
--host 127.0.0.1 127.0.0.1 null null \
--port 3000 3000 0 0 \
--version v1.3 v1.0 v1.0 v1.0 \
--urlpath null /ws null null \
--output ../test_results/is_12_01_results.json || true
- name: Check IS-12 Test Results
run: |
RESULTS_FILE="test_results/is_12_01_results.json"
if [ ! -f "$RESULTS_FILE" ]; then
echo "ERROR: Results file $RESULTS_FILE not found"
exit 1
fi
FAILED=$(jq -r '.results[] | select(.state=="Fail") | "\(.name): \(.state), detail: \(.detail // "")"' "$RESULTS_FILE")
if [ -n "$FAILED" ]; then
echo "❌ NMOS Test Failures:"
echo "$FAILED"
exit 1
else
echo "✅ All NMOS tests passed!"
fi
- name: Stop App
if: always()
run: |
if [ -f node_pid.txt ]; then
kill $(cat node_pid.txt) || true
fi
pkill -f 'cargo run' || true