gha workflow

This commit is contained in:
joshhunt
2025-07-01 13:24:18 +01:00
parent 895bea7c52
commit c0525f41fa
2 changed files with 33 additions and 146 deletions
-146
View File
@@ -1,146 +0,0 @@
name: Playwright E2E Tests
on:
pull_request:
push:
branches:
- main
- release-*.*.*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
permissions: {}
jobs:
build-grafana:
name: Build & Package Grafana
runs-on: ubuntu-latest-16-cores
permissions:
contents: read
outputs:
artifact: ${{ steps.artifact.outputs.artifact }}
steps:
- uses: actions/checkout@v4
with:
path: ./grafana
persist-credentials: false
- uses: dagger/dagger-for-github@e47aba410ef9bb9ed81a4d2a97df31061e5e842e
with:
verb: run
args: go -C grafana run ./pkg/build/cmd artifacts -a targz:grafana:linux/amd64 --grafana-dir="${PWD}/grafana" > out.txt
- run: mv "$(cat out.txt)" grafana.tar.gz
- run: echo "artifact=grafana-playwright-${{github.run_number}}" >> "$GITHUB_OUTPUT"
id: artifact
- uses: actions/upload-artifact@v4
id: upload
with:
retention-days: 1
name: ${{ steps.artifact.outputs.artifact }}
path: grafana.tar.gz
run-playwright-tests:
needs:
- build-grafana
strategy:
fail-fast: false
matrix:
include:
- suite: plugin-e2e-api-tests
project: admin
- suite: plugin-e2e-api-tests
project: viewer
- suite: plugin-e2e
project: elasticsearch
- suite: plugin-e2e
project: mysql
- suite: plugin-e2e
project: mssql
- suite: plugin-e2e
project: cloudwatch
- suite: plugin-e2e
project: azuremonitor
- suite: plugin-e2e
project: cloudmonitoring
- suite: plugin-e2e
project: graphite
- suite: plugin-e2e
project: influxdb
- suite: plugin-e2e
project: jaeger
- suite: plugin-e2e
project: zipkin
- suite: core-tests
project: panels
- suite: core-tests
project: smoke
- suite: core-tests
project: dashboards
- suite: core-tests
project: loki
- suite: test-plugins
project: extensions-test-app
- suite: test-plugins
project: grafana-e2etest-datasource
name: ${{ matrix.suite }}-${{ matrix.project }}
runs-on: ubuntu-latest-8-cores
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/download-artifact@v4
with:
name: ${{ needs.build-grafana.outputs.artifact }}
- name: Run Playwright E2E tests
uses: dagger/dagger-for-github@e47aba410ef9bb9ed81a4d2a97df31061e5e842e
with:
verb: run
args: go run ./pkg/build/daggerbuild/playwright run --package=grafana.tar.gz --project=${{ matrix.project }}
- name: Set suite name
id: set-suite-name
if: success() || failure()
env:
SUITE: ${{ matrix.suite }}-${{ matrix.project }}
run: |
set -euo pipefail
echo "suite=$(echo "$SUITE" | sed 's/\//-/g')" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: playwright-report-${{ steps.set-suite-name.outputs.suite }}-${{ github.run_number }}
path: playwright-report
retention-days: 3
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-results-${{ steps.set-suite-name.outputs.suite }}-${{ github.run_number }}
path: test-results
retention-days: 3
# This is the job that is actually required by rulesets.
# We want to only require one job instead of all the individual tests.
required-playwright-tests:
needs:
- run-playwright-tests
# always() is the best function here.
# success() || failure() will skip this function if any need is also skipped.
# That means conditional test suites will fail the entire requirement check.
if: always()
name: All Playwright E2E tests complete
runs-on: ubuntu-latest
steps:
- name: Check test suites
env:
NEEDS: ${{ toJson(needs) }}
run: |
FAILURES="$(echo "$NEEDS" | jq 'with_entries(select(.value.result == "failure")) | map_values(.result)')"
echo "$FAILURES"
if [ "$(echo "$FAILURES" | jq '. | length')" != "0" ]; then
exit 1
fi
echo "All OK!"
+33
View File
@@ -137,6 +137,39 @@ jobs:
path: videos
retention-days: 1
run-playwright-tests:
needs:
- build-grafana
name: Playwright E2E tests
runs-on: ubuntu-latest-8-cores
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/download-artifact@v4
with:
name: ${{ needs.build-grafana.outputs.artifact }}
- name: Run E2E tests
uses: dagger/dagger-for-github@e47aba410ef9bb9ed81a4d2a97df31061e5e842e
with:
verb: run
args: go run ./pkg/build/e2e-playwright --package=grafana.tar.gz
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: playwright-report-${{ github.run_number }}
path: ./dist/playwright-report
retention-days: 1
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-results-${{ github.run_number }}
path: ./dist/test-results
retention-days: 1
run-a11y-test:
needs:
- build-grafana