Actions: Shard test suite (#105166)
This commit is contained in:
@@ -6,6 +6,10 @@ on:
|
||||
- main
|
||||
- release-*.*.*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
@@ -15,7 +19,15 @@ permissions: {}
|
||||
|
||||
jobs:
|
||||
sqlite:
|
||||
name: Sqlite
|
||||
strategy:
|
||||
matrix:
|
||||
shard: [
|
||||
1/8, 2/8, 3/8, 4/8,
|
||||
5/8, 6/8, 7/8, 8/8,
|
||||
]
|
||||
fail-fast: false
|
||||
|
||||
name: Sqlite (${{ matrix.shard }})
|
||||
runs-on: ubuntu-latest-8-cores
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -29,14 +41,24 @@ jobs:
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- run: |
|
||||
go_packages="$(find ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' | grep -o '\(.*\)/' | sort -u)"
|
||||
IFS=' ' read -ra packages <<< "$go_packages"
|
||||
|
||||
make gen-go
|
||||
go test -tags=sqlite -timeout=5m -run '^TestIntegration' "${packages[@]}"
|
||||
- name: Generate Go code
|
||||
run: make gen-go
|
||||
- name: Run tests
|
||||
env:
|
||||
SHARD: ${{ matrix.shard }}
|
||||
run: |
|
||||
readarray -t PACKAGES <<< "$(./scripts/ci/backend-tests/pkgs-with-tests-named.sh -b TestIntegration | ./scripts/ci/backend-tests/shard.sh -N"$SHARD" -d-)"
|
||||
go test -tags=sqlite -timeout=5m -run '^TestIntegration' "${PACKAGES[@]}"
|
||||
mysql:
|
||||
name: MySQL
|
||||
strategy:
|
||||
matrix:
|
||||
shard: [
|
||||
1/8, 2/8, 3/8, 4/8,
|
||||
5/8, 6/8, 7/8, 8/8,
|
||||
]
|
||||
fail-fast: false
|
||||
|
||||
name: MySQL (${{ matrix.shard }})
|
||||
runs-on: ubuntu-latest-8-cores
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -64,19 +86,33 @@ jobs:
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- run: |
|
||||
go_packages="$(find ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' | grep -o '\(.*\)/' | sort -u)"
|
||||
IFS=' ' read -ra packages <<< "$go_packages"
|
||||
|
||||
sudo apt-get update -yq && sudo apt-get install mariadb-client
|
||||
mariadb -h 127.0.0.1 -P 3306 -u root -prootpass --disable-ssl-verify-server-cert < devenv/docker/blocks/mysql_tests/setup.sql
|
||||
make gen-go
|
||||
go test -tags=mysql -p=1 -timeout=5m -run '^TestIntegration' "${packages[@]}"
|
||||
- name: Setup MySQL devenv
|
||||
run: mysql -h 127.0.0.1 -P 3306 -u root -prootpass < devenv/docker/blocks/mysql_tests/setup.sql
|
||||
- name: Generate Go code
|
||||
run: make gen-go
|
||||
- name: Run tests
|
||||
env:
|
||||
SHARD: ${{ matrix.shard }}
|
||||
run: |
|
||||
readarray -t PACKAGES <<< "$(./scripts/ci/backend-tests/pkgs-with-tests-named.sh -b TestIntegration | ./scripts/ci/backend-tests/shard.sh -N"$SHARD" -d-)"
|
||||
go test -p=1 -tags=mysql -timeout=5m -run '^TestIntegration' "${PACKAGES[@]}"
|
||||
postgres:
|
||||
name: Postgres
|
||||
strategy:
|
||||
matrix:
|
||||
shard: [
|
||||
1/8, 2/8, 3/8, 4/8,
|
||||
5/8, 6/8, 7/8, 8/8,
|
||||
]
|
||||
fail-fast: false
|
||||
|
||||
name: Postgres (${{ matrix.shard }})
|
||||
runs-on: ubuntu-latest-8-cores
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
GRAFANA_TEST_DB: postgres
|
||||
PGPASSWORD: grafanatest
|
||||
POSTGRES_HOST: 127.0.0.1
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:12.3-alpine
|
||||
@@ -96,15 +132,13 @@ jobs:
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- env:
|
||||
GRAFANA_TEST_DB: postgres
|
||||
PGPASSWORD: grafanatest
|
||||
POSTGRES_HOST: 127.0.0.1
|
||||
- name: Setup Postgres devenv
|
||||
run: psql -p 5432 -h 127.0.0.1 -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql
|
||||
- name: Generate Go code
|
||||
run: make gen-go
|
||||
- name: Run tests
|
||||
env:
|
||||
SHARD: ${{ matrix.shard }}
|
||||
run: |
|
||||
go_packages="$(find ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' | grep -o '\(.*\)/' | sort -u)"
|
||||
IFS=' ' read -ra packages <<< "$go_packages"
|
||||
|
||||
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' "${packages[@]}"
|
||||
readarray -t PACKAGES <<< "$(./scripts/ci/backend-tests/pkgs-with-tests-named.sh -b TestIntegration | ./scripts/ci/backend-tests/shard.sh -N"$SHARD" -d-)"
|
||||
go test -p=1 -tags=postgres -timeout=5m -run '^TestIntegration' "${PACKAGES[@]}"
|
||||
|
||||
Reference in New Issue
Block a user