Test: k6 cronjob #249
This file contains 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
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions | |
name: 'Test: k6 cronjob' | |
on: | |
schedule: | |
# See: https://crontab.guru/#42_1_*_*_* | |
- cron: '42 1 * * *' | |
workflow_dispatch: | |
env: | |
k6TestsPath: 'k6/' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 240 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js version | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '${{ env.k6TestsPath }}/.node-version' | |
cache: 'npm' | |
cache-dependency-path: '${{ env.k6TestsPath }}/package-lock.json' | |
- name: Set ENV-variables for test-environment | |
run: | | |
cp ./services/.env.example services/.env | |
- name: Install k6 dependencies | |
working-directory: ${{ env.k6TestsPath }} | |
run: | | |
npm ci --omit=optional --no-fund --no-audit | |
- name: Download k6 | |
working-directory: ${{ env.k6TestsPath }} | |
run: | | |
curl https://github.com/grafana/k6/releases/download/v0.51.0/k6-v0.51.0-linux-amd64.tar.gz -L | tar xvz --strip-components 1 | |
- name: Run all k6 tests | |
working-directory: ${{ env.k6TestsPath }} | |
run: | | |
./run-all-tests.sh | |
- name: Docker logs | |
if: always() | |
uses: jwalton/gh-docker-logs@v2 | |
- name: Microsoft Teams Notification | |
if: always() | |
uses: tlolkema/simple-teams-message@main | |
env: | |
JOB_STATUS_WITH_NICE_EMOJI: ${{ job.status == 'success' && '✅ Success' || '❌ Failed' }} | |
with: | |
message_title: 'K6 Cronjob' | |
message_description: 'Job status: ${{ env.JOB_STATUS_WITH_NICE_EMOJI }}' | |
webhook: ${{ secrets.MSTEAMS_WEBHOOK }} |