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 # Here we build the billziss/xgo-cgofuse image for testing. # An alternative would be to just `docker pull billziss/xgo-cgofuse`. - run: name: Build xgo-cgofuse image command: docker build -t billziss/xgo-cgofuse . - run: name: Cross-compile cgofuse command: | go get -v github.com/karalabe/xgo xgo \ --image=billziss/xgo-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 false && [[ $(git describe --exact-match 2>/dev/null) == v* ]]; 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