This commit is contained in:
Martin/Geno 2019-02-28 17:02:34 +01:00
parent bfb3da9338
commit f40f94077e
No known key found for this signature in database
GPG Key ID: 9D7D3C6BFF600C6A
4 changed files with 97 additions and 34 deletions

View File

@ -1,34 +0,0 @@
workspace:
base: /go
path: src/dev.sum7.eu/genofire/wifictld-analyzer
pipeline:
build:
image: golang:latest
commands:
- go get ./...
- go build
codestyle:
image: golang:latest
commands:
- go get github.com/client9/misspell/cmd/misspell
- misspell -error .
- if [ -n "$(gofmt -s -l .)" ]; then echo "Go code is not formatted, run 'gofmt -s -w .'" >&2; exit 1; fi
test:
image: golang:latest
commands:
- go get github.com/stretchr/testify/assert
- go test ./... -v -cover
test-race:
image: golang:latest
commands:
- go get github.com/stretchr/testify/assert
- go test ./... -v -race
release:
image: plugins/gitea-release
base_url: https://dev.sum7.eu
secrets: [ gitea_token ]
files: /go/bin/analyzer
draft: true
when:
event: tag

50
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,50 @@
image: golang:latest
stages:
- build
- test
- deploy
before_script:
- mkdir -p "/go/src/dev.sum7.eu/$CI_PROJECT_NAMESPACE/"
- cp -R "/builds/$CI_PROJECT_PATH" "/go/src/dev.sum7.eu/$CI_PROJECT_NAMESPACE/"
- cd "/go/src/dev.sum7.eu/$CI_PROJECT_PATH"
- go get -d -t ./...
build-my-project:
stage: build
script:
- go install "dev.sum7.eu/$CI_PROJECT_PATH"
- mv "/go/bin/$CI_PROJECT_NAME" "/builds/$CI_PROJECT_PATH"
artifacts:
paths:
- config_example.conf
- "$CI_PROJECT_NAME"
test-my-project:
stage: test
script:
- go get github.com/client9/misspell/cmd/misspell
- misspell -error .
- ./.ci/check-gofmt
- ./.ci/check-testfiles
- go test $(go list ./... | grep -v /vendor/) -v -coverprofile .testCoverage.txt
artifacts:
paths:
- .testCoverage.txt
test-race-my-project:
stage: test
script:
- go test -race ./...
deploy:
stage: deploy
only:
- master
script:
- go install "dev.sum7.eu/$CI_PROJECT_PATH"
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- scp -6 -o StrictHostKeyChecking=no -P $SSH_PORT "/go/bin/$CI_PROJECT_NAME" "$CI_PROJECT_NAME@$SSH_HOST":/opt/$CI_PROJECT_NAME/bin
- ssh -6 -o StrictHostKeyChecking=no -p $SSH_PORT "$CI_PROJECT_NAME@$SSH_HOST" sudo /usr/bin/systemctl restart $CI_PROJECT_NAME

47
README.md Normal file
View File

@ -0,0 +1,47 @@
# wifictld-analyzer
[![Build Status](https://dev.sum7.eu/genofire/wifictld-analyzer/badges/master/build.svg)](https://dev.sum7.eu/genofire/wifictld-analyzer/pipelines)
[![Go Report Card](https://goreportcard.com/badge/dev.sum7.eu/genofire/wifictld-analyzer)](https://goreportcard.com/report/dev.sum7.eu/genofire/wifictld-analyzer)
[![GoDoc](https://godoc.org/dev.sum7.eu/genofire/wifictld-analyzer?status.svg)](https://godoc.org/dev.sum7.eu/genofire/wifictld-analyzer)
## Get wifictld-analyzer
#### Download
Latest Build binary from ci here:
[Download All](https://dev.sum7.eu/genofire/wifictld-analyzer/-/jobs/artifacts/master/download/?job=build-my-project) (with config example)
[Download Binary](https://dev.sum7.eu/genofire/wifictld-analyzer/-/jobs/artifacts/master/raw/wifictld-analyzer?inline=false&job=build-my-project)
#### Build
```bash
go get -u dev.sum7.eu/genofire/wifictld-analyzer
```
## Configure
see `config_example.conf`
## Start / Boot
_/lib/systemd/system/wifictld-analyzer.service_ :
```
[Unit]
Description=wifictld-analyzer
After=network.target
[Service]
Type=simple
# User=notRoot
ExecStart=/opt/go/bin/wifictld-analyzer controller /etc/wifictld-analyzer.conf
Restart=always
RestartSec=5sec
[Install]
WantedBy=multi-user.target
```
Start: `systemctl start wifictld-analyzer`
Autostart: `systemctl enable wifictld-analyzer`