K6 browser and github actions


I’ve been trying to get our K6 browser tests running inside our CI pipeline using github actions.

I initially tried the documented way on the K6 site using: uses: grafana/k6-action@v0.2.0 .Obviously this did not work as that’s not installing the K6 browser so I have now got the following set-up:

    name: Transpile, bundle and run
    runs-on: ubuntu-latest

      - name: Checkout
        uses: actions/checkout@v3
      - name: Install dependencies
        working-directory: ./qa/performance
        run: |
          npm ci
          go install go.k6.io/xk6/cmd/xk6@latest
          xk6 build --output xk6-browser --with github.com/grafana/xk6-browser

      - name: Run load test
        working-directory: ./qa/performance
        run: | 
          ./xk6-browser run tests/performance-test.js

but this returns:

go: downloading go.k6.io/xk6 v0.8.1
go: downloading github.com/Masterminds/semver/v3 v3.1.1
/home/runner/work/_temp/8c43b3f6-25e4-464b-ba9f-a2c6341234fb.sh: line 3: xk6: command not found
Error: Process completed with exit code 127.

Can anybody advise the best way to work with github actions and K6 browser?


Hi @Meg42! Welcome to the forum! :slightly_smiling_face:

You can take a look at the xk6-browser workflows which actually also build xk6-browser binary and run some test scripts. For example, take a look at our e2e workflow.

There will be some differences on the steps, for example when using xk6 to build the binary you will have to use the same syntax used in your workflow:

xk6 build --output xk6-browser --with github.com/grafana/xk6-browser

But overall it should be a good guide on the process.

I hope that helps you to set up for pipeline.


Thanks @Daniel.J this is exactly the help I needed. Up and running in our CI pipeline now :slight_smile: