Updated golang to 1.25.0 #1
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: PR Validation | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24' | |
| - name: Run tests | |
| run: | | |
| echo "Running Go tests..." | |
| go test -v -json ./... > test-results.json | |
| - name: Report test results | |
| uses: dorny/test-reporter@v1 | |
| if: always() | |
| with: | |
| name: Go Tests | |
| path: test-results.json | |
| reporter: golang-json | |
| fail-on-error: true | |
| integration-test: | |
| name: Integration Test (${{ matrix.resolution }}) | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: needs.test.result == 'success' | |
| strategy: | |
| matrix: | |
| resolution: [720p, 1080p, 2k] | |
| include: | |
| - resolution: 720p | |
| expected_height: 720 | |
| expected_width: 1280 | |
| - resolution: 1080p | |
| expected_height: 1080 | |
| expected_width: 1920 | |
| - resolution: 2k | |
| expected_height: 1440 | |
| expected_width: 2560 | |
| services: | |
| rtmp-server: | |
| image: tiangolo/nginx-rtmp | |
| ports: | |
| - 1935:1935 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: false | |
| tags: stream-webpage:test | |
| load: true | |
| - name: Start stream-webpage container | |
| run: | | |
| docker run -d \ | |
| --name stream-webpage \ | |
| --network host \ | |
| -e FRAMERATE=60 \ | |
| -e LOG_FORMAT=json \ | |
| -e LOG_LEVEL=debug \ | |
| -e PORT=8080 \ | |
| -e RESOLUTION=${{ matrix.resolution }} \ | |
| -e RTMP_URL=rtmp://localhost:1935/live/stream \ | |
| -e WEBPAGE_URL="https://www.youtube.com/embed/xuCn8ux2gbs?autoplay=1&loop=1&playlist=xuCn8ux2gbs" \ | |
| stream-webpage:test | |
| - name: Setup FFmpeg | |
| uses: FedericoCarboni/setup-ffmpeg@v3 | |
| - name: Wait for services to start | |
| run: | | |
| echo "Waiting for services to start..." | |
| sleep 30 | |
| - name: Test RTMP stream | |
| run: | | |
| echo "Testing RTMP stream..." | |
| # Test if RTMP server is accessible and stream is available | |
| timeout 30 bash -c ' | |
| while ! nc -z localhost 1935; do | |
| echo "Waiting for RTMP server..." | |
| sleep 2 | |
| done | |
| echo "RTMP server is ready" | |
| ' | |
| # Use ffprobe to check stream properties | |
| echo "Checking stream properties with ffprobe..." | |
| timeout 30 ffprobe -v quiet -print_format json -show_streams rtmp://localhost:1935/live/stream > stream_info.json 2>/dev/null || { | |
| echo "Stream not available yet, checking container logs..." | |
| docker logs $(docker ps -q --filter ancestor=stream-webpage:test) | |
| docker logs $(docker ps -q --filter ancestor=tiangolo/nginx-rtmp) | |
| exit 1 | |
| } | |
| # Check if stream matches expected resolution | |
| height=$(cat stream_info.json | jq -r '.streams[0].height // empty') | |
| width=$(cat stream_info.json | jq -r '.streams[0].width // empty') | |
| echo "Stream resolution: ${width}x${height}" | |
| echo "Expected resolution: ${{ matrix.expected_width }}x${{ matrix.expected_height }}" | |
| if [ "$height" = "${{ matrix.expected_height }}" ] && [ "$width" = "${{ matrix.expected_width }}" ]; then | |
| echo "✅ Stream is ${{ matrix.resolution }} as expected" | |
| else | |
| echo "❌ Stream is not ${{ matrix.resolution }}. Expected ${{ matrix.expected_width }}x${{ matrix.expected_height }}, got ${width}x${height}" | |
| cat stream_info.json | jq '.' | |
| exit 1 | |
| fi | |
| echo "✅ Integration test completed successfully" | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| echo "Stopping stream-webpage container..." | |
| docker stop stream-webpage || true | |
| docker rm stream-webpage || true |