Skip to content

Commit

Permalink
circleci: add configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
billziss-gh committed May 15, 2017
1 parent 2022c66 commit 54ea358
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
version: 2

jobs:

build:
machine: true

environment:
PROJNAME: github.com/billziss-gh/cgofuse

working_directory: ~/.go_workspace/src/github.com/billziss-gh/cgofuse

steps:
- checkout

- run:
name: Build cgofuse image
command: docker build -t cgofuse .

- run:
name: Cross-compile cgofuse
command: |
go get -v github.com/karalabe/xgo
xgo \
--image=cgofuse \
--targets=darwin/386,darwin/amd64,linux/386,linux/amd64,windows/386,windows/amd64 \
--buildmode=archive \
./fuse
- run:
name: Prepare artifacts
command: |
mkdir -p /tmp/cgofuse.work/src/$PROJNAME/fuse
echo //go:binary-only-package >/tmp/cgofuse.work/src/$PROJNAME/fuse/host.go
echo package fuse >>/tmp/cgofuse.work/src/$PROJNAME/fuse/host.go
echo //go:binary-only-package >/tmp/cgofuse.work/src/$PROJNAME/fuse/fsop.go
echo package fuse >>/tmp/cgofuse.work/src/$PROJNAME/fuse/fsop.go
for f in fuse-*.[al]*; do
d=$(echo "$f" | sed 's/fuse-\([^-.]*\).*-\([^-.]*\)\..*/\1_\2/g')
mkdir -p /tmp/cgofuse.work/pkg/$d/$PROJNAME
cp "$f" /tmp/cgofuse.work/pkg/$d/$PROJNAME/fuse.a
done
mkdir -p /tmp/cgofuse.dist
GIT_DSC=$(git describe --long)
(cd /tmp/cgofuse.work && zip -rv - *) >/tmp/cgofuse.dist/cgofuse-$GIT_DSC.zip
- store_artifacts:
path: /tmp/cgofuse.dist

- deploy:
name: Make github release
command: |
if git describe --exact-match >/dev/null 2>&1; then
GIT_TAG=$(git describe --exact-match)
GIT_DSC=$(git describe --long)
go get -v github.com/aktau/github-release
github-release release \
--user "$CIRCLE_PROJECT_USERNAME" \
--repo "$CIRCLE_PROJECT_REPONAME" \
--tag $GIT_TAG \
--pre-release || true
github-release upload \
--user "$CIRCLE_PROJECT_USERNAME" \
--repo "$CIRCLE_PROJECT_REPONAME" \
--tag $GIT_TAG \
--file /tmp/cgofuse.dist/cgofuse-$GIT_DSC.zip \
--name cgofuse-${GIT_TAG:1}.zip \
--replace
fi

0 comments on commit 54ea358

Please sign in to comment.