github.com/grafana/pyroscope@v1.18.0/.github/workflows/ci.yml (about) 1 name: ci 2 on: 3 push: 4 branches: 5 - main 6 7 pull_request: 8 9 permissions: 10 contents: read 11 12 concurrency: 13 # Cancel any running workflow for the same branch when new commits are pushed. 14 # We group both by ref_name (available when CI is triggered by a push to a branch/tag) 15 # and head_ref (available when CI is triggered by a PR). 16 group: "${{ github.ref_name }}-${{ github.head_ref }}" 17 cancel-in-progress: true 18 19 jobs: 20 format: 21 runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-large' || 'ubuntu-latest' }} 22 steps: 23 - name: Checkout code 24 uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 25 with: 26 persist-credentials: false 27 - name: Install Go 28 uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 29 with: 30 go-version: 1.24.12 31 - name: Format 32 run: make fmt check/unstaged-changes 33 check-generated: 34 runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-large' || 'ubuntu-latest' }} 35 steps: 36 - name: Checkout code 37 uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 38 with: 39 persist-credentials: false 40 - name: Install Go 41 uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 42 with: 43 go-version: 1.24.12 44 - name: Check generated files 45 run: make generate check/unstaged-changes 46 test: 47 strategy: 48 fail-fast: false 49 matrix: 50 arch: [amd64, arm64] 51 # Compute runner OS dynamically based on arch and repo ownership 52 runs-on: >- 53 ${{ 54 github.repository_owner == 'grafana' 55 && format('ubuntu-{0}-large', matrix.arch) 56 || (matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04') 57 }} 58 steps: 59 - name: Checkout code 60 uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 61 with: 62 persist-credentials: false 63 - name: Install Go 64 uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 65 with: 66 go-version: 1.24.12 67 - name: Go Mod 68 run: make check/go/mod 69 - name: Test 70 run: make go/test 71 lint: 72 runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-large' || 'ubuntu-latest' }} 73 steps: 74 - name: Checkout code 75 uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 76 with: 77 persist-credentials: false 78 - name: Install Go 79 uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 80 with: 81 go-version: 1.24.12 82 - name: Run linter 83 run: make lint 84 - name: Check helm manifests 85 run: make helm/check check/unstaged-changes 86 87 test-docs: 88 runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-small' || 'ubuntu-latest' }} 89 steps: 90 - name: "Check out code" 91 uses: "actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5" # v4 92 with: 93 persist-credentials: false 94 - name: "Test docs" 95 run: make docs/test 96 97 build-image: 98 if: github.event_name != 'push' 99 runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64' || 'ubuntu-latest' }} 100 steps: 101 - name: Checkout Repo 102 uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 103 with: 104 persist-credentials: false 105 - name: Set up QEMU 106 uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 107 - name: Set up Docker Buildx 108 uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 109 - name: Set up go 110 uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 111 with: 112 go-version: 1.24.12 113 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 114 with: 115 node-version: 20 116 cache: yarn 117 - name: Build image Pyroscope 118 run: make docker-image/pyroscope/build-multiarch "BUILDX_ARGS=--cache-from=type=gha --cache-to=type=gha" 119 120 build-push: 121 if: github.event_name == 'push' && github.repository == 'grafana/pyroscope' 122 permissions: 123 contents: read 124 id-token: write 125 runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-large' || 'ubuntu-latest' }} 126 outputs: 127 image: ${{ steps.push-metadata.outputs.image }} 128 image-digest: ${{ steps.push-metadata.outputs.image-digest }} 129 image-tag: ${{ steps.push-metadata.outputs.image-tag }} 130 steps: 131 - name: Checkout Repo 132 uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 133 with: 134 persist-credentials: false 135 - name: Set up QEMU 136 uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 137 - name: Set up Docker Buildx 138 uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 139 - name: Set up go 140 uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 141 with: 142 go-version: 1.24.12 143 # login to docker hub 144 - id: get-secrets 145 uses: grafana/shared-workflows/actions/get-vault-secrets@bae259f9ed5b6fcb050e3b58adf7aee776d4edb5 146 with: 147 common_secrets: | 148 DOCKERHUB_USERNAME=dockerhub:username 149 DOCKERHUB_PASSWORD=dockerhub:password 150 - uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2 151 name: Login to Docker Hub 152 with: 153 username: ${{ env.DOCKERHUB_USERNAME }} 154 password: ${{ env.DOCKERHUB_PASSWORD }} 155 - name: Pyroscope Build & push multi-arch image 156 id: build-push 157 run: | 158 make docker-image/pyroscope/push-multiarch "BUILDX_ARGS=--cache-from=type=gha --cache-to=type=gha" 159 - name: Get image, image tag and image digest 160 id: push-metadata 161 run: | 162 image=$(cat ./.docker-image-name-pyroscope) 163 echo "image=${image}" >> "$GITHUB_OUTPUT" 164 echo "image-tag=${image#*:}" >> "$GITHUB_OUTPUT" 165 echo "image-digest=$(cat ./.docker-image-digest-pyroscope)" >> "$GITHUB_OUTPUT" 166 167 deploy-dev: 168 permissions: 169 contents: read 170 id-token: write 171 if: github.event_name == 'push' && github.repository == 'grafana/pyroscope' && github.ref == 'refs/heads/main' 172 runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-small' || 'ubuntu-latest' }} 173 needs: [build-push] 174 steps: 175 - id: "submit-argowfs-deployment" 176 name: "Submit Argo Workflows deployment" 177 uses: grafana/shared-workflows/actions/trigger-argo-workflow@bae259f9ed5b6fcb050e3b58adf7aee776d4edb5 178 with: 179 namespace: "phlare-cd" 180 workflow_template: "deploy-pyroscope-dev" 181 parameters: | 182 dockertag=${{ needs.build-push.outputs.image-tag }} 183 commit=${{ github.sha }} 184 - name: Print URI 185 run: | 186 echo "URI: ${{ steps.submit-argowfs-deployment.outputs.uri }}"