Skip to content

Commit

Permalink
adding k6 stage workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
xoscar committed Apr 18, 2024
1 parent f0d2a11 commit 72adf36
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .github/workflows/k6-stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: K6 Tests
on:
workflow_dispatch:
schedule:
- cron: '0 */1 * * *' # every hour

jobs:
docker:
timeout-minutes: 10
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v1

- name: Start containers
run: docker compose -f docker-compose.k6.workflows.yml run k6-tracetest
env:
TRACETEST_API_TOKEN: ${{secrets.TRACETEST_TOKEN_STAGE}}
POKESHOP_DEMO_URL: ${{secrets.POKESHOP_DEMO_URL_STAGE}}
TRACETEST_SERVER_URL: https://app-stage.tracetest.io

- name: Stop containers
if: always()
run: docker compose -f docker-compose.k6.workflows.yml down
- name: Send message on Slack in case of failure
if: ${{ failure() }}
uses: slackapi/[email protected]
with:
# check the block kit builder docs to understand how it works
# and how to modify it: https://api.slack.com/block-kit
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":warning: Synthetic Monitoring Alert - K6 - Pokeshop Demo :warning:",
"emoji": true
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Status:*\nFailed"
},
{
"type": "mrkdwn",
"text": "*Pipeline:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View workflow>"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SYNTETIC_MONITORING_SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
1 change: 1 addition & 0 deletions docker-compose.k6.workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
dockerfile: k6.Dockerfile
environment:
XK6_TRACETEST_API_TOKEN: ${TRACETEST_API_TOKEN}
XK6_TRACETEST_SERVER_URL: ${TRACETEST_SERVER_URL}
POKESHOP_DEMO_URL: ${POKESHOP_DEMO_URL}
volumes:
- ./test/k6/add-pokemon.js:/import-pokemon.js
2 changes: 1 addition & 1 deletion test/k6/add-pokemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Http, Tracetest } from 'k6/x/tracetest';
import { sleep } from 'k6';

export const options = {
vus: 5,
vus: 10,
duration: '5s',
};

Expand Down

0 comments on commit 72adf36

Please sign in to comment.