-
Notifications
You must be signed in to change notification settings - Fork 770
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: run tests and build golang.go-nightly
Building and testing the extension requires a custom docker image that includes Go, Node.js, jq, gopls, dlv, staticcheck, etc. build-ci-image.yaml is a workflow that builds and stores the image in Artifact Registry. (vscode-go-docker-repo/ci-image). release-nightly.yaml workflow uses the container. - The workflow clones the vscode-go repo (master branch). - Before packaging, the "prepare nightly release" step adjusts the package.json for golang.go-nightly use. - Then run tests. It's possible that the lint test and the tools/generate.go test may be unhappy about the spacing and formatting caused by the modification made during the previous step. However, the errors are not critical for packaging/publishing. Refactoring of all.bash was to skip the lint, generate.go tests during nightly release. The workflow uploads the built extension to the project's GCS bucket but does not publish the built extension to the marketplace yet. Change-Id: Ib48fdc45f1fd1c86fcfc2d293e7f60690b2cad11 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/510515 Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Commit-Queue: Hyang-Ah Hana Kim <hyangah@gmail.com>
- Loading branch information
Showing
4 changed files
with
81 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
### Release process | ||
|
||
The golang.go-nightly extension is released daily during weekdays, based on the latest commit to the master branch. | ||
|
||
(Note: the release process is currently in GH workflow. We are in process of moving it to a GCB workflow.) | ||
|
||
* Dockerfile: defines the image containing tools and environments needed to build and test the extension. (e.g. Go, Node.js, jq, etc.) | ||
* build-ci-image.yaml: defines the workflow to build the container image used for extension testing and releasing. | ||
* release-nightly.yaml: defines the workflow that builds the nightly extension and runs tests. The built extension is pushed only after all tests pass. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Usage: gcloud builds submit --config build/build-ci-image.yaml . | ||
steps: | ||
- name: 'gcr.io/cloud-builders/docker' | ||
entrypoint: 'bash' | ||
args: ['-c', 'docker pull us-docker.pkg.dev/$PROJECT_ID/vscode-go-docker-repo/ci-image:latest || exit 0'] | ||
- name: 'gcr.io/cloud-builders/docker' | ||
# https://cloud.google.com/build/docs/optimize-builds/speeding-up-builds | ||
args: [ | ||
'build', | ||
'-t', 'us-docker.pkg.dev/$PROJECT_ID/vscode-go-docker-repo/ci-image:latest', | ||
'--cache-from', 'us-docker.pkg.dev/$PROJECT_ID/vscode-go-docker-repo/ci-image:latest', | ||
'-f', 'build/Dockerfile', | ||
'.'] | ||
images: ['us-docker.pkg.dev/$PROJECT_ID/vscode-go-docker-repo/ci-image'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,44 @@ | ||
# This workflow will be triggered daily. | ||
# For local testing, run: | ||
# gcloud builds submit --config release-nightly.yaml | ||
# This will check out the vscode-go repo master branch and run the build from it. | ||
steps: | ||
# TODO: check build/test status | ||
# | ||
# Install dependencies | ||
- name: node | ||
# TODO: check build/test status | ||
- id: clone vscode-go repo | ||
name: "gcr.io/cloud-builders/git" | ||
args: ['clone', '--branch=master', "--depth=1", 'https://go.googlesource.com/vscode-go', 'vscode-go'] | ||
- id: adjust file permissions | ||
name: "gcr.io/cloud-builders/docker" | ||
entrypoint: "chown" | ||
args: ["-R", "1000:1000", "/workspace", "/builder/home"] # ci-image sets USER to node whose uid/gid are 1000. | ||
dir: "/" | ||
- id: install npm dependencies | ||
name: "us-docker.pkg.dev/$PROJECT_ID/vscode-go-docker-repo/ci-image" | ||
entrypoint: npm | ||
args: ['ci'] | ||
# Build .vsix | ||
- name: node | ||
args: ["ci"] | ||
dir: "vscode-go" | ||
- id: prepare nightly release | ||
name: "us-docker.pkg.dev/$PROJECT_ID/vscode-go-docker-repo/ci-image" | ||
entrypoint: "bash" | ||
args: ["build/all.bash", 'prepare_nightly'] | ||
dir: "vscode-go" | ||
- id: build .vsix | ||
name: "us-docker.pkg.dev/$PROJECT_ID/vscode-go-docker-repo/ci-image" | ||
entrypoint: npm | ||
args: ['run', 'package'] | ||
args: ["run", "package"] # we build vsix before running tests to avoid including unintentional changes. | ||
dir: "vscode-go" | ||
- id: run tests | ||
name: "us-docker.pkg.dev/$PROJECT_ID/vscode-go-docker-repo/ci-image" | ||
entrypoint: "bash" | ||
args: ["build/all.bash", "test_nightly"] | ||
dir: "vscode-go" | ||
env: | ||
- "IN_RELEASE_WORKFLOW=true" | ||
options: | ||
substitution_option: "ALLOW_LOOSE" | ||
machineType: 'E2_HIGHCPU_8' # tests need powerful cpus to avoid timeout. | ||
images: ['us-docker.pkg.dev/$PROJECT_ID/vscode-go-docker-repo/ci-image:latest'] | ||
artifacts: | ||
objects: | ||
location: 'gs://$PROJECT_ID/nightly/$BUILD_ID' | ||
paths: ['*.vsix'] | ||
location: "gs://$PROJECT_ID/nightly" | ||
paths: ["vscode-go/*.vsix"] # vsix file base name includes the extension version. |