Added snapcraft.yaml to build [snap](https://snapcraft.io/).
This commit is contained in:
Michael Royal 2019-10-16 15:58:16 -07:00 committed by Pankaj Garg
parent 912915d5dc
commit d8bb7f5796

53
snap/snapcraft.yaml Normal file
View file

@ -0,0 +1,53 @@
name: ethr
summary: Network Performance Measurement Tool.
description: Ethr is a Network Performance Measurement Tool for TCP, UDP & HTTP.
confinement: devmode
base: core18
architectures:
- build-on: i386
- build-on: amd64
- build-on: armhf
- build-on: arm64
apps:
ethr:
command: bin/ethr
plugs:
- home
- network
- removable-media
- docker
parts:
ethr:
plugin: go
source: https://github.com/microsoft/ethr.git
source-type: git
override-pull: |
git clone https://github.com/microsoft/ethr.git src/github.com/microsoft/ethr
cd src/github.com/microsoft/ethr
last_committed_tag="$(git describe --tags --abbrev=0)"
last_committed_tag_ver="$(echo ${last_committed_tag} | sed 's/v//')"
last_released_tag="$(snap info $SNAPCRAFT_PROJECT_NAME | awk '$1 == "beta:" { print $2 }')"
# If the latest tag from the upstream project has not been released to
# beta, build that tag instead of master.
if [ "${last_committed_tag_ver}" != "${last_released_tag}" ]; then
git fetch
git checkout "${last_committed_tag}"
fi
snapcraftctl set-version "$(git describe --tags | sed 's/v//')"
override-build: |
export GOPATH=$PWD
cd src/github.com/microsoft/ethr
env CGO_ENABLED=0 GOOS=linux \
go build --ldflags "-s -w \
-X 'github.com/microsoft/ethr/version.GitCommit=$(git rev-list -1 HEAD)' \
-X 'github.com/microsoft/ethr/version.Version=$(git describe --tags --abbrev=0)'" \
-a -installsuffix cgo -o $SNAPCRAFT_PART_INSTALL/bin/ethr
build-snaps:
- go
build-packages:
- git
- sed