From 3ca9cdca503315812ad5e1503d56d339b17cb9ee Mon Sep 17 00:00:00 2001 From: Todd Treece <360020+toddtreece@users.noreply.github.com> Date: Thu, 19 Sep 2024 19:29:13 -0400 Subject: [PATCH] Chore: Add Grafana version test coverage (#366) --- .github/pull_request_template.md | 14 +++-- .github/workflows/pr-integration-tests.yml | 67 ++++++++++++++++++++++ .github/workflows/pr.yml | 2 +- arguments/golang.go | 2 +- 4 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/pr-integration-tests.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index aecbb077..df6fa26f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,8 +1,12 @@ # Requirements -The `main` branch of `grafana-build` should be compatible with all active versions of Grafana **and Grafana-Enterprise**. +The `main` branch of `grafana-build` should be compatible with all active versions of Grafana **and Grafana-Enterprise**. To +run integration tests, add a comment to this PR with the following: + +``` +/grafana-integration-tests +``` + +* [ ] I have added the `/grafana-integration-tests` comment to this PR +* [ ] All integration tests have passed -* [ ] I have tested this against `main` in Grafana. -* [ ] I have tested this against `main` in Grafana Enterprise. -* [ ] I have tested this against all active version branches of Grafana (v10.0.x, v10.1.x, v10.2.x, etc). -* [ ] I have tested this against all active version branches of Grafana Enterprise (v10.0.x, v10.1.x, v10.2.x, etc). diff --git a/.github/workflows/pr-integration-tests.yml b/.github/workflows/pr-integration-tests.yml new file mode 100644 index 00000000..37e5e9ef --- /dev/null +++ b/.github/workflows/pr-integration-tests.yml @@ -0,0 +1,67 @@ +name: PR Integration Tests + +on: + issue_comment: + types: [created] + +jobs: + grafana-integration-tests: + runs-on: ubuntu-latest + if: ${{ github.event.issue.pull_request && 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 + steps: + - uses: actions/checkout@v4 + - 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} \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f5270628..daa81634 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -33,4 +33,4 @@ jobs: with: go-version: stable cache: true - - run: "go test ./... -v" + - run: "go test ./... -v" \ No newline at end of file diff --git a/arguments/golang.go b/arguments/golang.go index e7d0b7c8..b6c7dfd6 100644 --- a/arguments/golang.go +++ b/arguments/golang.go @@ -6,7 +6,7 @@ import ( ) const ( - DefaultGoVersion = "1.23.0" + DefaultGoVersion = "1.23.1" DefaultViceroyVersion = "v0.4.0" )