ci(package): Add testing routine

This commit is contained in:
Thomas Hobson 2021-03-14 19:07:54 +13:00
parent 015365f043
commit 41d807dec4
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
1 changed files with 25 additions and 3 deletions

View File

@ -91,13 +91,35 @@ jobs:
docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' -d --name piston_fs_repo docker.pkg.github.com/engineer-man/piston/repo-builder --no-build docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' -d --name piston_fs_repo docker.pkg.github.com/engineer-man/piston/repo-builder --no-build
docker run --network container:piston_fs_repo -v $(pwd)'/data:/piston' -d --name api docker.pkg.github.com/engineer-man/piston/api docker run --network container:piston_fs_repo -v $(pwd)'/data:/piston' -d --name api docker.pkg.github.com/engineer-man/piston/api
echo Waiting for API to start.. echo Waiting for API to start..
docker run --network container:api appropriate/curl --retry 10 --retry-connrefused http://localhost:6969/runtimes docker run --network container:api appropriate/curl -s --retry 10 --retry-connrefused http://localhost:6969/runtimes
echo Waiting for Index to start.. echo Waiting for Index to start..
docker run --network container:piston_fs_repo appropriate/curl --retry 10 --retry-connrefused http://localhost:8000/index docker run --network container:piston_fs_repo appropriate/curl -s --retry 10 --retry-connrefused http://localhost:8000/index
echo Listing Packages echo Listing Packages
docker run --network container:api appropriate/curl http://localhost:6969/packages PACKAGES_JSON=$(docker run --network container:api appropriate/curl -s http://localhost:6969/packages)
echo $PACKAGES_JSON
for package in $(jq -r '.[] | "\(.language)-\(.language_version)"' <<< "$PACKAGES_JSON")
do
echo "Testing $package"
PKG_PATH=$(sed 's|-|/|' <<< $package)
PKG_NAME=$(awk -F- '{ print $1 }' <<< $package)
PKG_VERSION=$(awk -F- '{ print $2 }' <<< $package)
echo "Installing..."
docker run --network container:api appropriate/curl -sXPOST http://localhost:6969/packages/$PKG_PATH
TEST_SCRIPTS=packages/$PKG_PATH/test.*
echo "Tests: $TEST_SCRIPTS"
for tscript in $TEST_SCRIPTS
do
TEST_RUNTIME=$(awk -F. '{print $2}' <<< $(basename $tscript))
echo Running $tscript with runtime=$TEST_RUNTIME
docker run --network container:api -v "$PWD/cli:/app" -v "$PWD/$(dirname $tscript):/pkg" node:15 /app/index.js run $TEST_RUNTIME $PKG_VERSION /pkg/$(basename $tscript) | grep OK
done
done
docker logs api docker logs api
docker logs piston_fs_repo docker logs piston_fs_repo