diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2021-07-24 17:54:17 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2021-07-24 17:54:17 -0700 |
| commit | 6988a0571d5d37ea0f38ee3e4066533158f608bc (patch) | |
| tree | 172010de54ea7e732d7daa836db659021dc8a933 /.circleci | |
Initial squashed commit
Diffstat (limited to '.circleci')
| -rw-r--r-- | .circleci/config.yml | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..4ac6313 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,86 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference +version: 2.1 +jobs: + build: + working_directory: ~/repo + docker: + - image: cimg/go:1.16.6 + steps: + - checkout +# - restore_cache: +# keys: +# - go-mod-v4-{{ checksum "go.sum" }} + - run: + name: Install Dependencies + command: go mod download +# - save_cache: +# key: go-mod-v4-{{ checksum "go.sum" }} +# paths: +# - "/go/pkg/mod" + - run: + name: Run tests + command: | + mkdir -p /tmp/test-reports + gotestsum --junitfile /tmp/test-reports/unit-tests.xml + - store_test_results: + path: /tmp/test-reports + + deploy: + docker: + - image: cimg/go:1.16.6 +# working_directory: /go/src/github.com/jhalter/mobius + steps: + - checkout + - run: go get -u github.com/mitchellh/gox + - run: go get -u github.com/tcnksm/ghr + - run: go get -u github.com/stevenmatthewt/semantics + - run: + name: cross compile + command: | + mkdir dist + mkdir dist/mobius_server_linux_amd64 + mkdir dist/mobius_server_darwin_amd64 + mkdir dist/mobius_server_linux_arm + + cd server + + cp -r mobius/config ../dist/mobius_server_linux_amd64/config + cp -r mobius/config ../dist/mobius_server_darwin_amd64/config + cp -r mobius/config ../dist/mobius_server_linux_arm/config + + gox -os="linux" -arch="amd64" -output="../dist/mobius_server_linux_amd64/mobius_server" + gox -os="darwin" -arch="amd64" -output="../dist/mobius_server_darwin_amd64/mobius_server" + gox -os="linux" -arch="arm" -output="../dist/mobius_server_linux_arm/mobius_server" + + cd ../client + gox -os="linux" -arch="amd64" -output="../dist/mobius_client_linux_amd64/mobius_client" + gox -os="darwin" -arch="amd64" -output="../dist/mobius_client_darwin_amd64/mobius_client" + cd ../dist + + tar -zcvf mobius_server_linux_amd64.tar.gz mobius_server_linux_amd64 + tar -zcvf mobius_server_darwin_amd64.tar.gz mobius_server_darwin_amd64 + tar -zcvf mobius_server_linux_arm.tar.gz mobius_server_linux_arm + tar -zcvf mobius_client_linux_amd64.tar.gz mobius_client_linux_amd64 + tar -zcvf mobius_client_darwin_amd64.tar.gz mobius_client_darwin_amd64 + - add_ssh_keys + - run: + name: create release + command: | + tag=$(semantics --output-tag) + if [ "$tag" ]; then + ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME --replace $tag dist/ + else + echo "The commit message(s) did not indicate a major/minor/patch version." + fi + +workflows: + version: 2 + build-deploy: + jobs: + - build + - deploy: + requires: + - build + filters: + branches: + only: master |