Run API tests inside Eartlhly
This commit is contained in:
parent
5f118abe83
commit
c0dc2eb707
31
.github/workflows/automated-end-to-end-api.yaml
vendored
31
.github/workflows/automated-end-to-end-api.yaml
vendored
@ -3,19 +3,30 @@ name: Automated API tests
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'webroot/**'
|
|
||||||
- 'web/**'
|
- 'web/**'
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- 'web/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
api:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: earthly/actions-setup@v1
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
with:
|
||||||
stable: 'false'
|
version: 'latest' # or pin to an specific version, e.g. "v0.6.10"
|
||||||
go-version: '1.17.2'
|
|
||||||
- name: Run API tests
|
|
||||||
run: cd test/automated/api && ./run.sh
|
|
||||||
|
|
||||||
|
- name: Earthly version
|
||||||
|
run: earthly --version
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
id: qemu
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
with:
|
||||||
|
image: tonistiigi/binfmt:latest
|
||||||
|
platforms: all
|
||||||
|
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Run API tests
|
||||||
|
run: earthly +api-tests
|
||||||
|
@ -25,7 +25,7 @@ crosscompiler:
|
|||||||
code:
|
code:
|
||||||
FROM --platform=linux/amd64 +crosscompiler
|
FROM --platform=linux/amd64 +crosscompiler
|
||||||
COPY . /build
|
COPY . /build
|
||||||
# GIT CLONE --branch=$version git@github.com:owncast/owncast.git /build
|
#GIT CLONE --branch=$version git@github.com:owncast/owncast.git /build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
ARG EARTHLY_GIT_HASH # provided by Earthly
|
ARG EARTHLY_GIT_HASH # provided by Earthly
|
||||||
@ -127,5 +127,6 @@ api-tests:
|
|||||||
FROM --platform=linux/amd64 bdwyertech/go-crosscompile
|
FROM --platform=linux/amd64 bdwyertech/go-crosscompile
|
||||||
RUN apk add ffmpeg npm
|
RUN apk add ffmpeg npm
|
||||||
COPY . /build
|
COPY . /build
|
||||||
WORKDIR /build
|
WORKDIR /build/test/automated/api
|
||||||
RUN cd test/automated/api && ./run.sh
|
RUN npm install
|
||||||
|
RUN ./run.sh
|
||||||
|
2
test/automated/api/package-lock.json
generated
2
test/automated/api/package-lock.json
generated
@ -1302,6 +1302,7 @@
|
|||||||
"version": "4.0.2",
|
"version": "4.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.2.tgz",
|
||||||
"integrity": "sha512-AtnG3W6M8B2n4xDQ5R+70EXvOpnXsFYg/AK2yTZd+HQ/oxAdz+GI+DvjmhBw3L0ole+LJ0ngqY4JMbDzkfNzhA==",
|
"integrity": "sha512-AtnG3W6M8B2n4xDQ5R+70EXvOpnXsFYg/AK2yTZd+HQ/oxAdz+GI+DvjmhBw3L0ole+LJ0ngqY4JMbDzkfNzhA==",
|
||||||
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"node-gyp-build": "^4.2.0"
|
"node-gyp-build": "^4.2.0"
|
||||||
}
|
}
|
||||||
@ -5679,6 +5680,7 @@
|
|||||||
"version": "5.0.3",
|
"version": "5.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.3.tgz",
|
||||||
"integrity": "sha512-jtJM6fpGv8C1SoH4PtG22pGto6x+Y8uPprW0tw3//gGFhDDTiuksgradgFN6yRayDP4SyZZa6ZMGHLIa17+M8A==",
|
"integrity": "sha512-jtJM6fpGv8C1SoH4PtG22pGto6x+Y8uPprW0tw3//gGFhDDTiuksgradgFN6yRayDP4SyZZa6ZMGHLIa17+M8A==",
|
||||||
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"node-gyp-build": "^4.2.0"
|
"node-gyp-build": "^4.2.0"
|
||||||
}
|
}
|
||||||
|
@ -3,26 +3,26 @@
|
|||||||
TEMP_DB=$(mktemp)
|
TEMP_DB=$(mktemp)
|
||||||
|
|
||||||
# Install the node test framework
|
# Install the node test framework
|
||||||
npm install --silent > /dev/null
|
npm install #--silent >/dev/null
|
||||||
|
|
||||||
# Download a specific version of ffmpeg
|
# Download a specific version of ffmpeg
|
||||||
if [ ! -d "ffmpeg" ]; then
|
if [ ! -d "ffmpeg" ]; then
|
||||||
mkdir ffmpeg
|
mkdir ffmpeg
|
||||||
pushd ffmpeg > /dev/null
|
pushd ffmpeg >/dev/null
|
||||||
curl -sL https://github.com/vot/ffbinaries-prebuilt/releases/download/v4.2.1/ffmpeg-4.2.1-linux-64.zip --output ffmpeg.zip > /dev/null
|
curl -sL https://github.com/vot/ffbinaries-prebuilt/releases/download/v4.2.1/ffmpeg-4.2.1-linux-64.zip --output ffmpeg.zip >/dev/null
|
||||||
unzip -o ffmpeg.zip > /dev/null
|
unzip -o ffmpeg.zip >/dev/null
|
||||||
PATH=$PATH:$(pwd)
|
PATH=$PATH:$(pwd)
|
||||||
popd > /dev/null
|
popd >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pushd ../../.. > /dev/null
|
pushd ../../.. >/dev/null
|
||||||
|
|
||||||
# Build and run owncast from source
|
# Build and run owncast from source
|
||||||
go build -race -o owncast main.go
|
go build -o owncast main.go
|
||||||
./owncast -database $TEMP_DB &
|
./owncast -database $TEMP_DB &
|
||||||
SERVER_PID=$!
|
SERVER_PID=$!
|
||||||
|
|
||||||
popd > /dev/null
|
popd >/dev/null
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
# Start streaming the test file over RTMP to
|
# Start streaming the test file over RTMP to
|
||||||
@ -31,8 +31,8 @@ ffmpeg -hide_banner -loglevel panic -stream_loop -1 -re -i ../test.mp4 -vcodec l
|
|||||||
FFMPEG_PID=$!
|
FFMPEG_PID=$!
|
||||||
|
|
||||||
function finish {
|
function finish {
|
||||||
rm $TEMP_DB
|
rm $TEMP_DB
|
||||||
kill $SERVER_PID $FFMPEG_PID
|
kill $SERVER_PID $FFMPEG_PID
|
||||||
}
|
}
|
||||||
trap finish EXIT
|
trap finish EXIT
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user