diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd148204783..cc279203d32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,6 @@ name: CI on: pull_request: -# Requiring certain checks for PRs to be merge-able in Github, forces for those checks to be *always* run. -# Even if the changes do not require them (i.e. the paths indicated below). That's why `paths-ignore` is commented out. -# -# paths-ignore: -# - 'docs/**' -# - 'example/**' -# - 'tools/**' concurrency: # Cancel any running workflow for the same branch when new commits are pushed. @@ -16,179 +9,46 @@ concurrency: group: "${{ github.ref_name }}-${{ github.head_ref }}" cancel-in-progress: true +# Needed to login to DockerHub +permissions: + contents: read + id-token: write + jobs: - lint: - name: Lint + get-image-tag: runs-on: ubuntu-24.04 + outputs: + tag: ${{ steps.get-tag.outputs.tag }} steps: - - - name: Check out code + - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: "0" - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: "go.mod" - - - name: check-fmt - run: make check-fmt - - - name: check-jsonnetfmt - run: make check-jsonnetfmt - - name: Get year and week number - id: get-year-week-number - run: echo "date=$(date +"%Yweek%U")" >> $GITHUB_OUTPUT - - - name: cache golangci - uses: actions/cache@v4 - with: - path: .cache/golangci-lint - key: golangci-lint-${{ runner.os }}-${{ steps.get-year-week-number.outputs.date }}-${{ hashFiles('go.mod', '.golangci.yml') }} - - - name: lint + - id: get-tag run: | - make lint base=origin/${{github.base_ref}} - sudo chown -R $(id -u):$(id -g) .cache/golangci-lint # needed to archive cache - - - unit-tests: - name: Run Unit Tests - runs-on: ubuntu-24.04 - strategy: - matrix: - test-target: - [ - test-with-cover-pkg, - test-with-cover-tempodb, - test-with-cover-tempodb-wal, - test-with-cover-others, - ] - - steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: "go.mod" + echo "tag=$(./tools/image-tag)" >> "$GITHUB_OUTPUT" - - name: Run Tests - run: make ${{ matrix.test-target }} - - integration-tests: - name: Run integration tests - runs-on: ubuntu-24.04 + docker: + needs: get-image-tag strategy: matrix: - test-target: - [ - test-e2e, - test-integration-poller, - test-e2e-deployments, - test-e2e-serverless, - ] - - steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Fetch tags - run: git fetch --prune --unshallow --tags - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: "go.mod" - - name: Run Tests - run: make ${{ matrix.test-target }} - - build: - name: Build - runs-on: ubuntu-24.04 - steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: "go.mod" - - - name: Build Tempo - run: make tempo - - - name: generate-manifest - run: make generate-manifest - - - name: Build tempo-query - run: make tempo-query - - - name: Build vulture - run: make tempo-vulture - - - name: Build tempo-cli - run: make tempo-cli - - benchmark: - name: Benchmark - runs-on: ubuntu-24.04 - steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: "go.mod" - - - name: Bench - run: make test-bench - - vendor-check: - name: Vendor check - runs-on: ubuntu-24.04 - steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: "go.mod" - - - name: Install Protoc - uses: arduino/setup-protoc@v3 - - - name: Check vendor - run: make vendor-check - - tempo-jsonnet: - name: Check jsonnet & tempo-mixin - runs-on: ubuntu-24.04 + component: [ tempo, tempo-vulture, tempo-query, tempo-cli ] + runner_arch: [ { runner: ubuntu-24.04, arch: amd64 }, { runner: github-hosted-ubuntu-arm64, arch: arm64 } ] + runs-on: ${{ matrix.runner_arch.runner }} + env: + TAG: ${{ needs.get-image-tag.outputs.tag }} steps: - - name: Check out code + - name: Checkout uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: "go.mod" - - - name: Check jsonnet - run: make jsonnet-check + - name: Login to DockerHub + uses: grafana/shared-workflows/actions/dockerhub-login@dockerhub-login-v1.0.0 - - name: Check tempo-mixin - run: make tempo-mixin-check - - - name: Test jsonnet - run: make jsonnet-test + - name: build-tempo-binaries + run: | + COMPONENT=${{ matrix.component }} GOARCH=${{ matrix.runner_arch.arch }} make exe - build-technical-documentation: - name: Build technical documentation - runs-on: ubuntu-24.04 - steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Build Website - run: docker run -v ${PWD}/docs/sources:/hugo/content/docs/tempo/latest --rm grafana/docs-base:latest make prod + - name: docker-build-and-push-tempo + run: | + TAG_ARCH="$TAG-${{ matrix.runner_arch.arch }}" + docker build -f cmd/${{ matrix.component }}/Dockerfile -t grafana/${{ matrix.component }}:TAG_ARCH . + #docker push grafana/${{ matrix.component }}:TAG_ARCH