-
Notifications
You must be signed in to change notification settings - Fork 27
67 lines (55 loc) · 2.16 KB
/
artillery-action-users-api.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Artillery action to test function users
# When there is a push to the development branch, this
# GitHub action workflow will run
on:
push:
branches:
- development
#Test
# Sets up the environment variables
env:
NODE_VERSION: '14' # version of Node we are using
NPM_CONFIG_PREFIX: '~/.npm-global' # required to set path for Artillery call
jobs:
# Sets up ubuntu VM for actions
setup:
runs-on: ubuntu-latest
steps:
# Checks out current repo
- name: 'Checkout Repository GitHub Action'
uses: actions/checkout@v2
# Sets up Node
- name: Setup Node ${{ env.NODE_VERSION }} Environment
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
check-latest: true
# Sets up NPM
- name: 'Run npm init'
run: npm init -y
# Uses AWS-Actions to set up AWS credentials
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
# Installs Artillery globally
- name: Run npm install artillery
run: npm install -g artillery
# Grabs the current date and time for naming convention
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H-%M-%S')"
# Call artillery test located at ./test/artillery/artillery-perf-test-users-user_id-tasks.yaml
# Return temp results to test/results/artillery-test-users-user_id-tasks-results.json
- name: Run Artillery Test
run: /home/runner/.npm-global/lib/node_modules/artillery/bin/artillery run --output test/results/artillery.json ./test/artillery/artillery-test-users-api.yml
# Change results file name to follow naming conventions and include date/time
- name: Rename results json
run: |
cp test/results/artillery.json "test/results/artillery_${{ steps.date.outputs.date }}.json"
# Upload the results to S3 bucket
- name: AWS CLI S3
run: |
aws s3 cp test/results/ s3://artillery --recursive --exclude "*" --include "artillery*"