diff --git a/.evergreen.yml b/.evergreen.yml index d6df9650c4..557102e834 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -1,24 +1,3 @@ -##################################################### -# A note on expansions # -##################################################### - -# Expansions usually appear in the form ${key|default} -# If 'key' is found in the executor's map of currently known -# expansions, the corresponding value is used. If the key can -# not be found, the default is used. -# -# Arbitrary expansions can be specified in the YAML configuration -# files in the following places: -# - The 'expansions' field for buildvariants (branch file) -# - The 'expansions' field for distros (distros file) -# -# A number of 'built-in' expansions are also available for use; these include: -# - environment variables available on the host machine -# - 'workdir' (references the executor's work directory). -# - 'task_id' (references the task id of the task the executor is working on). -# - 'build_variant' (references the executing task's buildvariant). -# - 'config_root' (references the root directory for the executor's configuration artifacts). - stepback: true command_type: system pre_error_fails_task: true @@ -28,19 +7,13 @@ pre_error_fails_task: true ignore: - "*.md" - "*.txt" - - "/dist/**" - - "/bin/**" - - "/third_party_notices/**" variables: - &go_bin - "/opt/golang/go1.13/bin" - + "/opt/golang/go1.14/bin" - &go_options GO111MODULE: "on" - GOFLAGS: "-mod=vendor" - GOROOT: "/opt/golang/go1.13" - + GOROOT: "/opt/golang/go1.14" functions: "clone": - command: git.get_project @@ -53,20 +26,34 @@ functions: params: add_to_path: - *go_bin - - *go_bin working_dir: mongocli env: WORKDIR: ${workdir} <<: *go_options command: make build - "package": - - command: subprocess.exec + "gen-notices": + - command: shell.exec type: setup params: - env: - WORKDIR: ${workdir} - <<: *go_options - command: "curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh" + working_dir: mongocli + script: | + set -ex + export GOROOT="/opt/golang/go1.14" + mkdir go-licenses + export GOPATH=${workdir}/go-licenses + export PATH="$GOPATH/bin:$GOROOT/bin:$PATH" + + go get -u github.com/google/go-licenses + go-licenses save "github.com/mongodb/mongocli" --save_path=third_party_notices + "fetch goreleaser": + - command: shell.exec + type: setup + params: + working_dir: mongocli + script: | + set -ex + curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh + "package": - command: subprocess.exec type: setup params: @@ -75,9 +62,8 @@ functions: - ./bin working_dir: mongocli env: - WORKDIR: ${workdir} <<: *go_options - command: make build + command: make package tasks: - name: compile commands: @@ -87,14 +73,15 @@ tasks: depends_on: - name: compile commands: + - func: "clone" + - func: "gen-notices" + - func: "fetch goreleaser" - func: "package" buildvariants: - - name: ubuntu - display_name: Ubuntu + - name: redhat + display_name: RHEL7 Test run_on: - - ubuntu1804-test - expansions: - test_flags: "blah blah" + - rhel70-small tasks: - name: compile - name: package diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 294a2c21fc..1562324f1e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,6 +29,8 @@ The following is a short list of commands that can be run in the root of the pro We provide a git pre-commit hook to format and check the code, to install it run `make link-git-hooks` +We run our some packaging and publishing tasks in [Evergreen](https://github.com/evergreen-ci/evergreen). + ### Generating mocks We use [mockgen](https://github.com/golang/mock) to handle mocking in our unit tests diff --git a/Makefile b/Makefile index 8b82c2d284..a69e331f0c 100644 --- a/Makefile +++ b/Makefile @@ -85,11 +85,13 @@ gen-notices: ## Generate 3rd party notices go-licenses save "github.com/mongodb/mongocli" --save_path=third_party_notices .PHONY: package -package: gen-notices ## Use goreleaser to generate builds and publish +package: ## Use goreleaser to generate builds + @echo "==> Packaging" goreleaser --skip-publish --rm-dist --snapshot .PHONY: release release: gen-notices ## Use goreleaser to generate builds and publish + @echo "==> Releasing" goreleaser --rm-dist .PHONY: list