GithubHelp home page GithubHelp logo

isabella232 / k6-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from grafana/k6-action

0.0 0.0 0.0 595 KB

k6 is now available as a GitHub Action

Home Page: https://github.com/marketplace/actions/k6-load-test

License: MIT License

Dockerfile 10.62% Shell 31.76% JavaScript 57.62%

k6-action's Introduction


Open source load testing tool and SaaS for ambitious engineering teams.

Getting started

It's as easy as:

Local test

name: Main Workflow
on: [push]
jobs:
  build:
    name: Run k6 test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Run k6 local test
        uses: grafana/[email protected]
        with:
          filename: my-load-test.js
          flags: --vus 50 --duration 10s

Cloud test

name: Main Workflow
on: [push]
jobs:
  build:
    name: Run k6 test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Run k6 cloud test
        uses: grafana/[email protected]
        with:
          filename: my-load-test.js
          flags: --vus 50 --duration 10s
          cloud: true
          token: ${{ secrets.K6_CLOUD_API_TOKEN }}

Inputs

Filename

steps:
  - name: Run k6 local test
    uses: grafana/[email protected]
    with:
      filename: my-script-file.js

Sets the filename of the test script to execute. This property is relative to the workspace directory. If omitted, it defaults to test.js.

Cloud

environment: test

steps:
  - name: Run k6 cloud test
    uses: grafana/[email protected]
    with:
      cloud: true
      token: ${{ secrets.K6_CLOUD_API_TOKEN }}

Enables execution in the k6 cloud. Additional details on the k6 cloud offering are available at https://k6.io/docs/cloud/. You'll need to specify the name of the environment where K6_CLOUD_API_TOKEN secret has been defined.

Flags

steps:
  - name: Run k6 local test
    uses: grafana/[email protected]
    with:
      flags: --vus 50 --duration 10s

Any additional arguments or flags to pass to the k6 cli. The full list of possible options is available at https://k6.io/docs/using-k6/options.

For additional information, and help getting started, see https://k6.io

Environment Variables

Environment variables can be added the same way as you do it locally, using the flags action option:

steps:
  - name: Run k6 local test
    uses: grafana/[email protected]
    with:
      filename: my-script-file.js
      flags: --env MY_VAR=42

Or can be scoped to the action step:

steps:
  - name: Run k6 local test
    uses: grafana/[email protected]
    with:
      filename: my-script-file.js
    env:
      MY_VAR: 42

Side-by-side with the System under Test

Unfortunately, running the local system under test and k6 at the same time is currently not supported by the marketplace action. However, this is easily accomplished by downloading the k6 binary and running it from the same step as the server start:

name: Main Workflow
on: [push]
jobs:
  build:
    name: Run k6 test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Install k6
        run: |
          curl https://github.com/loadimpact/k6/releases/download/v0.26.2/k6-v0.26.2-linux64.tar.gz -L | tar xvz --strip-components 1
      - name: Install packages
        run: |
          npm install
      - name: Start server and run tests
        run: |
          npm start & npx wait-on http://localhost:3000
          ./k6 run test.js

Thanks to Amy Hoad for contributing on the solution for this.

k6-action's People

Contributors

simskij avatar mstoykov avatar macobo avatar brandiqa avatar tyler-mastery avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.