@@ -35,12 +35,42 @@ jobs:
3535 reporter : golang-json
3636 fail-on-error : true
3737
38- integration-test :
39- name : Integration Test (${{ matrix.resolution }})
38+ build-image :
39+ name : Build Docker Image
4040 runs-on : ubuntu-latest
4141 needs : test
4242 if : needs.test.result == 'success'
4343
44+ steps :
45+ - name : Checkout code
46+ uses : actions/checkout@v4
47+
48+ - name : Set up Docker Buildx
49+ uses : docker/setup-buildx-action@v3
50+
51+ - name : Build and cache Docker image
52+ uses : docker/build-push-action@v5
53+ with :
54+ context : .
55+ push : false
56+ tags : stream-webpage:test-${{ github.run_id }}
57+ outputs : type=docker,dest=/tmp/stream-webpage-${{ github.run_id }}.tar
58+ cache-from : type=gha
59+ cache-to : type=gha,mode=max
60+
61+ - name : Upload Docker image artifact
62+ uses : actions/upload-artifact@v4
63+ with :
64+ name : docker-image-${{ github.run_id }}
65+ path : /tmp/stream-webpage-${{ github.run_id }}.tar
66+ retention-days : 1
67+
68+ integration-test :
69+ name : Integration Test (${{ matrix.resolution }})
70+ runs-on : ubuntu-latest
71+ needs : [test, build-image]
72+ if : needs.test.result == 'success' && needs.build-image.result == 'success'
73+
4474 strategy :
4575 matrix :
4676 resolution : [720p, 1080p, 2k]
@@ -65,16 +95,14 @@ jobs:
6595 - name : Checkout code
6696 uses : actions/checkout@v4
6797
68- - name : Set up Docker Buildx
69- uses : docker/setup-buildx-action@v3
70-
71- - name : Build Docker image
72- uses : docker/build-push-action@v5
98+ - name : Download Docker image artifact
99+ uses : actions/download-artifact@v4
73100 with :
74- context : .
75- push : false
76- tags : stream-webpage:test
77- load : true
101+ name : docker-image-${{ github.run_id }}
102+ path : /tmp
103+
104+ - name : Load Docker image
105+ run : docker load -i /tmp/stream-webpage-${{ github.run_id }}.tar
78106
79107 - name : Start stream-webpage container
80108 run : |
88116 -e RESOLUTION=${{ matrix.resolution }} \
89117 -e RTMP_URL=rtmp://localhost:1935/live/stream \
90118 -e WEBPAGE_URL="https://www.youtube.com/embed/xuCn8ux2gbs?autoplay=1&loop=1&playlist=xuCn8ux2gbs" \
91- stream-webpage:test
119+ stream-webpage:test-${{ github.run_id }}
92120
93121 - name : Setup FFmpeg
94122 uses : FedericoCarboni/setup-ffmpeg@v3
@@ -115,7 +143,7 @@ jobs:
115143 echo "Checking stream properties with ffprobe..."
116144 timeout 30 ffprobe -v quiet -print_format json -show_streams rtmp://localhost:1935/live/stream > stream_info.json 2>/dev/null || {
117145 echo "Stream not available yet, checking container logs..."
118- docker logs $(docker ps -q --filter ancestor= stream-webpage:test)
146+ docker logs stream-webpage
119147 docker logs $(docker ps -q --filter ancestor=tiangolo/nginx-rtmp)
120148 exit 1
121149 }
0 commit comments