adds hackrf #96
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
| # Run test CI for pull requests targeting any branch. | |
| # Gate execution to a configurable root repository: | |
| # - vars.CI_ROOT_OWNER (default: Josephrp) | |
| # - vars.CI_ROOT_REPO (default: current repository name) | |
| name: Test CI | |
| on: | |
| pull_request: | |
| branches: | |
| - "**" | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Test | |
| if: ${{ github.repository == format('{0}/{1}', vars.CI_ROOT_OWNER != '' && vars.CI_ROOT_OWNER || 'Josephrp', vars.CI_ROOT_REPO != '' && vars.CI_ROOT_REPO || github.event.repository.name) }} | |
| runs-on: ubuntu-latest | |
| env: | |
| RADIOSHAQ_LICENSE_ACCEPTED: "1" | |
| DATABASE_URL: postgresql://radioshaq:radioshaq@127.0.0.1:5434/radioshaq | |
| TEST_DATABASE_URL: postgresql+asyncpg://radioshaq:radioshaq@127.0.0.1:5434/radioshaq | |
| services: | |
| postgres: | |
| image: postgis/postgis:16-3.4 | |
| env: | |
| POSTGRES_USER: radioshaq | |
| POSTGRES_PASSWORD: radioshaq | |
| POSTGRES_DB: radioshaq | |
| ports: | |
| - 5434:5432 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: radioshaq/web-interface/package-lock.json | |
| - name: Build web UI and stage for API-served bundle | |
| run: | | |
| cd radioshaq/web-interface && npm ci --no-audit --no-fund && npm run build | |
| cd "${{ github.workspace }}" | |
| mkdir -p radioshaq/radioshaq/web_ui | |
| cp -r radioshaq/web-interface/dist/. radioshaq/radioshaq/web_ui/ | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - uses: astral-sh/setup-uv@v7 | |
| - name: Install dependencies | |
| run: cd radioshaq && uv sync --extra dev --extra test --extra sdr | |
| - name: Wait for Postgres | |
| run: | | |
| for i in $(seq 1 30); do | |
| if python -c "import socket; s=socket.socket(); s.settimeout(2); s.connect(('127.0.0.1',5434)); s.close()" 2>/dev/null; then | |
| echo "Postgres is ready on 127.0.0.1:5434" | |
| break | |
| fi | |
| echo "Waiting for Postgres... ($i/30)" | |
| sleep 2 | |
| done | |
| python -c "import socket; s=socket.socket(); s.settimeout(5); s.connect(('127.0.0.1',5434)); s.close(); print('Postgres port open')" | |
| - name: Run database migrations | |
| run: cd radioshaq && uv run alembic-upgrade | |
| - name: Run tests | |
| run: cd radioshaq && uv run pytest tests/unit tests/integration -v | |