Skip to content

Plugin E2E: Add auth test file #221

Plugin E2E: Add auth test file

Plugin E2E: Add auth test file #221

Workflow file for this run

name: E2E tests - Playwright
on:
pull_request:
paths:
- 'packages/plugin-e2e/**'
- '.github/workflows/playwright.yml'
permissions:
contents: read
id-token: write
jobs:
setup-matrix:
runs-on: ubuntu-latest
timeout-minutes: 3
outputs:
matrix: ${{ steps.resolve-versions.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Resolve Grafana E2E versions
id: resolve-versions
uses: grafana/plugin-actions/e2e-version@main
with:
version-resolver-type: version-support-policy
playwright-tests:
needs: setup-matrix
timeout-minutes: 60
strategy:
matrix:
GRAFANA_VERSION: ${{fromJson(needs.setup-matrix.outputs.matrix)}}
name: E2E Tests - Grafana@${{ matrix.GRAFANA_VERSION }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Copy auth file
run: mkdir -p packages/plugin-e2e/playwright/.auth/ && cp .github/user.json packages/plugin-e2e/playwright/.auth/user.json
- name: Setup Node.js environment
uses: actions/setup-node@v4
- name: Install dependencies
run: npm ci
- name: Build frontend
run: npm run build --w @grafana/plugin-e2e
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Start Grafana
run: docker run --rm -d -p 3000:3000 --name=grafana --volume ./packages/plugin-e2e/provisioning:/etc/grafana/provisioning --env AWS_SECRET_ACCESS_KEY=${{secrets.AWS_SECRET_ACCESS_KEY}} --env AWS_ACCESS_KEY_ID=${{secrets.AWS_ACCESS_KEY_ID}} --env GOOGLE_JWT_FILE=${{secrets.GOOGLE_JWT_FILE}} --env "GF_INSTALL_PLUGINS=grafana-googlesheets-datasource 1.2.4,grafana-redshift-datasource 1.13.0,grafana-clock-panel 2.1.3" grafana/grafana:${{ matrix.GRAFANA_VERSION }}; sleep 30
- name: Run Playwright tests
run: npm run playwright:test --w @grafana/plugin-e2e
env:
GOOGLE_JWT_FILE: ${{ secrets.GOOGLE_JWT_FILE }}
- uses: actions/upload-artifact@v4
if: ${{ always() && github.event.organization.login != 'grafana' }}
with:
name: playwright-report-Grafana-v${{ matrix.GRAFANA_VERSION }}-${{github.run_id}}
path: packages/plugin-e2e/playwright-report/
retention-days: 30
- id: get-secrets
if: ${{ always() && github.event.organization.login == 'grafana' }}
uses: grafana/shared-workflows/actions/get-vault-secrets@main
with:
common_secrets: |
GCP_UPLOAD_ARTIFACTS_KEY=grafana/artifacts-uploader-service-account:'credentials.json'
- name: 'Authenticate to Google Cloud'
if: ${{ always() && github.event.organization.login == 'grafana' }}
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ env.GCP_UPLOAD_ARTIFACTS_KEY }}'
- name: 'Set up Cloud SDK'
if: ${{ always() && github.event.organization.login == 'grafana' }}
uses: 'google-github-actions/setup-gcloud@v2'
- name: Publish report to Cloud Storage
if: ${{ always() && github.event.organization.login == 'grafana' }}
run: |
echo "Publish release to Google Cloud Storage:"
gsutil cp -r packages/plugin-e2e/playwright-report/. gs://releng-pipeline-artifacts-dev/${{ github.event.repository.name }}/${{ github.event.number }}/Grafana-v${{ matrix.GRAFANA_VERSION }}
- name: Write report link to summary
if: ${{ always() && github.event.organization.login == 'grafana' }}
run: echo '<a href="https://storage.googleapis.com/releng-pipeline-artifacts-dev/${{ github.event.repository.name }}/${{ github.event.number }}/Grafana-v${{ matrix.GRAFANA_VERSION }}/index.html">Browse the Playwright report</a>' >> $GITHUB_STEP_SUMMARY