Add badges #7
Workflow file for this run
This file contains hidden or 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: 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 | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Start App | |
| run: | | |
| python3 main.py & | |
| echo $! > app_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 app_pid.txt ]; then | |
| kill $(cat app_pid.txt) || true | |
| fi |