Skip to content

Commit

Permalink
Switch to use GitLab CI for ARM builds
Browse files Browse the repository at this point in the history
  • Loading branch information
ernoaapa committed May 9, 2018
1 parent 945130c commit 63e110d
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
mv overalls.coverprofile coverage.txt
bash <(curl -s https://codecov.io/bash)
- store_artifacts:
path: coverage.txt
destination: coverage.txt

build:
<<: *defaults
steps:
Expand All @@ -31,6 +35,9 @@ jobs:

- run: goreleaser --snapshot

- store_artifacts:
path: dist

publish:
<<: *defaults
steps:
Expand Down
125 changes: 125 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
image: golang:1.10-stretch

variables:
REPO_NAME: github.com/ernoaapa/eliot

stages:
- test
- build
- publish

before_script:
- go version
# Move project under $GOPATH
- mkdir -p $GOPATH/src/$(dirname $REPO_NAME)
- ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME
- cd $GOPATH/src/$REPO_NAME
# Configure Docker
- ./build/install-docker.sh
- echo $DOCKER_PASS | docker login --username $DOCKER_USER --password-stdin

# BUILD
build:
stage: build
tags:
- arm64
script:
- ./build/install-build-tools.sh
- goreleaser --snapshot
artifacts:
paths:
- dist/


# TEST
.test: &test
stage: test
script:
- "! go fmt -l pkg cmd 2>&1 | read"
- go vet ./...
- go test -v ./...

test:arm64:
<<: *test
tags:
- arm64

test:armv7:
<<: *test
tags:
- armv7

# PUBLISH
.publish: &publish
stage: publish
only:
- tags
script:
- ./build/install-build-tools.sh
- goreleaser --rm-dist
- .circleci/scripts/push-docker-manifest.sh $(git describe --tags --always --dirty)
- |
for package in dist/eliot_*.deb; do
pkgcloud-push ernoaapa/eliot/raspbian/stretch $package
done
artifacts:
paths:
- dist/

publish:arm64:
<<: *publish
tags:
- arm64
variables:
GOARCH: arm64

publish:armv6:
<<: *publish
tags:
- armv6
variables:
GOARCH: arm
GOARM: "6"

publish:armv7:
<<: *publish
tags:
- armv7
variables:
GOARCH: arm
GOARM: "7"


# PUBLISH DEBS
.publish-debs: &publish-debs
stage: publish
script:
- ./build/install-build-tools.sh
- apt-get update && apt-get install -y btrfs-tools libseccomp-dev
- ./deps/publish-all.sh
artifacts:
paths:
- dist/

publish-debs:arm64:
<<: *publish-debs
tags:
- arm64
variables:
GOARCH: arm64

publish-debs:armv6:
<<: *publish-debs
tags:
- armv6
variables:
GOARCH: arm
GOARM: "6"

publish-debs:armv7:
<<: *publish-debs
tags:
- armv7
variables:
GOARCH: arm
GOARM: "7"
17 changes: 8 additions & 9 deletions build/install-build-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

set -eu

echo "GOPATH: $GOPATH"

rm -rf $GOPATH/src/github.com/goreleaser/nfpm
echo "GOPATH: $GOPATH (PATH: $PATH)"

go get -u github.com/goreleaser/goreleaser
goreleaser --version

go get -u github.com/goreleaser/nfpm
# Switch to fixed fork
cd $GOPATH/src/github.com/goreleaser/nfpm
git remote add ernoaapa https://github.com/ernoaapa/nfpm.git || true
git fetch ernoaapa
git checkout ernoaapa/fix-arm-architecture
go get ./...
GOBIN=$GOPATH/bin go install ./cmd/nfpm/
cd -
nfpm --version

go get -u github.com/estesp/manifest-tool
manifest-tool --version

go get github.com/estesp/manifest-tool
go get github.com/mlafeldt/pkgcloud/...
go get -u github.com/mlafeldt/pkgcloud/...
21 changes: 21 additions & 0 deletions build/install-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

set -eu

apt-get update && apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository \
"deb https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"

apt-get update && apt-get install -y docker-ce

echo "Installed docker:"
docker version

0 comments on commit 63e110d

Please sign in to comment.