-
Notifications
You must be signed in to change notification settings - Fork 608
156 lines (149 loc) · 4.57 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: ci
on:
push:
branches:
- main
- r[0-9]+ # Trigger builds after a push to weekly branches
pull_request:
concurrency:
# Cancel any running workflow for the same branch when new commits are pushed.
# We group both by ref_name (available when CI is triggered by a push to a branch/tag)
# and head_ref (available when CI is triggered by a PR).
group: "${{ github.ref_name }}-${{ github.head_ref }}"
cancel-in-progress: true
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22.7
- name: Format
run: make fmt check/unstaged-changes
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22.7
- name: Go Mod
run: make check/go/mod
- name: Test
run: make go/test
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22.7
- name: Run linter
run: make lint
- name: Check helm manifests
run: make helm/check check/unstaged-changes
test-docs:
runs-on: ubuntu-latest
steps:
- name: "Check out code"
uses: "actions/checkout@v3"
- name: "Test docs"
run: make docs/test
doc-validator:
runs-on: "ubuntu-latest"
container:
image: "grafana/doc-validator:v5.1.0"
steps:
- name: "Checkout code"
uses: "actions/checkout@v4"
- name: "Run doc-validator tool"
run: >
doc-validator
'--skip-checks=^image.+$'
docs/sources
/docs/writers-toolkit
| reviewdog
-f=rdjsonl
--fail-on-error
--filter-mode=nofilter
--name=doc-validator
--reporter=github-pr-review
env:
REVIEWDOG_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
build-image:
if: github.event_name != 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Set up go
uses: actions/setup-go@v5
with:
go-version: 1.22.7
- uses: actions/setup-node@v3
with:
node-version: lts/hydrogen
cache: yarn
- name: Build image Pyroscope
run: make docker-image/pyroscope/build "BUILDX_ARGS=--cache-from=type=gha --cache-to=type=gha"
build-push:
if: github.event_name == 'push' && github.repository == 'grafana/pyroscope'
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Set up go
uses: actions/setup-go@v5
with:
go-version: 1.22.7
- uses: actions/setup-node@v3
with:
node-version: lts/hydrogen
cache: yarn
- name: Login to GCR
uses: docker/login-action@v2
with:
registry: us.gcr.io
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}
- name: Pyroscope Build & push multi-arch image
id: build-push
run: |
make docker-image/pyroscope/push docker-image/pyroscope/push-debug "BUILDX_ARGS=--cache-from=type=gha --cache-to=type=gha"
deploy-dev-001:
if: github.event_name == 'push' && github.repository == 'grafana/pyroscope'
runs-on: ubuntu-latest
needs: [build-push]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Get github app token (valid for an hour)
id: app-release
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
repository: grafana/deployment_tools
- name: Deploy to fire-dev-001
run: |
git config --global url."https://x-access-token:$(echo "${GITHUB_TOKEN}" | xargs)@github.com/grafana/deployment_tools".insteadOf "https://github.com/grafana/deployment_tools"
make docker-image/pyroscope/deploy-dev-001
env:
GITHUB_TOKEN: ${{ steps.app-release.outputs.token }}