| 1 | # Copyright 2019 The Go Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style |
| 3 | # license that can be found in the LICENSE file. |
| 4 | |
| 5 | # Build gopls, and run the govim integration tests. See README.md for |
| 6 | # instructions on how to use this. |
| 7 | |
| 8 | substitutions: |
| 9 | # This bucket must be owned by the GCP project executing the build. If |
| 10 | # you are running this from your own project, override using --substitutions. |
| 11 | _RESULT_BUCKET: 'golang-gopls_integration_tests' |
| 12 | |
| 13 | steps: |
| 14 | # Build gopls from source, to use with the govim integration tests. |
| 15 | - name: 'golang:1.14' |
| 16 | env: ['GOPROXY=https://proxy.golang.org'] |
| 17 | dir: 'gopls' |
| 18 | args: ['go', 'build'] |
| 19 | |
| 20 | # Run the tests. Note that the script in this step does not return the exit |
| 21 | # code from `go test`, but rather saves it for use in the final step after |
| 22 | # uploading artifacts. |
| 23 | - name: 'gcr.io/$PROJECT_ID/govim-harness:3' |
| 24 | dir: '/src/govim' |
| 25 | volumes: |
| 26 | - name: artifacts |
| 27 | path: /artifacts |
| 28 | env: |
| 29 | - GOVIM_TESTSCRIPT_WORKDIR_ROOT=/artifacts |
| 30 | - VIM_FLAVOR=vim |
| 31 | args: ['/workspace/gopls/integration/govim/run_tests_for_cloudbuild.sh'] |
| 32 | |
| 33 | # The govim tests produce a large number of artifacts; tarball/gzip to reduce |
| 34 | # roundtrips and save space. |
| 35 | - name: 'ubuntu' |
| 36 | volumes: |
| 37 | - name: artifacts |
| 38 | path: /artifacts |
| 39 | args: ['tar', '-czf', 'artifacts.tar.gz', '/artifacts'] |
| 40 | |
| 41 | # Upload artifacts to GCS. |
| 42 | - name: 'gcr.io/cloud-builders/gcloud' |
| 43 | args: ['storage', 'cp', 'artifacts.tar.gz', 'gs://${_RESULT_BUCKET}/govim/${BUILD_ID}/artifacts.tar.gz'] |
| 44 | |
| 45 | # Exit with the actual exit code of the integration tests. |
| 46 | - name: 'ubuntu' |
| 47 | args: ['bash', 'govim_test_result.sh'] |
| 48 | |
| 49 | # Write build logs to the same bucket as artifacts, so they can be more easily |
| 50 | # shared. |
| 51 | logsBucket: 'gs://${_RESULT_BUCKET}' |