Skip to content

Instantly share code, notes, and snippets.

@davidmukiibi
Created November 15, 2019 11:51
Show Gist options
  • Save davidmukiibi/65b95d6861ad049e6e95cdd511004b9d to your computer and use it in GitHub Desktop.
Save davidmukiibi/65b95d6861ad049e6e95cdd511004b9d to your computer and use it in GitHub Desktop.
circleci configuration file for k6 performance tests
default: &defaults
parallelism: 1
docker:
- image: loadimpact/k6:latest
run_any_tests_here: &run_any_tests_here
run:
name: Run Tests
command: |
cd tests_folder
npm run test
deploy_to_staging: &deploy_to_staging
run:
name: Deploy to the staging environment on Google Kubernetes Engine
command: |
docker build -t gcr.io/loadimpact/k6-tutorial:$CIRCLE_SHA1 .
docker push gcr.io/loadimpact/k6-tutorial:$CIRCLE_SHA1
kubectl set image loadimpact/k6-tutorial:latest staging-api=gcr.io/loadimpact/k6-tutorial:$CIRCLE_SHA1
k6_performance_tests: &k6_performance_tests
run:
name: Running Load Tests Using K6
command: |
k6 run tests/cloud-test.js
deploy_to_production: &deploy_to_production
run:
name: Deploy to the production environment on Google Kubernetes Engine
command: |
docker build -t gcr.io/loadimpact/k6-tutorial:$CIRCLE_SHA1 .
docker push gcr.io/loadimpact/k6-tutorial:$CIRCLE_SHA1
kubectl set image loadimpact/k6-tutorial:latest production-api=gcr.io/loadimpact/k6-tutorial:$CIRCLE_SHA1
version: 2
jobs:
run_any_tests:
<<: *defaults
steps:
- checkout
- *run_any_tests_here
deploy_to_staging_environment:
<<: *defaults
steps:
- checkout
- *deploy_to_staging
run_perfomance_tests:
<<: *defaults
steps:
- checkout
- *k6_performance_tests
deploy_to_production_environment:
<<: *defaults
steps:
- checkout
- *deploy_to_production
workflows:
version: 2
build-and-test:
jobs:
- run_any_tests
- deploy_to_staging_environment:
requires:
- run_any_tests
- run_perfomance_tests
requires:
- deploy_to_staging_environment
- deploy_to_production_environment:
requires:
- run_perfomance_tests
@ppcano
Copy link

ppcano commented Nov 18, 2019

@davidmukiibi

what does it mean the step checkout? It looks it is wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment