CI test
This commit is contained in:
parent
5c86efcd8f
commit
48019f1310
49
.gitea/workflows/test-webapp.yml
Normal file
49
.gitea/workflows/test-webapp.yml
Normal file
@ -0,0 +1,49 @@
|
||||
name: Deploy Test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: '*'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- ci-test
|
||||
paths-ignore:
|
||||
- '.gitea/workflows/triggers/*'
|
||||
|
||||
# Needed until we can incorporate docker startup into the executor container
|
||||
env:
|
||||
DOCKER_HOST: unix:///var/run/dind.sock
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: "Run webapp test suite"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Clone project repository"
|
||||
uses: actions/checkout@v3
|
||||
# At present the stock setup-python action fails on Linux/aarch64
|
||||
# Conditional steps below workaroud this by using deadsnakes for that case only
|
||||
- name: "Install Python for ARM on Linux"
|
||||
if: ${{ runner.arch == 'arm64' && runner.os == 'Linux' }}
|
||||
uses: deadsnakes/action@v3.0.1
|
||||
with:
|
||||
python-version: '3.8'
|
||||
- name: "Install Python cases other than ARM on Linux"
|
||||
if: ${{ ! (runner.arch == 'arm64' && runner.os == 'Linux') }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.8'
|
||||
- name: "Print Python version"
|
||||
run: python3 --version
|
||||
- name: "Install shiv"
|
||||
run: pip install shiv
|
||||
- name: "Generate build version file"
|
||||
run: ./scripts/create_build_tag_file.sh
|
||||
- name: "Build local shiv package"
|
||||
run: ./scripts/build_shiv_package.sh
|
||||
- name: Start dockerd # Also needed until we can incorporate into the executor
|
||||
run: |
|
||||
dockerd -H $DOCKER_HOST --userland-proxy=false &
|
||||
sleep 5
|
||||
- name: "Run webapp tests"
|
||||
run: ./tests/webapp-test/run-webapp-test.sh
|
52
tests/webapp-test/run-webapp-test.sh
Executable file
52
tests/webapp-test/run-webapp-test.sh
Executable file
@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
# Dump environment variables for debugging
|
||||
echo "Environment variables:"
|
||||
env
|
||||
# Test basic stack-orchestrator webapp
|
||||
echo "Running stack-orchestrator webapp test"
|
||||
# Bit of a hack, test the most recent package
|
||||
TEST_TARGET_SO=$( ls -t1 ./package/laconic-so* | head -1 )
|
||||
# Set a non-default repo dir
|
||||
export CERC_REPO_BASE_DIR=~/stack-orchestrator-test/repo-base-dir
|
||||
echo "Testing this package: $TEST_TARGET_SO"
|
||||
echo "Test version command"
|
||||
reported_version_string=$( $TEST_TARGET_SO version )
|
||||
echo "Version reported is: ${reported_version_string}"
|
||||
echo "Cloning repositories into: $CERC_REPO_BASE_DIR"
|
||||
rm -rf $CERC_REPO_BASE_DIR
|
||||
mkdir -p $CERC_REPO_BASE_DIR
|
||||
git clone https://git.vdb.to/cerc-io/test-progressive-web-app.git $CERC_REPO_BASE_DIR/test-progressive-web-app
|
||||
|
||||
# Test webapp command execution
|
||||
$TEST_TARGET_SO build-webapp --source-repo $CERC_REPO_BASE_DIR/test-progressive-web-app
|
||||
|
||||
UUID=`uuidgen`
|
||||
|
||||
CONTAINER_ID=$(docker run -p 3000:3000 -d cerc/test-progressive-web-app:local)
|
||||
sleep 3
|
||||
wget -O test.before -m http://localhost:3000
|
||||
|
||||
docker remove -f $CONTAINER_ID
|
||||
|
||||
CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$UUID -d cerc/test-progressive-web-app:local)
|
||||
sleep 3
|
||||
wget -O test.after -m http://localhost:3000
|
||||
|
||||
set +e
|
||||
grep "$UUID" test.before > /dev/null
|
||||
if [ $? -ne 1 ]; then
|
||||
echo "Found $UUID in before ouput."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
grep "$UUID" test.after > /dev/null
|
||||
if [ $? -ne 1 ]; then
|
||||
echo "Found $UUID in before ouput."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
34
tests/webapp-test/test.before
Normal file
34
tests/webapp-test/test.before
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user