Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Mar 6, 2020
0 parents commit 3c503b3
Show file tree
Hide file tree
Showing 98 changed files with 43,274 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.vscode
assets/js/debug.js
*.conf
*.json
*.sh
*.yaml
!evcc.dist.yaml
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
; indicate this is the root of the project
root = true

[*]
charset = utf-8

end_of_line = LF
insert_final_newline = true
trim_trailing_whitespace = true

indent_style = tab
indent_size = 4

[*.css]
indent_size = 2

[*.js]
indent_style = space
indent_size = 2

[*.html]
indent_style = space
indent_size = 2

[*.{yml,yaml}]
indent_style = space
indent_size = 2
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
evcc.log
evcc.yaml
evcc.script.yaml
evcc.wallbe.yaml
linux-386-.Dockerfile
linux-amd64-.Dockerfile
linux-arm-7.Dockerfile
linux-arm-6.Dockerfile
linux-arm64-.Dockerfile
manifest.json
.vscode
audi.*
credentials.json
token.json
assets/js/debug.js
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
issues:
exclude:
- "func `..Wallbe..showIO` is unused"
- "func `..Wallbe..showIOs` is unused"
39 changes: 39 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
release:
# Repo in which the release will be created.
github:
owner: volkszaehler
name: ulm
before:
hooks:
# you may remove this if you don't need go generate
- go generate ./...
builds:
- id: ulm
# Path to main.go file or main package.
main: main.go
ldflags:
- -X github.com/andig/evcc.Version={{.Version}} -X github.com/andig/evcc.Commit={{.ShortCommit}}
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64
- arm
goarm:
- "6"
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^chore'
- '^bump'
- '^docs:'
- '^test:'
53 changes: 53 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
sudo: false
dist: xenial

language: go
go: "1.13"
go_import_path: github.com/andig/evcc

cache:
directories:
- $HOME/.cache/go-build
- $HOME/gopath/pkg/mod

notifications:
email:
on_success: never
on_failure: change

env:
global:
- PATH=$HOME/gopath/bin:$PATH

before_install:
# Install linters and misspell
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin
- golangci-lint --version
- make install

script:
# build
- make
# ensure all changes are committed
- test -z "$(git status --porcelain)" || (git status; git diff; false)

before_deploy:
- curl -sfL https://raw.githubusercontent.com/ldez/seihon/master/godownloader.sh | bash -s -- -b $GOPATH/bin
- seihon --version
- |
if ! [ "$BEFORE_DEPLOY_RUN" ]; then
export BEFORE_DEPLOY_RUN=1;
docker login -u $DOCKER_USER -p $DOCKER_PASS
fi
deploy:
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash
on:
tags: true
- provider: script
skip_cleanup: true
script: make publish-images
on:
tags: true
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
############################
# STEP 1 build executable binary
############################
FROM golang:1.13-alpine as builder

# Install git + SSL ca certificates.
# Git is required for fetching the dependencies.
# Ca-certificates is required to call HTTPS endpoints.
RUN apk update && apk add --no-cache git ca-certificates tzdata alpine-sdk && update-ca-certificates

WORKDIR /build

# cache modules
COPY go.mod .
COPY go.sum .
RUN go mod download

COPY . .
RUN make clean install assets build

#############################
## STEP 2 build a small image
#############################
FROM alpine

# Import from builder.
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /etc/passwd /etc/passwd

# Copy our static executable
COPY --from=builder /build/evcc /usr/local/bin/evcc

EXPOSE 7070

# Run the binary
ENTRYPOINT ["/usr/local/bin/evcc"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 andig

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.PHONY: default clean install lint test assets build binaries publish-images test-release release

TAG_NAME := $(shell git tag -l --contains HEAD)
SHA := $(shell git rev-parse --short HEAD)
VERSION := $(if $(TAG_NAME),$(TAG_NAME),$(SHA))

BUILD_DATE := $(shell date -u '+%Y-%m-%d_%H:%M:%S')

default: clean install assets lint test build

clean:
rm -rf dist/

install:
go install golang.org/x/tools/cmd/stringer
go install github.com/mjibson/esc
go install github.com/golang/mock/mockgen

lint:
golangci-lint run

test:
@echo "Running testsuite"
go test ./...

assets:
@echo "Generating embedded assets"
go generate ./...

build:
@echo Version: $(VERSION) $(BUILD_DATE)
go build -v -ldflags '-X "github.com/andig/evcc/server.Version=${VERSION}" -X "github.com/andig/evcc/server.Commit=${SHA}"'

publish-images:
@echo Version: $(VERSION) $(BUILD_DATE)
seihon publish -v "$(TAG_NAME)" -v "latest" --image-name andig/evcc-base --base-runtime-image alpine --dry-run=false --targets=arm.v6,amd64

test-release:
goreleaser --snapshot --skip-publish --rm-dist

release:
goreleaser --rm-dist
Loading

0 comments on commit 3c503b3

Please sign in to comment.