-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b0c71e
commit 8f98289
Showing
14 changed files
with
640 additions
and
2 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,128 @@ | ||
# Defaults for our CircleCI jobs. | ||
defaults: &defaults | ||
working_directory: /go/src/github.com/vapor-ware/sandbox-plugin | ||
docker: | ||
- image: circleci/golang:latest | ||
environment: | ||
IMAGE_NAME: "vaporio/sandbox-plugin" | ||
|
||
|
||
# Common config for tag-triggered workflows | ||
tag-filters: &tag-filters | ||
filters: | ||
branches: | ||
ignore: /.*/ | ||
tags: | ||
only: /^[0-9]*(\.[0-9]*)*(-(\S)*)?$/ | ||
|
||
|
||
# CircleCI Config | ||
version: 2 | ||
jobs: | ||
|
||
# build | ||
# | ||
# This job is run for all commits. It makes sure that: the source code | ||
# is properly linted, the source code is properly formatted, the source | ||
# can be compiled and built successfully, and the Docker image can be | ||
# built successfully. | ||
# | ||
# This job does not publish any build artifacts. | ||
build: | ||
<<: *defaults | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- v1-vendor-{{ checksum "Gopkg.toml" }}-{{ checksum "Gopkg.lock" }} | ||
- v1-vendor-{{ checksum "Gopkg.toml" }} | ||
- run: | ||
name: Install Vendored Dependencies | ||
command: make dep | ||
- run: | ||
name: Lint | ||
command: make lint | ||
- run: | ||
name: Format | ||
command: | | ||
fmt="$(find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do goimports -d "$file"; done)" | ||
if [ "$fmt" != "" ]; then | ||
echo "$fmt" | ||
exit 1 | ||
fi | ||
- run: | ||
name: Build Binary | ||
command: make build | ||
- setup_remote_docker: | ||
docker_layer_caching: true | ||
- run: | ||
name: Build Docker Image | ||
command: make docker | ||
- save_cache: | ||
when: on_success | ||
key: v1-vendor-{{ checksum "Gopkg.toml" }}-{{ checksum "Gopkg.lock" }} | ||
paths: | ||
- vendor/ | ||
|
||
# release | ||
# | ||
# This job creates a GitHub release draft for the tag that was pushed. | ||
# It generates a changelog for the release and attaches build artifacts | ||
# to the release as well. The release should be manually published on GitHub. | ||
release: | ||
<<: *defaults | ||
steps: | ||
- checkout | ||
- setup_remote_docker: | ||
docker_layer_caching: true | ||
- run: | ||
name: Check Version matches Tag | ||
command: | | ||
v=$(make version) | ||
if [ "$v" != "$CIRCLE_TAG" ]; then | ||
echo "Versions do not match: $v != $CIRCLE_TAG" | ||
exit 1 | ||
fi | ||
- run: | ||
name: Install Vendored Dependencies | ||
command: make dep | ||
- run: | ||
name: Building Artifacts | ||
command: make ci-build | ||
- run: | ||
name: Generate Changelog | ||
command: | | ||
tag=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1` || true) | ||
since_tag=$(if [ "${tag}" ]; then echo "--since-tag ${tag}"; fi) | ||
docker pull timfallmk/github-changelog-generator | ||
docker run --name changelog timfallmk/github-changelog-generator \ | ||
-u ${CIRCLE_PROJECT_USERNAME} \ | ||
-p ${CIRCLE_PROJECT_REPONAME} \ | ||
-t ${GITHUB_TOKEN} \ | ||
${since_tag} | ||
docker cp changelog:/usr/local/src/your-app/CHANGELOG.md ./ | ||
- run: | ||
name: Create Release | ||
command: | | ||
go get -v github.com/tcnksm/ghr | ||
if git describe --exact-match --tags HEAD; then | ||
CIRCLE_TAG=$(git describe --exact-match --tags HEAD) | ||
fi | ||
ghr \ | ||
-u ${GITHUB_USER} \ | ||
-t ${GITHUB_TOKEN} \ | ||
-b "$(cat ./CHANGELOG.md)" \ | ||
-replace \ | ||
-draft \ | ||
${CIRCLE_TAG} build/ | ||
workflows: | ||
version: 2 | ||
build: | ||
jobs: | ||
- build | ||
- release: | ||
context: vapor-auto | ||
<<: *tag-filters |
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,13 @@ | ||
FROM iron/go:dev as builder | ||
WORKDIR /go/src/github.com/vapor-ware/sandbox-plugin | ||
COPY . . | ||
RUN make build CGO_ENABLED=0 | ||
|
||
|
||
FROM scratch | ||
LABEL maintainer="[email protected]" | ||
COPY --from=builder /go/src/github.com/vapor-ware/sandbox-plugin/build/plugin ./plugin | ||
COPY config/plugin/config.yml /etc/synse/plugin/config/config.yml | ||
COPY config/device/devices.yml /etc/synse/plugin/config/device/devices.yml | ||
EXPOSE 5002 | ||
ENTRYPOINT ["./plugin"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,34 @@ | ||
# Gopkg.toml example | ||
# | ||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html | ||
# for detailed Gopkg.toml documentation. | ||
# | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project" | ||
# version = "1.0.0" | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project2" | ||
# branch = "dev" | ||
# source = "github.com/myfork/project2" | ||
# | ||
# [[override]] | ||
# name = "github.com/x/y" | ||
# version = "2.4.0" | ||
# | ||
# [prune] | ||
# non-go = false | ||
# go-tests = true | ||
# unused-packages = true | ||
|
||
|
||
[[constraint]] | ||
name = "github.com/vapor-ware/synse-sdk" | ||
branch = "v1.0" | ||
|
||
[prune] | ||
go-tests = true | ||
unused-packages = true |
Oops, something went wrong.