|
| 1 | +name: E2E tests |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + |
| 5 | +permissions: |
| 6 | + contents: read |
| 7 | + id-token: write |
| 8 | + |
| 9 | +jobs: |
| 10 | + resolve-versions: |
| 11 | + name: Resolve Grafana images |
| 12 | + runs-on: ubuntu-latest |
| 13 | + timeout-minutes: 3 |
| 14 | + outputs: |
| 15 | + matrix: ${{ steps.resolve-versions.outputs.matrix }} |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v4 |
| 19 | + - name: Resolve Grafana E2E versions |
| 20 | + id: resolve-versions |
| 21 | + uses: grafana/plugin-actions/e2e-version@main |
| 22 | + |
| 23 | + playwright-tests: |
| 24 | + needs: resolve-versions |
| 25 | + timeout-minutes: 60 |
| 26 | + strategy: |
| 27 | + fail-fast: false |
| 28 | + matrix: |
| 29 | + GRAFANA_IMAGE: ${{fromJson(needs.resolve-versions.outputs.matrix)}} |
| 30 | + name: e2e ${{ matrix.GRAFANA_IMAGE.name }}@${{ matrix.GRAFANA_IMAGE.VERSION }} |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Setup Node.js environment |
| 36 | + uses: actions/setup-node@v4 |
| 37 | + with: |
| 38 | + node-version-file: .nvmrc |
| 39 | + |
| 40 | + - name: Install yarn dependencies |
| 41 | + run: yarn install |
| 42 | + |
| 43 | + - name: Install Mage |
| 44 | + uses: magefile/mage-action@v3 |
| 45 | + with: |
| 46 | + install-only: true |
| 47 | + |
| 48 | + - name: Build binaries |
| 49 | + run: mage -v build:linux |
| 50 | + |
| 51 | + - name: Build frontend |
| 52 | + run: yarn build |
| 53 | + |
| 54 | + - name: Install Playwright Browsers |
| 55 | + run: yarn playwright install --with-deps |
| 56 | + |
| 57 | + - name: Start Grafana |
| 58 | + run: | |
| 59 | + docker-compose pull |
| 60 | + GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker-compose up -d |
| 61 | +
|
| 62 | + - name: Wait for Grafana to start |
| 63 | + uses: nev7n/wait_for_response@v1 |
| 64 | + with: |
| 65 | + url: 'http://localhost:3000/' |
| 66 | + responseCode: 200 |
| 67 | + timeout: 60000 |
| 68 | + interval: 500 |
| 69 | + |
| 70 | + - name: Run Playwright tests |
| 71 | + id: run-tests |
| 72 | + run: yarn playwright test |
| 73 | + |
| 74 | + - name: Upload artifacts |
| 75 | + uses: actions/upload-artifact@v4 |
| 76 | + if: ${{ (always() && steps.run-tests.outcome == 'success') || (failure() && steps.run-tests.outcome == 'failure') }} |
| 77 | + with: |
| 78 | + name: playwright-report-${{ matrix.GRAFANA_IMAGE.NAME }}-v${{ matrix.GRAFANA_IMAGE.VERSION }}-${{github.run_id}} |
| 79 | + path: playwright-report/ |
| 80 | + retention-days: 30 |
0 commit comments