Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CD pipeline #2

Merged
merged 23 commits into from
Dec 11, 2019
70 changes: 43 additions & 27 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- run:
name: syetem test
command: ./test
build:
build_library:
working_directory: /tmp/build
docker:
- image: rhikimochi/opencv-docker:v0.14
Expand All @@ -88,8 +88,7 @@ jobs:
working_directory: ~/build
machine: true
environment:
DOCKER_USER: lifullsetg # After publish, move to circle environment variable.
DOCKER_REPO: gazo-san
DOCKER_HUB_REPO: gazo-san
steps:
- checkout
- attach_workspace:
Expand All @@ -98,44 +97,61 @@ jobs:
name: Move library
command: mv /tmp/build/libimageDiffCalc.a ~/build/
- run:
name: Build image
command: docker build -t "$DOCKER_HUB_USER"/"$DOCKER_REPO":"${CIRCLE_TAG/v/}" .
# - run:
# name: Login docker hub
# command: docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_TOKEN"
# - run:
# name: Push image
# command: docker push "$DOCKER_HUB_USER"/"$DOCKER_REPO":"${CIRCLE_TAG/v/}"
# - run:
# name: Logout docker
# command: docker logout
name: Build and tagged image
command: |
docker build -t "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":"${CIRCLE_TAG/v/}" .
docker tag "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":"${CIRCLE_TAG/v/}" "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":latest
- run:
name: Login docker hub
command: docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_TOKEN"
- run:
name: Push image
command: |
docker push "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":"${CIRCLE_TAG/v/}"
docker push "$DOCKER_HUB_USER"/"$DOCKER_HUB_REPO":latest
- run:
name: Logout docker
command: docker logout
deploy_library:
working_directory: ~/deploy
docker:
- image: circleci/node:stretch
environment:
OWNER: lifull-dev
REPO: Gazo-san
UPLOAD_FILE: /tmp/build/libimageDiffCalc.a
steps:
- attach_workspace:
at: /tmp/build
- run: echo "release process"
- run:
name: Store upload url and upload assets
command: |
UPLOAD_URL_RAW=$(curl -X GET -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$OWNER/$REPO/releases/tags/$CIRCLE_TAG" \
| jq '.upload_url')
UPLOAD_URL=$(echo ${UPLOAD_URL_RAW%\{*} | tr -d \")
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: $(file -b --mime-type $UPLOAD_FILE)" \
--data-binary @$UPLOAD_FILE \
"$UPLOAD_URL?name=$(basename $UPLOAD_FILE)"
workflows:
version: 2
build-test-deploy:
test:
jobs:
- google_test
- build
- deploy_library:
requires:
- build
filters:
build-deploy:
jobs:
- build_library:
filters: &filters
tags:
only: /^v[0-9]{1,}(\.[0-9]{1,}){2}$/
branches:
ignore: /.*/
- deploy_library:
requires:
- build_library
filters: *filters
- build_and_deploy_image:
requires:
- build
filters:
tags:
only: /^v[0-9]{1,}(\.[0-9]{1,}){2}$/
branches:
ignore: /.*/
- build_library
filters: *filters
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,18 @@ Each color stands for:


## How to build Gazo-san

### Ubuntu

1. Download static link library file

```bash
curl -OLsS https://github.com/lifull-dev/Gazo-san/releases/download/{VERSION}/libimageDiffCalc.a
```
wait for upload
```

2. Compile main.cpp
```

```bash
g++ -std=c++11 ./src/main.cpp -L./ -limageDiffCalc -o gazosan `pkg-config --libs opencv`
```

Expand Down