|
| 1 | +version: 2 |
| 2 | +jobs: |
| 3 | + frontend: |
| 4 | + docker: |
| 5 | + - image: circleci/node:10.8.0 |
| 6 | + steps: |
| 7 | + - checkout |
| 8 | + - run: |
| 9 | + name: "Install dependencies" |
| 10 | + command: yarn install |
| 11 | + - run: |
| 12 | + name: "Build" |
| 13 | + command: yarn run build |
| 14 | + - persist_to_workspace: |
| 15 | + root: . |
| 16 | + paths: |
| 17 | + - dist/* |
| 18 | + |
| 19 | + backend: |
| 20 | + docker: |
| 21 | + - image: circleci/golang:1.10 |
| 22 | + working_directory: /go/src/github.com/RoboCup-SSL/ssl-status-board |
| 23 | + steps: |
| 24 | + - checkout |
| 25 | + - attach_workspace: |
| 26 | + at: . |
| 27 | + - run: go get -v -t -d ./... |
| 28 | + - run: go test -v -covermode=count -coverprofile=count.out ./... |
| 29 | + - run: go tool cover -html=count.out -o coverage.html |
| 30 | + - run: |
| 31 | + working_directory: cmd/ssl-status-borad |
| 32 | + command: | |
| 33 | + go get -v github.com/gobuffalo/packr/packr |
| 34 | + GOOS=linux GOARCH=amd64 packr build -o ../../release/ssl-status-board_linux_amd64 |
| 35 | + GOOS=linux GOARCH=arm packr build -o ../../release/ssl-status-board_linux_arm |
| 36 | + GOOS=darwin GOARCH=amd64 packr build -o ../../release/ssl-status-board_darwin_amd64 |
| 37 | + GOOS=windows GOARCH=amd64 packr build -o ../../release/ssl-status-board_windows_amd64.exe |
| 38 | + - persist_to_workspace: |
| 39 | + root: . |
| 40 | + paths: |
| 41 | + - release/* |
| 42 | + - store_artifacts: |
| 43 | + path: coverage.html |
| 44 | + destination: coverage |
| 45 | + |
| 46 | + publish-github-release: |
| 47 | + docker: |
| 48 | + - image: circleci/golang:1.10 |
| 49 | + steps: |
| 50 | + - attach_workspace: |
| 51 | + at: . |
| 52 | + - run: |
| 53 | + name: "Prepare artifacts" |
| 54 | + working_directory: release |
| 55 | + command: | |
| 56 | + mv ssl-status-board_linux_amd64 ssl-status-board_${CIRCLE_TAG}_linux_amd64 |
| 57 | + mv ssl-status-board_linux_arm ssl-status-board_${CIRCLE_TAG}_linux_arm |
| 58 | + mv ssl-status-board_darwin_amd64 ssl-status-board_${CIRCLE_TAG}_darwin_amd64 |
| 59 | + mv ssl-status-board_windows_amd64.exe ssl-status-board_${CIRCLE_TAG}_windows_amd64.exe |
| 60 | + - run: |
| 61 | + name: "Publish Release on GitHub" |
| 62 | + command: | |
| 63 | + go get github.com/tcnksm/ghr |
| 64 | + ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./release/ |
| 65 | +
|
| 66 | +workflows: |
| 67 | + version: 2 |
| 68 | + main: |
| 69 | + jobs: |
| 70 | + - frontend: |
| 71 | + filters: |
| 72 | + tags: |
| 73 | + only: /.*/ |
| 74 | + - backend: |
| 75 | + requires: |
| 76 | + - frontend |
| 77 | + filters: |
| 78 | + tags: |
| 79 | + only: /.*/ |
| 80 | + - publish-github-release: |
| 81 | + requires: |
| 82 | + - backend |
| 83 | + filters: |
| 84 | + branches: |
| 85 | + ignore: /.*/ |
| 86 | + tags: |
| 87 | + only: /^v.*/ |
0 commit comments