[RSDK-9965] discover resources using extra (#95) #971
This file contains 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: Integration test using mediamtx | |
on: | |
push: | |
paths-ignore: | |
- 'README.md' | |
pull_request: | |
paths-ignore: | |
- 'README.md' | |
jobs: | |
build-and-test: | |
strategy: | |
matrix: | |
platform: | |
- runner: ubuntu-latest | |
arch: amd64 | |
mediamtx_url: https://github.com/bluenviron/mediamtx/releases/download/v1.9.0/mediamtx_v1.9.0_linux_amd64.tar.gz | |
viam_server_url: https://storage.googleapis.com/packages.viam.com/apps/viam-server/viam-server-stable-x86_64.AppImage | |
docker_image: ghcr.io/viamrobotics/antique2:amd64-cache | |
- runner: buildjet-8vcpu-ubuntu-2204-arm | |
arch: arm64 | |
mediamtx_url: https://github.com/bluenviron/mediamtx/releases/download/v1.9.0/mediamtx_v1.9.0_linux_arm64v8.tar.gz | |
viam_server_url: https://storage.googleapis.com/packages.viam.com/apps/viam-server/viam-server-stable-aarch64.AppImage | |
docker_image: ghcr.io/viamrobotics/antique2:arm64-cache | |
config: | |
- name: "h264" | |
codec: "libx264" | |
pix_fmt: "yuv420p" | |
transport: "tcp" | |
- name: "h265" | |
codec: "libx265" | |
pix_fmt: "yuv420p" | |
transport: "tcp" | |
- name: "mjpeg" | |
codec: "mjpeg" | |
extra_ffmpeg_args: "-huffman 0" | |
pix_fmt: "yuvj420p" | |
transport: "tcp" | |
- name: "mpeg4" | |
codec: "mpeg4" | |
pix_fmt: "yuv420p" | |
transport: "tcp" | |
- name: "h264" | |
codec: "libx264" | |
pix_fmt: "yuv420p" | |
transport: "udp" | |
- name: "h265" | |
codec: "libx265" | |
pix_fmt: "yuv420p" | |
transport: "udp" | |
- name: "mjpeg" | |
codec: "mjpeg" | |
extra_ffmpeg_args: "-huffman 0" | |
pix_fmt: "yuvj420p" | |
transport: "udp" | |
- name: "mpeg4" | |
codec: "mpeg4" | |
pix_fmt: "yuv420p" | |
transport: "udp" | |
runs-on: ${{ matrix.platform.runner }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build module | |
uses: ./.github/actions/build-module | |
with: | |
target_os: linux | |
target_arch: ${{ matrix.platform.arch }} | |
docker_image: ${{ matrix.platform.docker_image }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo add-apt-repository universe && | |
sudo apt-get install -y libfuse2 ffmpeg | |
- name: Download and extract mediamtx | |
run: | | |
wget ${{ matrix.platform.mediamtx_url }} | |
tar -xzf $(basename ${{ matrix.platform.mediamtx_url }}) | |
- name: Run mediamtx | |
run: ./mediamtx & | |
- name: Run fake RTSP camera | |
run: ffmpeg -re -f lavfi -i testsrc=size=640x480:rate=30 -vcodec ${{ matrix.config.codec }} ${{ matrix.config.extra_ffmpeg_args }} -pix_fmt ${{ matrix.config.pix_fmt }} -f rtsp -rtsp_transport ${{ matrix.config.transport }} rtsp://0.0.0.0:8554/live.stream & | |
- name: Install viam-server | |
run: | | |
wget ${{ matrix.platform.viam_server_url }} -O viam-server | |
chmod 755 viam-server | |
sudo ./viam-server --aix-install | |
# Find the viamrtsp binary dynamically and generate the config | |
- name: Generate viam-server config | |
run: | | |
VIAMRTSP_PATH=$(find $(pwd) -name viamrtsp -type f) && \ | |
echo '{ | |
"components": [ | |
{ | |
"name": "ip-cam", | |
"namespace": "rdk", | |
"type": "camera", | |
"model": "viam:viamrtsp:rtsp", | |
"attributes": { | |
"rtsp_address": "rtsp://localhost:8554/live.stream" | |
}, | |
"depends_on": [] | |
} | |
], | |
"modules": [ | |
{ | |
"type": "local", | |
"name": "viamrtsp", | |
"executable_path": "'$VIAMRTSP_PATH'" | |
} | |
] | |
}' > "integration-test-config-${{ matrix.config.name }}.json" | |
# Sleep to give time for server to start | |
- name: Run viam-server | |
run: | | |
viam-server -debug -config "./integration-test-config-${{ matrix.config.name }}.json" & | |
sleep 10 | |
- name: Build and run test binary | |
run: | | |
go build -o testBinary ./test/client.go | |
chmod +x ./testBinary | |
./testBinary |