Skip to content

Commit 1626ce3

Browse files
authored
Merge pull request #2 from hikimochi/fix/circleci_config
CD pipeline
2 parents 0bc73be + 02dcd62 commit 1626ce3

File tree

2 files changed

+52
-30
lines changed

2 files changed

+52
-30
lines changed

.circleci/config.yml

+43-27
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
- run:
6868
name: syetem test
6969
command: ./test
70-
build:
70+
build_library:
7171
working_directory: /tmp/build
7272
docker:
7373
- image: rhikimochi/opencv-docker:v0.14
@@ -88,8 +88,7 @@ jobs:
8888
working_directory: ~/build
8989
machine: true
9090
environment:
91-
DOCKER_USER: lifullsetg # After publish, move to circle environment variable.
92-
DOCKER_REPO: gazo-san
91+
DOCKER_HUB_REPO: gazo-san
9392
steps:
9493
- checkout
9594
- attach_workspace:
@@ -98,44 +97,61 @@ jobs:
9897
name: Move library
9998
command: mv /tmp/build/libimageDiffCalc.a ~/build/
10099
- run:
101-
name: Build image
102-
command: docker build -t "$DOCKER_HUB_USER"/"$DOCKER_REPO":"${CIRCLE_TAG/v/}" .
103-
# - run:
104-
# name: Login docker hub
105-
# command: docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_TOKEN"
106-
# - run:
107-
# name: Push image
108-
# command: docker push "$DOCKER_HUB_USER"/"$DOCKER_REPO":"${CIRCLE_TAG/v/}"
109-
# - run:
110-
# name: Logout docker
111-
# command: docker logout
100+
name: Build and tagged image
101+
command: |
102+
docker build -t "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":"${CIRCLE_TAG/v/}" .
103+
docker tag "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":"${CIRCLE_TAG/v/}" "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":latest
104+
- run:
105+
name: Login docker hub
106+
command: docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_TOKEN"
107+
- run:
108+
name: Push image
109+
command: |
110+
docker push "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":"${CIRCLE_TAG/v/}"
111+
docker push "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":latest
112+
- run:
113+
name: Logout docker
114+
command: docker logout
112115
deploy_library:
113116
working_directory: ~/deploy
114117
docker:
115118
- image: circleci/node:stretch
119+
environment:
120+
OWNER: lifull-dev
121+
REPO: Gazo-san
122+
UPLOAD_FILE: /tmp/build/libimageDiffCalc.a
116123
steps:
117124
- attach_workspace:
118125
at: /tmp/build
119-
- run: echo "release process"
126+
- run:
127+
name: Store upload url and upload assets
128+
command: |
129+
UPLOAD_URL_RAW=$(curl -X GET -H "Authorization: token $GITHUB_TOKEN" \
130+
"https://api.github.com/repos/$OWNER/$REPO/releases/tags/$CIRCLE_TAG" \
131+
| jq '.upload_url')
132+
UPLOAD_URL=$(echo ${UPLOAD_URL_RAW%\{*} | tr -d \")
133+
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
134+
-H "Content-Type: $(file -b --mime-type $UPLOAD_FILE)" \
135+
--data-binary @$UPLOAD_FILE \
136+
"$UPLOAD_URL?name=$(basename $UPLOAD_FILE)"
120137
workflows:
121138
version: 2
122-
build-test-deploy:
139+
test:
123140
jobs:
124141
- google_test
125-
- build
126-
- deploy_library:
127-
requires:
128-
- build
129-
filters:
142+
build-deploy:
143+
jobs:
144+
- build_library:
145+
filters: &filters
130146
tags:
131147
only: /^v[0-9]{1,}(\.[0-9]{1,}){2}$/
132148
branches:
133149
ignore: /.*/
150+
- deploy_library:
151+
requires:
152+
- build_library
153+
filters: *filters
134154
- build_and_deploy_image:
135155
requires:
136-
- build
137-
filters:
138-
tags:
139-
only: /^v[0-9]{1,}(\.[0-9]{1,}){2}$/
140-
branches:
141-
ignore: /.*/
156+
- build_library
157+
filters: *filters

README.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,18 @@ Each color stands for:
5454

5555

5656
## How to build Gazo-san
57+
58+
### Ubuntu
59+
5760
1. Download static link library file
61+
62+
```bash
63+
curl -OLsS https://github.com/lifull-dev/Gazo-san/releases/download/{VERSION}/libimageDiffCalc.a
5864
```
59-
wait for upload
60-
```
65+
6166
2. Compile main.cpp
62-
```
67+
68+
```bash
6369
g++ -std=c++11 ./src/main.cpp -L./ -limageDiffCalc -o gazosan `pkg-config --libs opencv`
6470
```
6571

0 commit comments

Comments
 (0)