Skip to content

Update e2e tests

Update e2e tests #430

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
jobs:
build:
runs-on: ubuntu-latest
outputs:
e2e-matrix: ${{ steps.resolve-versions.outputs.matrix }}
steps:
- uses: actions/checkout@v6
- name: Setup Node.js environment
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Check types
run: npm run typecheck
- name: Lint
run: npm run lint
- name: Unit tests
run: npm run test:ci
- name: Build frontend
run: npm run build
- name: Check for backend
id: check-for-backend
run: |
if [ -f "Magefile.go" ]
then
echo "has-backend=true" >> $GITHUB_OUTPUT
fi
- name: Setup Go environment
if: steps.check-for-backend.outputs.has-backend == 'true'
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Test backend
if: steps.check-for-backend.outputs.has-backend == 'true'
uses: magefile/mage-action@v2
with:
version: latest
args: coverage
- name: Build backend
if: steps.check-for-backend.outputs.has-backend == 'true'
uses: magefile/mage-action@v2
with:
version: latest
args: buildAll
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
- name: Resolve Grafana E2E versions
id: resolve-versions
uses: grafana/plugin-actions/e2e-version@e2e-version/v1.2.1
with:
skip-grafana-react-19-preview-image: false
e2e:
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
GRAFANA_IMAGE: ${{ fromJson(needs.build.outputs.e2e-matrix) }}
steps:
- uses: actions/checkout@v6
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Setup Node.js environment
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Playwright
run: npx playwright install --with-deps chromium
- name: Start Grafana (${{ matrix.GRAFANA_IMAGE.name }}:${{ matrix.GRAFANA_IMAGE.version }})
run: docker compose up -d --build
env:
GRAFANA_VERSION: ${{ matrix.GRAFANA_IMAGE.version }}
GRAFANA_IMAGE: ${{ matrix.GRAFANA_IMAGE.name }}
- name: Wait for Grafana to start
run: |
for i in $(seq 1 30); do
if curl -s http://localhost:3000/api/health | grep -q "ok"; then
echo "Grafana is ready"
exit 0
fi
echo "Waiting for Grafana... ($i/30)"
sleep 2
done
echo "Grafana failed to start"
docker compose logs grafana
exit 1
- name: Run e2e tests
run: npm run e2e
- name: Stop Grafana
if: always()
run: docker compose down