|
| 1 | +--- |
| 2 | +kind: pipeline |
| 3 | +type: docker |
| 4 | +name: test-pr-oss |
| 5 | + |
| 6 | +platform: |
| 7 | + os: linux |
| 8 | + arch: amd64 |
| 9 | + |
| 10 | +steps: |
| 11 | +- name: install-deps |
| 12 | + image: grafana/build-container:1.2.21 |
| 13 | + commands: |
| 14 | + - curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v$${GRABPL_VERSION}/grabpl |
| 15 | + - chmod +x grabpl |
| 16 | + - mkdir -p bin |
| 17 | + - mv grabpl bin |
| 18 | + - curl -fLO https://github.com/jwilder/dockerize/releases/download/v$${DOCKERIZE_VERSION}/dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz |
| 19 | + - tar -C bin -xzvf dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz |
| 20 | + - rm dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz |
| 21 | + - yarn install --frozen-lockfile --no-progress |
| 22 | + - cp -r $(yarn cache dir) yarn-cache |
| 23 | + environment: |
| 24 | + DOCKERIZE_VERSION: 0.6.1 |
| 25 | + GRABPL_VERSION: 0.4.15 |
| 26 | + |
| 27 | +- name: lint-go |
| 28 | + image: grafana/build-container:1.2.21 |
| 29 | + commands: |
| 30 | + - make lint-go |
| 31 | + environment: |
| 32 | + CGO_ENABLED: 1 |
| 33 | + depends_on: |
| 34 | + - install-deps |
| 35 | + |
| 36 | +- name: codespell |
| 37 | + image: grafana/build-container:1.2.21 |
| 38 | + commands: |
| 39 | + - "echo -e \"unknwon\nreferer\nerrorstring\neror\niam\" > words_to_ignore.txt" |
| 40 | + - codespell -I words_to_ignore.txt docs/ |
| 41 | + depends_on: |
| 42 | + - install-deps |
| 43 | + |
| 44 | +- name: shellcheck |
| 45 | + image: grafana/build-container:1.2.21 |
| 46 | + commands: |
| 47 | + - curl -fLO http://storage.googleapis.com/grafana-downloads/ci-dependencies/shellcheck-v$${VERSION}.linux.x86_64.tar.xz |
| 48 | + - echo $$CHKSUM shellcheck-v$${VERSION}.linux.x86_64.tar.xz | sha512sum --check --strict --status |
| 49 | + - tar xf shellcheck-v$${VERSION}.linux.x86_64.tar.xz |
| 50 | + - mv shellcheck-v$${VERSION}/shellcheck /usr/local/bin/ |
| 51 | + - rm -rf shellcheck-v$${VERSION}* |
| 52 | + - ./bin/grabpl shellcheck |
| 53 | + environment: |
| 54 | + CHKSUM: beca3d7819a6bdcfbd044576df4fc284053b48f468b2f03428fe66f4ceb2c05d9b5411357fa15003cb0311406c255084cf7283a3b8fce644c340c2f6aa910b9f |
| 55 | + VERSION: 0.7.1 |
| 56 | + depends_on: |
| 57 | + - install-deps |
| 58 | + |
| 59 | +- name: build-backend |
| 60 | + image: grafana/build-container:1.2.21 |
| 61 | + commands: |
| 62 | + - rm -rf $(go env GOCACHE) && cp -r go-cache $(go env GOCACHE) |
| 63 | + - ./bin/grabpl build-backend --github-token "$${GITHUB_TOKEN}" --edition oss --build-id $DRONE_BUILD_NUMBER --variants linux-x64,linux-x64-musl,osx64,win64 |
| 64 | + environment: |
| 65 | + GITHUB_TOKEN: |
| 66 | + from_secret: github_token |
| 67 | + depends_on: |
| 68 | + - install-deps |
| 69 | + - lint-go |
| 70 | + - test-backend |
| 71 | + |
| 72 | +- name: build-frontend |
| 73 | + image: grafana/build-container:1.2.21 |
| 74 | + commands: |
| 75 | + - rm -rf $(yarn cache dir) && cp -r yarn-cache $(yarn cache dir) |
| 76 | + - ./bin/grabpl build-frontend --no-install-deps --github-token "$${GITHUB_TOKEN}" --edition oss --build-id $DRONE_BUILD_NUMBER |
| 77 | + environment: |
| 78 | + GITHUB_TOKEN: |
| 79 | + from_secret: github_token |
| 80 | + depends_on: |
| 81 | + - install-deps |
| 82 | + - test-frontend |
| 83 | + |
| 84 | +- name: test-backend |
| 85 | + image: grafana/build-container:1.2.21 |
| 86 | + commands: |
| 87 | + - go test -covermode=atomic ./pkg/... |
| 88 | + - ./bin/grabpl integration-tests |
| 89 | + - cp -r $(go env GOCACHE) go-cache |
| 90 | + depends_on: |
| 91 | + - install-deps |
| 92 | + - lint-go |
| 93 | + |
| 94 | +- name: test-frontend |
| 95 | + image: grafana/build-container:1.2.21 |
| 96 | + commands: |
| 97 | + - rm -rf $(yarn cache dir) && cp -r yarn-cache $(yarn cache dir) |
| 98 | + - yarn run prettier:check |
| 99 | + - yarn run packages:typecheck |
| 100 | + - yarn run typecheck |
| 101 | + - yarn run test |
| 102 | + depends_on: |
| 103 | + - install-deps |
| 104 | + |
| 105 | +- name: build-plugins |
| 106 | + image: grafana/build-container:1.2.21 |
| 107 | + commands: |
| 108 | + - rm -rf $(yarn cache dir) && cp -r yarn-cache $(yarn cache dir) |
| 109 | + - ./bin/grabpl build-plugins --edition oss --no-install-deps |
| 110 | + depends_on: |
| 111 | + - install-deps |
| 112 | + - lint-go |
| 113 | + |
| 114 | +- name: package |
| 115 | + image: grafana/build-container:1.2.21 |
| 116 | + commands: |
| 117 | + - . scripts/build/gpg-test-vars.sh && ./bin/grabpl package --github-token "$${GITHUB_TOKEN}" --edition oss --build-id $DRONE_BUILD_NUMBER --variants linux-x64,linux-x64-musl,osx64,win64 |
| 118 | + environment: |
| 119 | + GITHUB_TOKEN: |
| 120 | + from_secret: github_token |
| 121 | + depends_on: |
| 122 | + - build-backend |
| 123 | + - build-frontend |
| 124 | + - build-plugins |
| 125 | + - test-backend |
| 126 | + - test-frontend |
| 127 | + - codespell |
| 128 | + - shellcheck |
| 129 | + |
| 130 | +- name: end-to-end-tests-server |
| 131 | + image: grafana/build-container:1.2.21 |
| 132 | + detach: true |
| 133 | + commands: |
| 134 | + - ./e2e/start-server |
| 135 | + depends_on: |
| 136 | + - package |
| 137 | + |
| 138 | +- name: end-to-end-tests |
| 139 | + image: grafana/ci-e2e:12.18-1 |
| 140 | + commands: |
| 141 | + - rm -rf $(yarn cache dir) && cp -r yarn-cache $(yarn cache dir) |
| 142 | + - ./node_modules/.bin/cypress install |
| 143 | + - ./e2e/wait-for-grafana |
| 144 | + - ./e2e/run-suite |
| 145 | + environment: |
| 146 | + HOST: end-to-end-tests-server |
| 147 | + depends_on: |
| 148 | + - end-to-end-tests-server |
| 149 | + |
| 150 | +- name: publish-storybook |
| 151 | + image: grafana/build-container:1.2.21 |
| 152 | + commands: |
| 153 | + - rm -rf $(yarn cache dir) && cp -r yarn-cache $(yarn cache dir) |
| 154 | + - yarn storybook:build |
| 155 | + depends_on: |
| 156 | + - package |
| 157 | + |
| 158 | +- name: build-docs-website |
| 159 | + image: grafana/docs-base:latest |
| 160 | + commands: |
| 161 | + - mkdir -p /hugo/content/docs/grafana |
| 162 | + - cp -r docs/sources /hugo/content/docs/grafana/latest |
| 163 | + - cd /hugo && make prod |
| 164 | + |
| 165 | +- name: copy-packages-for-docker |
| 166 | + image: grafana/build-container:1.2.21 |
| 167 | + commands: |
| 168 | + - cp dist/*.tar.gz packaging/docker/ |
| 169 | + depends_on: |
| 170 | + - package |
| 171 | + |
| 172 | +- name: build-docker-images |
| 173 | + image: grafana/drone-grafana-docker:0.2.0 |
| 174 | + settings: |
| 175 | + archs: amd64 |
| 176 | + dry_run: true |
| 177 | + edition: oss |
| 178 | + depends_on: |
| 179 | + - copy-packages-for-docker |
| 180 | + |
| 181 | +- name: postgres-integration-test |
| 182 | + image: grafana/build-container:1.2.21 |
| 183 | + commands: |
| 184 | + - apt-get update |
| 185 | + - apt-get install -yq postgresql-client |
| 186 | + - ./bin/dockerize -wait tcp://postgres:5432 -timeout 120s |
| 187 | + - psql -p 5432 -h postgres -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql |
| 188 | + - rm -rf $(go env GOCACHE) && cp -r go-cache $(go env GOCACHE) |
| 189 | + - go clean -testcache |
| 190 | + - ./bin/grabpl integration-tests --database postgres |
| 191 | + environment: |
| 192 | + GRAFANA_TEST_DB: postgres |
| 193 | + PGPASSWORD: grafanatest |
| 194 | + POSTGRES_HOST: postgres |
| 195 | + depends_on: |
| 196 | + - test-backend |
| 197 | + - test-frontend |
| 198 | + |
| 199 | +- name: mysql-integration-test |
| 200 | + image: grafana/build-container:1.2.21 |
| 201 | + commands: |
| 202 | + - apt-get update |
| 203 | + - apt-get install -yq default-mysql-client |
| 204 | + - ./bin/dockerize -wait tcp://mysql:3306 -timeout 120s |
| 205 | + - cat devenv/docker/blocks/mysql_tests/setup.sql | mysql -h mysql -P 3306 -u root -prootpass |
| 206 | + - rm -rf $(go env GOCACHE) && cp -r go-cache $(go env GOCACHE) |
| 207 | + - go clean -testcache |
| 208 | + - ./bin/grabpl integration-tests --database mysql |
| 209 | + environment: |
| 210 | + GRAFANA_TEST_DB: mysql |
| 211 | + MYSQL_HOST: mysql |
| 212 | + depends_on: |
| 213 | + - test-backend |
| 214 | + - test-frontend |
| 215 | + |
| 216 | +services: |
| 217 | +- name: postgres |
| 218 | + image: postgres:12.3-alpine |
| 219 | + environment: |
| 220 | + POSTGRES_DB: grafanatest |
| 221 | + POSTGRES_PASSWORD: grafanatest |
| 222 | + POSTGRES_USER: grafanatest |
| 223 | + |
| 224 | +- name: mysql |
| 225 | + image: mysql:5.6.48 |
| 226 | + environment: |
| 227 | + MYSQL_DATABASE: grafana_tests |
| 228 | + MYSQL_PASSWORD: password |
| 229 | + MYSQL_ROOT_PASSWORD: rootpass |
| 230 | + MYSQL_USER: grafana |
| 231 | + |
| 232 | +trigger: |
| 233 | + event: |
| 234 | + - pull_request |
| 235 | + |
| 236 | +--- |
| 237 | +kind: pipeline |
| 238 | +type: docker |
| 239 | +name: test-pr-enterprise |
| 240 | + |
| 241 | +platform: |
| 242 | + os: linux |
| 243 | + arch: amd64 |
| 244 | + |
| 245 | +steps: |
| 246 | +- name: install-deps |
| 247 | + image: grafana/build-container:1.2.21 |
| 248 | + commands: |
| 249 | + - curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v$${GRABPL_VERSION}/grabpl |
| 250 | + - chmod +x grabpl |
| 251 | + - mkdir -p bin |
| 252 | + - mv grabpl bin |
| 253 | + - curl -fLO https://github.com/jwilder/dockerize/releases/download/v$${DOCKERIZE_VERSION}/dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz |
| 254 | + - tar -C bin -xzvf dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz |
| 255 | + - rm dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz |
| 256 | + - yarn install --frozen-lockfile --no-progress |
| 257 | + - cp -r $(yarn cache dir) yarn-cache |
| 258 | + environment: |
| 259 | + DOCKERIZE_VERSION: 0.6.1 |
| 260 | + GRABPL_VERSION: 0.4.15 |
| 261 | + when: |
| 262 | + repo: |
| 263 | + - grafana/grafana |
| 264 | + - aknuds1/grafana |
| 265 | + |
| 266 | +- name: build-backend |
| 267 | + image: grafana/build-container:1.2.21 |
| 268 | + commands: |
| 269 | + - ./bin/grabpl build-backend --github-token "$${GITHUB_TOKEN}" --edition enterprise --build-id $DRONE_BUILD_NUMBER --variants linux-x64,linux-x64-musl,osx64,win64 |
| 270 | + environment: |
| 271 | + GITHUB_TOKEN: |
| 272 | + from_secret: github_token |
| 273 | + when: |
| 274 | + repo: |
| 275 | + - grafana/grafana |
| 276 | + - aknuds1/grafana |
| 277 | + depends_on: |
| 278 | + - install-deps |
| 279 | + |
| 280 | +- name: build-frontend |
| 281 | + image: grafana/build-container:1.2.21 |
| 282 | + commands: |
| 283 | + - rm -rf $(yarn cache dir) && cp -r yarn-cache $(yarn cache dir) |
| 284 | + - ./bin/grabpl build-frontend --no-install-deps --github-token "$${GITHUB_TOKEN}" --edition enterprise --build-id $DRONE_BUILD_NUMBER |
| 285 | + environment: |
| 286 | + GITHUB_TOKEN: |
| 287 | + from_secret: github_token |
| 288 | + when: |
| 289 | + repo: |
| 290 | + - grafana/grafana |
| 291 | + - aknuds1/grafana |
| 292 | + depends_on: |
| 293 | + - install-deps |
| 294 | + |
| 295 | +- name: build-plugins |
| 296 | + image: grafana/build-container:1.2.21 |
| 297 | + commands: |
| 298 | + - rm -rf $(yarn cache dir) && cp -r yarn-cache $(yarn cache dir) |
| 299 | + - ./bin/grabpl build-plugins --edition enterprise --no-install-deps |
| 300 | + when: |
| 301 | + repo: |
| 302 | + - grafana/grafana |
| 303 | + - aknuds1/grafana |
| 304 | + depends_on: |
| 305 | + - install-deps |
| 306 | + |
| 307 | +- name: package |
| 308 | + image: grafana/build-container:1.2.21 |
| 309 | + commands: |
| 310 | + - . scripts/build/gpg-test-vars.sh && ./bin/grabpl package --github-token "$${GITHUB_TOKEN}" --edition enterprise --build-id $DRONE_BUILD_NUMBER --variants linux-x64,linux-x64-musl,osx64,win64 |
| 311 | + environment: |
| 312 | + GITHUB_TOKEN: |
| 313 | + from_secret: github_token |
| 314 | + when: |
| 315 | + repo: |
| 316 | + - grafana/grafana |
| 317 | + - aknuds1/grafana |
| 318 | + depends_on: |
| 319 | + - build-backend |
| 320 | + - build-frontend |
| 321 | + - build-plugins |
| 322 | + |
| 323 | +- name: copy-packages-for-docker |
| 324 | + image: grafana/build-container:1.2.21 |
| 325 | + commands: |
| 326 | + - cp dist/*.tar.gz packaging/docker/ |
| 327 | + when: |
| 328 | + repo: |
| 329 | + - grafana/grafana |
| 330 | + - aknuds1/grafana |
| 331 | + depends_on: |
| 332 | + - package |
| 333 | + |
| 334 | +- name: build-docker-images |
| 335 | + image: grafana/drone-grafana-docker:0.2.0 |
| 336 | + settings: |
| 337 | + archs: amd64 |
| 338 | + dry_run: true |
| 339 | + edition: enterprise |
| 340 | + when: |
| 341 | + repo: |
| 342 | + - grafana/grafana |
| 343 | + - aknuds1/grafana |
| 344 | + depends_on: |
| 345 | + - copy-packages-for-docker |
| 346 | + |
| 347 | +trigger: |
| 348 | + event: |
| 349 | + - pull_request |
| 350 | + |
| 351 | +... |
0 commit comments