Skip to content

PR Integration Tests #34

PR Integration Tests

PR Integration Tests #34

name: PR Integration Tests
on:
workflow_dispatch: {}
issue_comment:
types: [created]
jobs:
grafana-integration-tests:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || (github.event.issue.pull_request && startsWith(github.event.comment.body, '/grafana-integration-tests')) }}
strategy:
matrix:
version: [main, v11.2.x, v11.1.x, v11.0.x, v10.4.x, v10.3.x]
type: [oss]
# TODO: figure out enterprise auth
# type: [oss, enterprise]
permissions:
id-token: write
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref }}
- name: "Create check"
id: create-check
uses: actions/github-script@v6
with:
script: |
const check = await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: context.sha,
name: "grafana-integration-tests",
status: "in_progress",
external_id: process.env.run_id,
output: {
title: "Grafana Integration Tests",
summary: '',
text: ''
},
});
return { id: check.data.id }
- name: Checkout grafana
uses: actions/checkout@v4
with:
repository: grafana/grafana
- name: Checkout grafana
uses: actions/checkout@v4
with:
repository: grafana/grafana
ref: ${{ matrix.version }}
path: grafana
- name: Checkout grafana-enterprise
if: matrix.type == 'enterprise'
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: grafana/grafana-enterprise
ref: ${{ matrix.version }}
path: grafana-enterprise
- name: Clean runner
run: |
df -h
docker builder prune -f
docker system prune -a -f
sudo rm -rf /opt/google/chrome
sudo rm -rf /opt/microsoft/msedge
sudo rm -rf /opt/microsoft/powershell
sudo rm -rf /opt/pipx
sudo rm -rf /usr/lib/mono
sudo rm -rf /usr/local/julia*
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /usr/local/share/chromium
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/share/swift
df -h
- name: Get Grafana golang version
run: echo "GRAFANA_GO_VERSION=$(grep "go 1." grafana/go.work | cut -d\ -f2)" >> "$GITHUB_ENV"
- name: OSS tests
uses: dagger/dagger-for-github@v6
if: matrix.type == 'oss'
with:
verb: run
args: go run ./cmd artifacts -a targz:grafana:linux/amd64 --grafana-dir=grafana --go-version=${GRAFANA_GO_VERSION}
- name: Enterprise tests
uses: dagger/dagger-for-github@v6
if: matrix.type == 'enterprise'
with:
verb: run
args: go run ./cmd artifacts -a targz:grafana-enterprise:linux/amd64 --grafana-dir=grafana --enterprise-dir=grafana-enterprise --go-version=${GRAFANA_GO_VERSION}
- name: "Update check"
uses: actions/github-script@v6
with:
script: |
await github.rest.checks.update({
repo: context.repo.repo,
owner: context.repo.owner,
check_run_id: ${{ fromJSON(steps.create-check.outputs.result).id }},
status: "completed",
conclusion: "${{ job.status}}",
});