Skip to content

Make e2e generic to work on old and new grafana version #444

Make e2e generic to work on old and new grafana version

Make e2e generic to work on old and new grafana version #444

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
grafana: ['9.5.0', '11.6.1']
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: "14.x"
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build and test frontend
run: yarn build
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Test backend
uses: magefile/mage-action@v3
with:
version: latest
args: coverage
- name: Build backend
uses: magefile/mage-action@v3
with:
version: latest
args: buildAll
- name: Setup services (Trino, Grafana, Keycloak)
run: |
docker network create trino
echo "Starting Keycloak..."
docker run --rm --detach \
--name keycloak \
--net trino \
--publish 18080:8080 \
--env KC_BOOTSTRAP_ADMIN_USERNAME=admin \
--env KC_BOOTSTRAP_ADMIN_PASSWORD=admin \
--volume "$(pwd)/test-data/test-keycloak-realm.json:/opt/keycloak/data/import/realm.json" \
quay.io/keycloak/keycloak:26.1.4 \
start-dev --import-realm
echo "Waiting for Keycloak to be ready..."
while true; do
if curl -s http://localhost:18080/realms/master | grep -q "realm"; then
echo "Keycloak is ready!"
break
fi
echo "Waiting for Keycloak..."
sleep 5
done
echo "Starting Trino..."
docker run --rm --detach \
--name trino \
--net trino \
--volume "$(pwd)/test-data/test-trino-config.properties:/etc/trino/config.properties" \
trinodb/trino:468
echo "Starting Grafana..."
docker run --rm --detach \
--name grafana \
--net trino \
--publish 3000:3000 \
--volume "$(pwd):/var/lib/grafana/plugins/trino" \
--env "GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=trino-datasource" \
grafana/grafana:${{ matrix.grafana }}
- name: End to end test
run: |
npx tsc -p tsconfig.json --noEmit
npx playwright install
npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report-${{ matrix.grafana }}
path: playwright-report/
retention-days: 5
- name: Dump logs
if: always()
run: |
echo "::group::Trino logs"
docker logs trino
echo "::endgroup::"
echo "::group::Keycloak logs"
docker logs keycloak
echo "::endgroup::"
echo "::group::Grafana logs"
docker logs grafana
echo "::endgroup::"