From a359410dbd3c0b4dd726d74fd03b3e3bd87e185c Mon Sep 17 00:00:00 2001 From: David Boreham Date: Thu, 22 Feb 2024 15:56:49 -0700 Subject: [PATCH] Add a CI job to test stack --- .gitea/workflows/test-mobymask-v3-demo.yml | 41 ++++++++++++++++++++++ tests/mobymask-v3-demo/run-test.sh | 25 +++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .gitea/workflows/test-mobymask-v3-demo.yml create mode 100755 tests/mobymask-v3-demo/run-test.sh diff --git a/.gitea/workflows/test-mobymask-v3-demo.yml b/.gitea/workflows/test-mobymask-v3-demo.yml new file mode 100644 index 00000000..8791526a --- /dev/null +++ b/.gitea/workflows/test-mobymask-v3-demo.yml @@ -0,0 +1,41 @@ +name: Deploy Test + +on: + pull_request: + branches: '*' + push: + branches: + - ci-test + - dboreham/mobymask-v3-demo-test + paths-ignore: + - '.gitea/workflows/triggers/*' + +jobs: + test: + name: "Run mobymask-v3-demo 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: "Run mobymask v3 tests" + run: ./tests/mobymask-v3-demo/run-deploy-test.sh diff --git a/tests/mobymask-v3-demo/run-test.sh b/tests/mobymask-v3-demo/run-test.sh new file mode 100755 index 00000000..4666811f --- /dev/null +++ b/tests/mobymask-v3-demo/run-test.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -e +if [ -n "$CERC_SCRIPT_DEBUG" ]; then + set -x +fi + +stack=mobymask-v3-demo + +# Test stack build +echo "Running stack-orchestrator deploy 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 +# Test bringing the test container up and down +# with and without volume removal +$TEST_TARGET_SO --stack ${stack} setup-repositories +$TEST_TARGET_SO --stack ${stack} build-containers