Skip to content

Commit

Permalink
Merge pull request #242 from elopio/test-snap-in-travis
Browse files Browse the repository at this point in the history
Move the snap deploy script to a separate file
  • Loading branch information
hsanjuan committed Nov 16, 2017
2 parents c8dd79b + 22c1d24 commit 2bc7aec
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -27,5 +27,5 @@ deploy:
branch: master
provider: script
script: docker run -v $(pwd):$(pwd) -t snapcore/snapcraft sh -c "apt update -qq
&& cd $(pwd) && for arch in amd64 i386 armhf arm64; do snapcraft snap --target-arch \$arch --output ipfs-cluser.snap && snapcraft push ipfs-cluster.snap --release edge && snapcraft clean; done"
&& cd $(pwd) && ./snap/snap-multiarch.sh"
skip_cleanup: true
15 changes: 15 additions & 0 deletions snap/snap-multiarch.sh
@@ -0,0 +1,15 @@
#!/bin/bash
#
# Build the ipfs-cluster snaps and push them to the store.

set -ev

snap() {
snapcraft clean
ARCH_TRIPLET=$1 TARGET_GOARCH=$2 snapcraft --target-arch $3
snapcraft push ipfs-cluster*$3.snap --release edge
}

snap x86_64-linux-gnu amd64 amd64
snap arm-linux-gnueabihf arm armhf
snap aarch64-linux-gnu arm64 arm64
7 changes: 4 additions & 3 deletions snap/snapcraft.yaml
Expand Up @@ -25,11 +25,12 @@ parts:
mkdir -p ../go/src/github.com/ipfs/ipfs-cluster
cp -R . ../go/src/github.com/ipfs/ipfs-cluster
build: |
env GOPATH=$(pwd)/../go make -C ../go/src/github.com/ipfs/ipfs-cluster install
env GOPATH=$(pwd)/../go CC=$ARCH_TRIPLET-gcc CXX=$ARCH_TRIPLET-g++ CGO_ENABLED=1 GOARCH=$TARGET_GOARCH make -C ../go/src/github.com/ipfs/ipfs-cluster install
install: |
mkdir $SNAPCRAFT_PART_INSTALL/bin
mv ../go/bin/ipfs-cluster-service $SNAPCRAFT_PART_INSTALL/bin/
mv ../go/bin/ipfs-cluster-ctl $SNAPCRAFT_PART_INSTALL/bin/
for file in $(find ../go/bin/ -type f); do
mv $file $SNAPCRAFT_PART_INSTALL/bin/
done
after: [go]
go:
source-tag: go1.9.2

0 comments on commit 2bc7aec

Please sign in to comment.