From a5d345533325248b8bacf98c4dbd4548bbaa13ca Mon Sep 17 00:00:00 2001 From: Brendan Le Glaunec Date: Sat, 15 Jun 2019 13:52:56 +0200 Subject: [PATCH] Add Goreleaser (#226) --- .gitignore | 3 +++ .goreleaser.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 31 +++++++++++++++++++++++++++++-- CHANGELOG.md | 0 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 .goreleaser.yml create mode 100644 CHANGELOG.md diff --git a/.gitignore b/.gitignore index f152f9d..a11bd28 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ # Golang /bin/* /pkg/* + +# Builds +dist/ \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..7795f6c --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,43 @@ +project_name: cameradar +dist: dist/cameradar + +env: + - GO111MODULE=on +before: + hooks: + - go mod download + +builds: + - binary: cameradar + main: ./cmd/cameradar + goos: + - windows + - darwin + - linux + goarch: + - amd64 + - 386 + - arm + - arm64 + goarm: + - 6 + - 7 + + ignore: + - goos: darwin + goarch: 386 + +changelog: + skip: true + +checksum: + name_template: "{{ .ProjectName }}_checksums.txt" + +archives: + - name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ if .Arm}}v{{ .Arm }}{{ end }}" + format: tar.gz + format_overrides: + - goos: windows + format: zip + files: + - CHANGELOG.md \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 96da8b6..7222abf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,18 @@ dist: trusty sudo: required language: go +addons: + apt: + packages: + # needed for the nfpm pipe: + - rpm + # needed for the snap pipe: + - snapd + env: - GO111MODULE=on + # needed for the snap pipe: + - PATH=/snap/bin:$PATH services: - docker @@ -23,12 +33,14 @@ before_install: - docker version install: +# needed for the snap pipe: +- sudo snap install snapcraft --classic - docker build -t cameradar . script: # Run unit tests -- go test -v -covermode=count -coverprofile=coverage.out -- $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken=$COVERALLS_TOKEN +- GO111MODULE=on go test -v -covermode=count -coverprofile=coverage.out +- GO111MODULE=on $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken=$COVERALLS_TOKEN # Launch fake cameras to check if cameradar is able to access them - docker run -d --name="fake_camera_digest" -e RTSP_ROUTE="/live.sdp" -e RTSP_USERNAME="admin" -e RTSP_PASSWORD="12345" -e RTSP_AUTHENTICATION_METHOD="digest" -p 8554:8554 ullaakut/rtspatt - docker run -d --name="fake_camera_basic" -e RTSP_ROUTE="/live.sdp" -e RTSP_USERNAME="root" -e RTSP_PASSWORD="root" -e RTSP_AUTHENTICATION_METHOD="digest" -p 5554:5554 ullaakut/rtspatt @@ -46,6 +58,21 @@ script: - cat logs.txt - grep "Successful attack" logs.txt || exit 1 +after_success: +# You'll need to run `snapcraft export-login snap.login` and +# `travis encrypt-file snap.login --add` to add the key to the travis +# environment. +- test -n "$TRAVIS_TAG" && snapcraft login --with snap.login + +# calls goreleaser +deploy: +- provider: script + skip_cleanup: true + script: curl -sL https://git.io/goreleaser | bash + on: + tags: true + condition: $TRAVIS_OS_NAME = linux + notifications: email: recipients: diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e69de29