Skip to content

CLOUDP-59277: Set up evergreen #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 30 additions & 43 deletions .evergreen.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -75,9 +62,8 @@ functions:
- ./bin
working_dir: mongocli
env:
WORKDIR: ${workdir}
<<: *go_options
command: make build
command: make package
tasks:
- name: compile
commands:
Expand All @@ -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
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down