Skip to content

Scheduled Loadtest

Scheduled Loadtest #56

name: Scheduled Loadtest
on:
workflow_dispatch:
schedule:
# Do a run every sunday night
- cron: 12 5 * * 0
jobs:
loadtest:
name: "Load-Test (Production)"
runs-on: ubuntu-latest
env:
STORMFORGE_TOKEN: ${{ secrets.STORMFORGE_TOKEN }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
# Note: we need to manually extract the repository name (w/o the orga),
# since the github scheduled event does not bring the repository subobject.
- name: StormForge | Setup variables
id: config
run: |
repo=$(echo "${{ github.repository }}" | cut -d'/' -f2)
echo "repository=${repo}" >> "$GITHUB_OUTPUT"
echo "target_env=production" >> "$GITHUB_OUTPUT"
- name: StormForge | Install forge CLI
run: |
wget https://downloads.stormforge.io/stormforge-cli/latest/stormforge_linux_amd64.tar.gz -O stormforge_linux_amd64.tar.gz
tar -xzf stormforge_linux_amd64.tar.gz
./stormforge ping
- name: StormForge | Upload data-sources
run: |
./scripts/data-source.sh "${TARGET_ENV}" # export test-data
./stormforge create data-source --from-file *.csv --name-prefix-path="${{ github.event.repository.name }}/${TARGET_ENV}/" --auto-field-names
env:
DATASOURCE_PREFIX: "${{steps.config.outputs.repository}}"
TARGET_ENV: "${{steps.config.outputs.target_env}}"
- name: StormForge | Launch test-run
run: |
./stormforge create test-run --test-case "${TESTCASE}" --from-file="loadtest/loadtest.mjs" \
--define ENV=\"${TARGET_ENV}\" \
--title="${TITLE}" --notes="${NOTES}" \
--label="git-ref=${{github.ref}}" \
--label="gh-commit=${{github.event.head_commit.url}}" \
--label="gh-workflow=${{github.workflow}}" \
--label="gh-run-url=https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" \
--label="gh-actor=${{github.actor}}" \
${LAUNCH_ARGS}
env:
TARGET_ENV: "${{steps.config.outputs.target_env}}"
TESTCASE: "${{steps.config.outputs.repository}}-${{steps.config.outputs.target_env}}"
LAUNCH_ARGS: "--nfr-check-file=./loadtest/loadtest.nfr.yaml"
NOTES: |
Head Commit Message:
${{github.event.head_commit.message}}
TITLE: "${{github.workflow}}#${{github.run_number}} (${{github.ref}})"