|
| 1 | +name: e2e |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +permissions: read-all |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + resolve-versions: |
| 19 | + name: Resolve Grafana images |
| 20 | + runs-on: ubuntu-latest |
| 21 | + timeout-minutes: 3 |
| 22 | + outputs: |
| 23 | + matrix: ${{ steps.resolve-versions.outputs.matrix }} |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@v4 |
| 27 | + - name: Resolve Grafana E2E versions |
| 28 | + id: resolve-versions |
| 29 | + uses: grafana/plugin-actions/e2e-version@main |
| 30 | + |
| 31 | + run-e2e: |
| 32 | + needs: resolve-versions |
| 33 | + timeout-minutes: 15 |
| 34 | + strategy: |
| 35 | + fail-fast: false |
| 36 | + matrix: |
| 37 | + GRAFANA_IMAGE: ${{fromJson(needs.resolve-versions.outputs.matrix)}} |
| 38 | + name: e2e ${{ matrix.GRAFANA_IMAGE.name }}@${{ matrix.GRAFANA_IMAGE.VERSION }} |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + |
| 43 | + - name: Setup Node.js environment |
| 44 | + uses: actions/setup-node@v4 |
| 45 | + with: |
| 46 | + node-version-file: .nvmrc |
| 47 | + cache: 'yarn' |
| 48 | + |
| 49 | + - name: Install dependencies |
| 50 | + run: yarn install |
| 51 | + |
| 52 | + - name: Build frontend |
| 53 | + run: yarn build |
| 54 | + |
| 55 | + - name: Setup Go environment |
| 56 | + uses: actions/setup-go@v5 |
| 57 | + with: |
| 58 | + go-version-file: './go.mod' |
| 59 | + cache-dependency-path: "**/*.sum" |
| 60 | + |
| 61 | + - name: Build backend [linux] |
| 62 | + uses: magefile/mage-action@v3 |
| 63 | + with: |
| 64 | + version: latest |
| 65 | + args: build:linux |
| 66 | +# args: buildAll # do we want to build all? |
| 67 | + |
| 68 | + - name: Start Grafana |
| 69 | + run: | |
| 70 | + docker-compose pull |
| 71 | + GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker-compose up -d |
| 72 | +
|
| 73 | + - name: Wait for prometheus to start |
| 74 | + uses: nev7n/wait_for_response@v1 |
| 75 | + with: |
| 76 | + url: 'http://localhost:9090/-/ready' |
| 77 | + responseCode: 200 |
| 78 | + timeout: 20000 |
| 79 | + interval: 500 |
| 80 | + |
| 81 | + - name: Wait for Grafana to start |
| 82 | + uses: nev7n/wait_for_response@v1 |
| 83 | + with: |
| 84 | + url: 'http://localhost:3000/' |
| 85 | + responseCode: 200 |
| 86 | + timeout: 60000 |
| 87 | + interval: 500 |
| 88 | + |
| 89 | + - name: Install Playwright Browsers |
| 90 | + run: yarn playwright install --with-deps |
| 91 | + |
| 92 | + - name: Run Playwright tests |
| 93 | + id: run-tests |
| 94 | + run: yarn e2e |
| 95 | + |
| 96 | + - name: Upload playwright artifacts |
| 97 | + uses: actions/upload-artifact@v4 |
| 98 | + if: ${{ github.repository_owner != 'grafana' && (always() && steps.run-tests.outcome == 'success') || (failure() && steps.run-tests.outcome == 'failure') }} |
| 99 | + with: |
| 100 | + name: playwright-report-${{ matrix.GRAFANA_IMAGE.NAME }}-v${{ matrix.GRAFANA_IMAGE.VERSION }}-${{github.run_id}} |
| 101 | + path: playwright-report/ |
| 102 | + retention-days: 30 |
| 103 | + |
| 104 | + - name: Upload playwright videos |
| 105 | + uses: actions/upload-artifact@v4 |
| 106 | + if: ${{ github.repository_owner != 'grafana' && (always() && steps.run-tests.outcome == 'success') || (failure() && steps.run-tests.outcome == 'failure') }} |
| 107 | + with: |
| 108 | + name: test-results-${{ matrix.GRAFANA_IMAGE.NAME }}-v${{ matrix.GRAFANA_IMAGE.VERSION }}-${{github.run_id}} |
| 109 | + path: test-results/ |
| 110 | + retention-days: 30 |
| 111 | + |
| 112 | + - name: Stop grafana docker |
| 113 | + run: docker-compose down |
0 commit comments