Skip to content

Commit 3c503b3

Browse files
committed
Initial commit
0 parents  commit 3c503b3

File tree

98 files changed

+43274
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+43274
-0
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.vscode
2+
assets/js/debug.js
3+
*.conf
4+
*.json
5+
*.sh
6+
*.yaml
7+
!evcc.dist.yaml

.editorconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
; indicate this is the root of the project
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
7+
end_of_line = LF
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
indent_style = tab
12+
indent_size = 4
13+
14+
[*.css]
15+
indent_size = 2
16+
17+
[*.js]
18+
indent_style = space
19+
indent_size = 2
20+
21+
[*.html]
22+
indent_style = space
23+
indent_size = 2
24+
25+
[*.{yml,yaml}]
26+
indent_style = space
27+
indent_size = 2

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
evcc.log
2+
evcc.yaml
3+
evcc.script.yaml
4+
evcc.wallbe.yaml
5+
linux-386-.Dockerfile
6+
linux-amd64-.Dockerfile
7+
linux-arm-7.Dockerfile
8+
linux-arm-6.Dockerfile
9+
linux-arm64-.Dockerfile
10+
manifest.json
11+
.vscode
12+
audi.*
13+
credentials.json
14+
token.json
15+
assets/js/debug.js

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
issues:
2+
exclude:
3+
- "func `..Wallbe..showIO` is unused"
4+
- "func `..Wallbe..showIOs` is unused"

.goreleaser.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This is an example goreleaser.yaml file with some sane defaults.
2+
# Make sure to check the documentation at http://goreleaser.com
3+
release:
4+
# Repo in which the release will be created.
5+
github:
6+
owner: volkszaehler
7+
name: ulm
8+
before:
9+
hooks:
10+
# you may remove this if you don't need go generate
11+
- go generate ./...
12+
builds:
13+
- id: ulm
14+
# Path to main.go file or main package.
15+
main: main.go
16+
ldflags:
17+
- -X github.com/andig/evcc.Version={{.Version}} -X github.com/andig/evcc.Commit={{.ShortCommit}}
18+
env:
19+
- CGO_ENABLED=0
20+
goos:
21+
- linux
22+
- darwin
23+
goarch:
24+
- amd64
25+
- arm
26+
goarm:
27+
- "6"
28+
checksum:
29+
name_template: 'checksums.txt'
30+
snapshot:
31+
name_template: "{{ .Tag }}-next"
32+
changelog:
33+
sort: asc
34+
filters:
35+
exclude:
36+
- '^chore'
37+
- '^bump'
38+
- '^docs:'
39+
- '^test:'

.travis.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
sudo: false
2+
dist: xenial
3+
4+
language: go
5+
go: "1.13"
6+
go_import_path: github.com/andig/evcc
7+
8+
cache:
9+
directories:
10+
- $HOME/.cache/go-build
11+
- $HOME/gopath/pkg/mod
12+
13+
notifications:
14+
email:
15+
on_success: never
16+
on_failure: change
17+
18+
env:
19+
global:
20+
- PATH=$HOME/gopath/bin:$PATH
21+
22+
before_install:
23+
# Install linters and misspell
24+
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin
25+
- golangci-lint --version
26+
- make install
27+
28+
script:
29+
# build
30+
- make
31+
# ensure all changes are committed
32+
- test -z "$(git status --porcelain)" || (git status; git diff; false)
33+
34+
before_deploy:
35+
- curl -sfL https://raw.githubusercontent.com/ldez/seihon/master/godownloader.sh | bash -s -- -b $GOPATH/bin
36+
- seihon --version
37+
- |
38+
if ! [ "$BEFORE_DEPLOY_RUN" ]; then
39+
export BEFORE_DEPLOY_RUN=1;
40+
docker login -u $DOCKER_USER -p $DOCKER_PASS
41+
fi
42+
43+
deploy:
44+
- provider: script
45+
skip_cleanup: true
46+
script: curl -sL https://git.io/goreleaser | bash
47+
on:
48+
tags: true
49+
- provider: script
50+
skip_cleanup: true
51+
script: make publish-images
52+
on:
53+
tags: true

Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
############################
2+
# STEP 1 build executable binary
3+
############################
4+
FROM golang:1.13-alpine as builder
5+
6+
# Install git + SSL ca certificates.
7+
# Git is required for fetching the dependencies.
8+
# Ca-certificates is required to call HTTPS endpoints.
9+
RUN apk update && apk add --no-cache git ca-certificates tzdata alpine-sdk && update-ca-certificates
10+
11+
WORKDIR /build
12+
13+
# cache modules
14+
COPY go.mod .
15+
COPY go.sum .
16+
RUN go mod download
17+
18+
COPY . .
19+
RUN make clean install assets build
20+
21+
#############################
22+
## STEP 2 build a small image
23+
#############################
24+
FROM alpine
25+
26+
# Import from builder.
27+
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
28+
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
29+
COPY --from=builder /etc/passwd /etc/passwd
30+
31+
# Copy our static executable
32+
COPY --from=builder /build/evcc /usr/local/bin/evcc
33+
34+
EXPOSE 7070
35+
36+
# Run the binary
37+
ENTRYPOINT ["/usr/local/bin/evcc"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 andig
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.PHONY: default clean install lint test assets build binaries publish-images test-release release
2+
3+
TAG_NAME := $(shell git tag -l --contains HEAD)
4+
SHA := $(shell git rev-parse --short HEAD)
5+
VERSION := $(if $(TAG_NAME),$(TAG_NAME),$(SHA))
6+
7+
BUILD_DATE := $(shell date -u '+%Y-%m-%d_%H:%M:%S')
8+
9+
default: clean install assets lint test build
10+
11+
clean:
12+
rm -rf dist/
13+
14+
install:
15+
go install golang.org/x/tools/cmd/stringer
16+
go install github.com/mjibson/esc
17+
go install github.com/golang/mock/mockgen
18+
19+
lint:
20+
golangci-lint run
21+
22+
test:
23+
@echo "Running testsuite"
24+
go test ./...
25+
26+
assets:
27+
@echo "Generating embedded assets"
28+
go generate ./...
29+
30+
build:
31+
@echo Version: $(VERSION) $(BUILD_DATE)
32+
go build -v -ldflags '-X "github.com/andig/evcc/server.Version=${VERSION}" -X "github.com/andig/evcc/server.Commit=${SHA}"'
33+
34+
publish-images:
35+
@echo Version: $(VERSION) $(BUILD_DATE)
36+
seihon publish -v "$(TAG_NAME)" -v "latest" --image-name andig/evcc-base --base-runtime-image alpine --dry-run=false --targets=arm.v6,amd64
37+
38+
test-release:
39+
goreleaser --snapshot --skip-publish --rm-dist
40+
41+
release:
42+
goreleaser --rm-dist

0 commit comments

Comments
 (0)