k6-action icon indicating copy to clipboard operation
k6-action copied to clipboard

Support glob patterns to select multiple tests for sequential execution

Open ppcano opened this issue 1 year ago • 1 comments

For instance: **/k6-tests/**/*.js

See examples:

https://github.com/grafana/k6-github-action https://github.com/grafana/quickpizza/blob/main/.github/workflows/k6-tests.yaml

ppcano avatar Dec 15 '23 17:12 ppcano

+1 , I did some GitHub Action trickery to get such functionality working, but it can be awesome if this can be supported natively.

name: Grafana K6
on: workflow_dispatch
jobs:
  list-scripts:
    runs-on: ubuntu-latest
    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}
    steps:
      - uses: actions/checkout@v2
      - id: set-matrix
        run: echo "::set-output name=matrix::$(ls k6/*.js | jq -R -s -c 'split("\n")[:-1]')"
  check:
    needs: list-scripts
    runs-on: ubuntu-latest
    strategy:
        matrix:
            script: ${{ fromJson(needs.list-scripts.outputs.matrix) }}
    steps:
      - uses: actions/checkout@v2   
      - uses: grafana/[email protected]
        with:
          filename: ${{ matrix.script }}
          flags: --vus 10 --duration 10s --tag test=${{ matrix.script }}

shay-ul avatar Feb 12 '24 12:02 shay-ul

This is now supported in the new GH action: https://github.com/grafana/run-k6-action/

ppcano avatar Jul 16 '24 09:07 ppcano