Performance tests (end to end) #84
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Performance tests (end to end) | |
| on: | |
| push: | |
| branches: | |
| - performance-testing | |
| workflow_dispatch: | |
| inputs: | |
| runDataPrep: | |
| description: "Run data prep" | |
| required: true | |
| type: boolean | |
| default: 'true' | |
| runNurse: | |
| description: "Run the nurse journey" | |
| required: true | |
| type: boolean | |
| default: 'true' | |
| URN: | |
| description: "Required: what URN to run the test against." | |
| required: true | |
| type: string | |
| duration: | |
| description: "Optional (default 3600) Duration of nurse journey test, in seconds. This will include ramp-up." | |
| required: false | |
| type: string | |
| default: '3600' | |
| threads: | |
| description: "Optional (default 70) Threads to run. Equivalent to the number of nurses using the system." | |
| required: false | |
| type: string | |
| default: '70' | |
| ramp_up: | |
| description: "Optional (default 900) Ramp-up time in seconds. Threads will be gradually started up over this time." | |
| required: false | |
| type: string | |
| default: '900' | |
| vaccination_loop: | |
| description: "Optional (default 20) Vaccination loop. The number of vaccinations each nurse will perform before logging and back in again." | |
| required: false | |
| type: string | |
| default: '20' | |
| row_count: | |
| description: "Optional (default 1000) number of rows in the cohort file." | |
| required: false | |
| type: string | |
| default: '1000' | |
| jobs: | |
| nurse_journey_performance_test: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| env: | |
| jmeter_version: 5.6.3 | |
| cmdrunner_version: 2.3 | |
| jmeter_plugins_manager_version: 1.7.0 | |
| jmeter_plugins: jpgc-udp,jpgc-graphs-basic,jpgc-dummy,bzm-random-csv | |
| # jmeter_home: ${{ github.workspace }}/jmeter-${{ env.jmeter_version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install JMeter | |
| run: | | |
| curl -sSO https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${{ env.jmeter_version }}.tgz | |
| tar xzf apache-jmeter-${{ env.jmeter_version }}.tgz | |
| mv apache-jmeter-${{ env.jmeter_version }} jmeter | |
| curl -sSO --output-dir jmeter/lib https://repo1.maven.org/maven2/kg/apc/cmdrunner/${{ env.cmdrunner_version }}/cmdrunner-${{ env.cmdrunner_version }}.jar | |
| curl -LsS --output jmeter/lib/ext/jmeter-plugins-manager-${{ env.jmeter_plugins_manager_version }}.jar https://jmeter-plugins.org/get/ | |
| java -cp jmeter/lib/ext/jmeter-plugins-manager-${{ env.jmeter_plugins_manager_version }}.jar org.jmeterplugins.repository.PluginManagerCMDInstaller | |
| chmod +x jmeter/bin/PluginsManagerCMD.sh | |
| sed -i '/<Logger name="org.apache.jmeter.junit" level="debug" \/>/a \ <Logger name="org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase" level="info" additivity="false"\/>' jmeter/bin/log4j2.xml | |
| - name: Install JMeter plugins | |
| if: env.jmeter_plugins != '' | |
| run: | | |
| if [ -x "$(command -v parallel)" ]; then | |
| echo "Using GNU parallel to install plugins" | |
| parallel -d, -j 5 -n 1 jmeter/bin/PluginsManagerCMD.sh install {} ::: ${{ env.jmeter_plugins }} | |
| else | |
| echo "GNU parallel not found, installing plugins sequentially" | |
| IFS=',' read -ra PLUGINS <<< "${{ env.jmeter_plugins }}" | |
| for plugin in "${PLUGINS[@]}"; do | |
| jmeter/bin/PluginsManagerCMD.sh install $plugin | |
| done | |
| fi | |
| - name: Set timestamp | |
| id: timestamp | |
| run: echo "timestamp=$(date '+%Y%m%d%H%M%S')" >> $GITHUB_ENV | |
| - name: Create new cohort file | |
| if: inputs.runDataPrep == true | |
| run: | | |
| mkdir -p generate-cohort-output | |
| generate_cohort_output_dir=generate-cohort-output | |
| jmeter/bin/jmeter -n -t performance-tests/E2E/generate-cohort.jmx \ | |
| -l $generate_cohort_output_dir/samples.jtl \ | |
| -j $generate_cohort_output_dir/jmeter.log \ | |
| -e -o $generate_cohort_output_dir/upload-report \ | |
| -JAuthToken=${{secrets.HTTP_AUTH_TOKEN_FOR_TESTS}} \ | |
| -JURN=${{inputs.URN}} \ | |
| -JRowCount=${{inputs.row_count}} | |
| - name: Run file import for new file | |
| if: inputs.runDataPrep == true | |
| run: | | |
| mkdir -p import-output | |
| import_output_dir=import-output | |
| jmeter/bin/jmeter -n -t performance-tests/E2E/upload-cohort-data.jmx \ | |
| -l $import_output_dir/samples.jtl \ | |
| -j $import_output_dir/jmeter.log \ | |
| -e -o $import_output_dir/upload-report \ | |
| -JAuthToken=${{secrets.HTTP_AUTH_TOKEN_FOR_TESTS}} \ | |
| -JInputFile="cohortnew.csv" | |
| - name: Run Consent Journey for imported records | |
| if: inputs.runDataPrep == true | |
| run: | | |
| mkdir -p consent-output | |
| consent_output_dir=consent-output | |
| jmeter/bin/jmeter -n -t performance-tests/E2E/consent-journey.jmx \ | |
| -l $consent_output_dir/samples.jtl \ | |
| -j $consent_output_dir/jmeter.log \ | |
| -e -o $consent_output_dir/consent-report \ | |
| -Jjmeter.reportgenerator.report_title="MAVIS test report" \ | |
| -Jjmeter.reportgenerator.overall_granularity=10000 \ | |
| -Jjmeter.reportgenerator.sample_filter="^.*[^0-9]$" \ | |
| -JAuthToken=${{secrets.HTTP_AUTH_TOKEN_FOR_TESTS}} \ | |
| -JInputFile="cohortnew.csv" | |
| - name: Run nurse journey JMeter test | |
| if: inputs.runNurse == true | |
| run: | | |
| mkdir -p nurse-output | |
| nurse_output_dir=nurse-output | |
| jmeter/bin/jmeter -n -t performance-tests/E2E/nurse-journey.jmx \ | |
| -l $nurse_output_dir/samples.jtl \ | |
| -j $nurse_output_dir/jmeter.log \ | |
| -e -o $nurse_output_dir/report \ | |
| -Jjmeter.reportgenerator.report_title="MAVIS test report" \ | |
| -Jjmeter.reportgenerator.overall_granularity=10000 \ | |
| -Jjmeter.reportgenerator.sample_filter="^.*[^0-9]$" \ | |
| -JAuthToken=${{secrets.HTTP_AUTH_TOKEN_FOR_TESTS}} \ | |
| -JDuration=${{inputs.duration}} \ | |
| -JThreads=${{inputs.threads}} \ | |
| -JRampUp=${{inputs.ramp_up}} \ | |
| -JVaccinationLoop=${{inputs.vaccination_loop}} \ | |
| -JInputFile="cohortnew.csv" \ | |
| -JLoops=-1 | |
| - name: Upload consent journey JMeter output | |
| if: inputs.runDataPrep == true | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jmeter-consent-journey-output-${{ env.timestamp }} | |
| path: consent-output | |
| if-no-files-found: warn | |
| - name: Upload nurse journey JMeter output | |
| if: inputs.runNurse == true | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jmeter-nurse-journey-output-${{ env.timestamp }} | |
| path: nurse-output | |
| if-no-files-found: warn | |
| - name: Publish report to GH Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_branch: gh-pages | |
| publish_dir: nurse-output/report | |
| destination_dir: JMeter/report-${{ env.timestamp }} | |
| keep_files: true | |
| - name: Set Job Summary | |
| run: | | |
| echo "Test report URL is https://nhsdigital.github.io/manage-vaccinations-in-schools-testing/JMeter/report-${{ env.timestamp }}/" >> $GITHUB_STEP_SUMMARY | |