Skip to content

Instantly share code, notes, and snippets.

@phstc
Last active September 15, 2019 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phstc/ad95318ed1cedf979c8194dc018d0ce9 to your computer and use it in GitHub Desktop.
Save phstc/ad95318ed1cedf979c8194dc018d0ce9 to your computer and use it in GitHub Desktop.
K6 GitHub action

Run k6 for all branches prefixed with k6/, i.e. k6/my-test

# .github/workflows/k6.yml
name: k6
on:
push:
branches:
- 'k6/*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run k6
run: docker run -i loadimpact/k6 run --env AUTH_TOKEN=${{ secrets.AUTH_TOKEN }} - <./script.js
import http from "k6/http";
import { check } from "k6";
export const options = {
vus: 1,
duration: "10s"
};
export default function() {
const res = http.get("http://test.loadimpact.com");
check(res, { "status was 200": r => r.status == 200 })
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment