Autobuild snap (#3455)

This commit is contained in:
Alessio Treglia 2019-01-31 09:59:19 -08:00 committed by Jack Zampolin
parent f4cf45e17a
commit 0e1f61949e
3 changed files with 109 additions and 18 deletions

View File

@ -264,6 +264,52 @@ jobs:
make localnet-start
./scripts/localnet-blocks-test.sh 40 5 10 localhost
snap-edge:
working_directory: /home/circleci/.snap_workspace/src/github.com/cosmos/cosmos-sdk
machine: true
environment:
LC_ALL: C.UTF-8
LANG: C.UTF-8
GOPATH: /tmp/workspace
GOBIN: /tmp/workspace/bin
parallelism: 1
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
name: Install prerequitistes
command: |
sudo sh -c "echo '#!/bin/sh' > /usr/sbin/update-initramfs"
sudo sh -c "echo 'exit 0' >> /usr/sbin/update-initramfs"
sudo apt update -y &>/dev/null
sudo apt install -y build-essential snapd
sudo snap install snapcraft --edge --classic
- run:
name: prepping snap build
command: |
/snap/bin/snapcraft version
make snapcraft.yaml
- run:
name: build edge snap
command: /snap/bin/snapcraft
- run:
name: Create credentials file
command: |
echo '[login.ubuntu.com]' > credentials
echo "macaroon = $SNAPCRAFT_CREDENTIALS_MACAROON" >> credentials
echo "unbound_discharge = $SNAPCRAFT_CREDENTIALS_UNBOUND_DISCHARGE" >> credentials
echo "email = $SNAPCRAFT_CREDENTIALS_EMAIL" >> credentials
- run:
name: Authenticate snapcraft
command: /snap/bin/snapcraft login --with credentials
- run:
name: Push/release snap
command: /snap/bin/snapcraft push *.snap --release edge
- run:
name: Clean up credentials file
command: rm -vf credentials
deploy_docs:
<<: *docs_deploy
steps:
@ -384,6 +430,14 @@ workflows:
- localnet:
requires:
- setup_dependencies
- snap-edge:
requires:
- setup_dependencies
filters:
branches:
only:
- master
- develop
- upload_coverage:
requires:
- test_cover

51
snapcraft-full.yaml.in Normal file
View File

@ -0,0 +1,51 @@
name: gaia # you probably want to 'snapcraft register <name>'
# base: core18 # the base snap is the execution environment for this snap
version: '@VERSION@' # just for humans, typically '1.2+git' or '1.3.2'
summary: Gaia Daemon # 79 char long summary
description: |
This snap provides the Gaia daemon gaiad and the command line
tool gaiacli.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
apps:
gaiad:
command: bin/gaiad
plugs: [home,network,network-bind]
gaiacli:
command: bin/gaiacli
plugs: [home,network,network-bind]
parts:
gaia:
plugin: dump
source: ./
override-pull: |
rootdir=$(pwd)
gitroot=$(git rev-parse --show-toplevel)
cd ${gitroot} && git archive \
-o ${rootdir}/gaia-@VERSION@.tar.gz \
--format tar.gz -9 --prefix gaia-@VERSION@/ HEAD
cd ${rootdir}
tar xf gaia-@VERSION@.tar.gz ; rm -f gaia-@VERSION@.tar.gz
mkdir -p go/src/github.com/cosmos bin
mv gaia-@VERSION@/ go/src/github.com/cosmos/cosmos-sdk/
# Use the following instructions to build a package from a release.
# wget https://github.com/cosmos/cosmos-sdk/archive/v@VERSION@.tar.gz
# tar xvf v@VERSION@.tar.gz
# rm v@VERSION@.tar.gz
build-snaps: [go]
override-build: |
base=`pwd`
export GOPATH=`pwd`/go
export GOBIN=$GOPATH/bin
export PATH=$GOBIN:$PATH
cd $GOPATH/src/github.com/cosmos/cosmos-sdk
make tools
make vendor-deps
make install
mkdir $SNAPCRAFT_PART_INSTALL/bin
cp $GOPATH/bin/gaiad $SNAPCRAFT_PART_INSTALL/bin
cp $GOPATH/bin/gaiacli $SNAPCRAFT_PART_INSTALL/bin

View File

@ -21,15 +21,7 @@ parts:
plugin: dump
source: ./
override-pull: |
rootdir=$(pwd)
gitroot=$(git rev-parse --show-toplevel)
cd ${gitroot} && git archive \
-o ${rootdir}/gaia-@VERSION@.tar.gz \
--format tar.gz -9 --prefix gaia-@VERSION@/ HEAD
cd ${rootdir}
tar xvf gaia-@VERSION@.tar.gz ; rm -f gaia-@VERSION@.tar.gz
mkdir -p go/src/github.com/cosmos bin
mv gaia-@VERSION@/ go/src/github.com/cosmos/cosmos-sdk/
echo "Installing files from $GOBIN ..."
# Use the following instructions to build a package from a release.
# wget https://github.com/cosmos/cosmos-sdk/archive/v@VERSION@.tar.gz
@ -38,12 +30,6 @@ parts:
build-snaps: [go]
override-build: |
base=`pwd`
export GOPATH=`pwd`/go
cd $GOPATH/src/github.com/cosmos/cosmos-sdk
make tools
make vendor-deps
make install
mkdir $SNAPCRAFT_PART_INSTALL/bin
cp $GOPATH/bin/gaiad $SNAPCRAFT_PART_INSTALL/bin
cp $GOPATH/bin/gaiacli $SNAPCRAFT_PART_INSTALL/bin
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
cp $GOBIN/gaiad $SNAPCRAFT_PART_INSTALL/bin
cp $GOBIN/gaiacli $SNAPCRAFT_PART_INSTALL/bin