]>
Commit | Line | Data |
---|---|---|
6988a057 JH |
1 | # Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference |
2 | version: 2.1 | |
3 | jobs: | |
4 | build: | |
5 | working_directory: ~/repo | |
6 | docker: | |
7 | - image: cimg/go:1.16.6 | |
8 | steps: | |
9 | - checkout | |
10 | # - restore_cache: | |
11 | # keys: | |
12 | # - go-mod-v4-{{ checksum "go.sum" }} | |
13 | - run: | |
14 | name: Install Dependencies | |
15 | command: go mod download | |
16 | # - save_cache: | |
17 | # key: go-mod-v4-{{ checksum "go.sum" }} | |
18 | # paths: | |
19 | # - "/go/pkg/mod" | |
20 | - run: | |
21 | name: Run tests | |
22 | command: | | |
23 | mkdir -p /tmp/test-reports | |
24 | gotestsum --junitfile /tmp/test-reports/unit-tests.xml | |
25 | - store_test_results: | |
26 | path: /tmp/test-reports | |
27 | ||
28 | deploy: | |
29 | docker: | |
30 | - image: cimg/go:1.16.6 | |
31 | # working_directory: /go/src/github.com/jhalter/mobius | |
32 | steps: | |
33 | - checkout | |
34 | - run: go get -u github.com/mitchellh/gox | |
35 | - run: go get -u github.com/tcnksm/ghr | |
36 | - run: go get -u github.com/stevenmatthewt/semantics | |
37 | - run: | |
38 | name: cross compile | |
39 | command: | | |
6593d0c6 | 40 | make build-win-amd64-server |
e6fdbcee | 41 | |
6988a057 JH |
42 | mkdir dist/mobius_server_linux_amd64 |
43 | mkdir dist/mobius_server_darwin_amd64 | |
44 | mkdir dist/mobius_server_linux_arm | |
45 | ||
d301539b | 46 | cd cmd/mobius-hotline-server |
6988a057 | 47 | |
0c0b2680 JH |
48 | cp -r mobius/config ../../dist/mobius_server_linux_amd64/config |
49 | cp -r mobius/config ../../dist/mobius_server_darwin_amd64/config | |
50 | cp -r mobius/config ../../dist/mobius_server_linux_arm/config | |
6988a057 | 51 | |
0c0b2680 JH |
52 | gox -os="linux" -arch="amd64" -output="../../dist/mobius_server_linux_amd64/mobius_server" |
53 | gox -os="darwin" -arch="amd64" -output="../../dist/mobius_server_darwin_amd64/mobius_server" | |
54 | gox -os="linux" -arch="arm" -output="../../dist/mobius_server_linux_arm/mobius_server" | |
6988a057 | 55 | |
d301539b | 56 | cd ../mobius-hotline-client |
0c0b2680 JH |
57 | gox -os="linux" -arch="amd64" -output="../../dist/mobius_client_linux_amd64/mobius_client" |
58 | gox -os="darwin" -arch="amd64" -output="../../dist/mobius_client_darwin_amd64/mobius_client" | |
6988a057 | 59 | |
0c0b2680 | 60 | cd ../../dist |
6988a057 JH |
61 | tar -zcvf mobius_server_linux_amd64.tar.gz mobius_server_linux_amd64 |
62 | tar -zcvf mobius_server_darwin_amd64.tar.gz mobius_server_darwin_amd64 | |
63 | tar -zcvf mobius_server_linux_arm.tar.gz mobius_server_linux_arm | |
4f013cac | 64 | |
6988a057 JH |
65 | tar -zcvf mobius_client_linux_amd64.tar.gz mobius_client_linux_amd64 |
66 | tar -zcvf mobius_client_darwin_amd64.tar.gz mobius_client_darwin_amd64 | |
67 | - add_ssh_keys | |
68 | - run: | |
69 | name: create release | |
70 | command: | | |
71 | tag=$(semantics --output-tag) | |
72 | if [ "$tag" ]; then | |
73 | ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME --replace $tag dist/ | |
74 | else | |
75 | echo "The commit message(s) did not indicate a major/minor/patch version." | |
76 | fi | |
77 | ||
78 | workflows: | |
79 | version: 2 | |
80 | build-deploy: | |
81 | jobs: | |
82 | - build | |
83 | - deploy: | |
84 | requires: | |
85 | - build | |
86 | filters: | |
87 | branches: | |
88 | only: master |