name: Coverage on: workflow_dispatch: push: branches: - main paths-ignore: - 'docs/**' - '**/*.md' permissions: contents: read id-token: write env: EDITION: 'oss' WIRE_TAGS: 'oss' jobs: main: name: Backend Unit Tests runs-on: ubuntu-latest-8-cores steps: - name: Checkout code uses: actions/checkout@v4 with: persist-credentials: false - name: Setup Go uses: actions/setup-go@v5 with: go-version-file: go.mod cache: true - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y build-essential shared-mime-info go install github.com/mfridman/tparse@c1754a1f484ac5cd422697b0fec635177ddc8507 # v0.17.0 - name: Generate Go code run: make gen-go - name: Run unit tests run: COVER_OPTS="-coverprofile=be-unit.cov -coverpkg=github.com/grafana/grafana/..." GO_TEST_OUTPUT="/tmp/unit.log" make test-go-unit-cov - name: Process and upload coverage uses: ./.github/actions/test-coverage-processor with: test-type: 'be-unit' # Needs to be named 'unit.cov' based on the Makefile command `make test-go-unit` coverage-file: 'unit.cov' codecov-token: ${{ secrets.CODECOV_TOKEN }} codecov-flag: 'be-unit' codecov-name: 'be-unit' - name: Install Grafana Bench # We can't allow forks here, as we need secret access. if: ${{ github.event_name != 'pull_request' }} uses: ./.github/actions/setup-grafana-bench - name: Process output for Bench if: ${{ github.event_name != 'pull_request' }} run: | grafana-bench report \ --trigger pr-backend-unit-tests-oss \ --report-input go \ --report-output log \ --grafana-version "$(git rev-parse HEAD)" \ --suite-name grafana-oss-unit-tests \ /tmp/unit.log || true concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: false