name: JMeter Tests on: workflow_call: inputs: python-version: description: "Python Version" required: true default: "3.9" type: string poetry-version: description: "Poetry Version" required: true default: "1.5.1" type: string jobs: action_build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Python ${{ inputs.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ inputs.python-version }} cache: "pip" - name: Set up Poetry ${{ inputs.poetry-version }} uses: abatilo/actions-poetry@v2 with: poetry-version: ${{ inputs.poetry-version }} - name: create logs and reports dir run: | mkdir logs mkdir reports - name: install packages run: poetry install - name: run LNbits env: LNBITS_ADMIN_UI: true LNBITS_EXTENSIONS_DEFAULT_INSTALL: "watchonly, satspay, tipjar, tpos, lnurlp, withdraw" LNBITS_BACKEND_WALLET_CLASS: FakeWallet run: | poetry run lnbits > logs/lnbits.log & sleep 5 - name: install jmeter run: | java -version wget https://downloads.apache.org//jmeter/binaries/apache-jmeter-5.6.2.zip unzip apache-jmeter-5.6.2.zip $GITHUB_WORKSPACE/apache-jmeter-5.6.2/bin/jmeter -v - name: start mirror server run: | libs_dir=$GITHUB_WORKSPACE/apache-jmeter-5.6.2/lib/ echo "Fix bad Jmeter lib names. Lib dir: $libs_dir" mv $libs_dir/slf4j-api-1.7.36.jar $libs_dir/slf4j-api-1.7.25.jar mv $libs_dir/log4j-slf4j-impl-2.20.0.jar $libs_dir/log4j-slf4j-impl-2.11.0.jar mv $libs_dir/log4j-api-2.20.0.jar $libs_dir/log4j-api-2.11.1.jar mv $libs_dir/log4j-core-2.20.0.jar $libs_dir/log4j-core-2.11.1.jar mv $libs_dir/log4j-1.2-api-2.20.0.jar $libs_dir/og4j-1.2-api-2.11.1.jar echo "Starting the mirror server on dfault port 8081." $GITHUB_WORKSPACE/apache-jmeter-5.6.2/bin/mirror-server & - name: run jmx scripts run: | for file in $( ls $GITHUB_WORKSPACE/integration/*.jmx); do echo "Running test with $file" filename=$(basename "$file" ".jmx") $GITHUB_WORKSPACE/apache-jmeter-5.6.2/bin/jmeter -n -t $file -l logs/$filename.log -e -o reports ; error_count=$(cat jmeter.log | grep "summary =" | awk '{print $19}') echo "Error count: $error_count" if [[ "$error_count" == "0" ]]; then echo "Test $filename OK." rm -r reports/* else echo "Test $filename failed. Error count: $error_count." exit 1 fi done - uses: actions/upload-artifact@v3 if: ${{ always() }} with: name: jmeter-test-results path: | reports/ logs/