The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/.github/workflows/pr-test-integration.yml

126 lines
4.2 KiB

name: Integration Tests
on:
push:
branches:
- main
- release-*.*.*
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sqlite:
name: Sqlite
runs-on: ubuntu-latest-8-cores
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Restore GOCACHE
uses: actions/cache/restore@v4
with:
key: go-test-cache-${{ github.ref_name }}-sqlite
restore-keys: |
go-test-cache-${{ github.base_ref }}-sqlite
go-test-cache-main-sqlite
path: /home/runner/.cache/go-build
- run: |
make gen-go
go test -tags=sqlite -timeout=5m -run '^TestIntegration' $(find ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' | grep -o '\(.*\)/' | sort -u)
- name: Save GOCACHE
uses: actions/cache/save@v4
with:
key: go-test-cache-${{ github.ref_name }}-sqlite
path: /home/runner/.cache/go-build
mysql:
name: MySQL
runs-on: ubuntu-latest-8-cores
env:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: 127.0.0.1
services:
mysql:
image: mysql:8.0.32
env:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_DATABASE: grafana_tests
MYSQL_USER: grafana
MYSQL_PASSWORD: password
options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=5s --health-retries=3
ports:
- 3306:3306
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Restore GOCACHE
uses: actions/cache/restore@v4
with:
key: go-test-cache-${{ github.ref_name }}-mysql
restore-keys: |
go-test-cache-${{ github.base_ref }}-mysql
go-test-cache-main-mysql
path: /home/runner/.cache/go-build
- run: |
sudo apt-get update -yq && sudo apt-get install mariadb-client
cat devenv/docker/blocks/mysql_tests/setup.sql | mariadb -h 127.0.0.1 -P 3306 -u root -prootpass --disable-ssl-verify-server-cert
make gen-go
go test -tags=mysql -p=1 -timeout=5m -run '^TestIntegration' $(find ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' | grep -o '\(.*\)/' | sort -u)
- name: Save GOCACHE
uses: actions/cache/save@v4
with:
key: go-test-cache-${{ github.ref_name }}-mysql
path: /home/runner/.cache/go-build
postgres:
name: Postgres
runs-on: ubuntu-latest-8-cores
services:
postgres:
image: postgres:12.3-alpine
env:
POSTGRES_USER: grafanatest
POSTGRES_PASSWORD: grafanatest
POSTGRES_DB: grafanatest
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Restore GOCACHE
uses: actions/cache/restore@v4
with:
key: go-test-cache-${{ github.ref_name }}-postgres
restore-keys: |
go-test-cache-${{ github.base_ref }}-postgres
go-test-cache-main-postgres
path: /home/runner/.cache/go-build
- env:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
POSTGRES_HOST: 127.0.0.1
run: |
sudo apt-get update -yq && sudo apt-get install postgresql-client
psql -p 5432 -h 127.0.0.1 -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql
make gen-go
go test -p=1 -tags=postgres -timeout=5m -run '^TestIntegration' $(find ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' | grep -o '\(.*\)/' | sort -u)
- name: Save GOCACHE
uses: actions/cache/save@v4
with:
key: go-test-cache-${{ github.ref_name }}-postgres
path: /home/runner/.cache/go-build