-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
76 lines (70 loc) · 1.74 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
image: golang:1.19-buster
stages:
- build
- test
- deploy
services:
- docker:20.10.19-dind
# build the ifsc binary
build_ifsc:
stage: build
script:
- sh build.sh
- cp openapi.yaml public/
artifacts:
paths:
- public
only:
changes:
- Dockerfile
- cmd/**/*.go
- ./*.{sh,go,yml}
# check whether all cli commands are working
cli_api_tests:
stage: test
needs: ["build_ifsc"]
script:
- apt update && apt install -y curl
- cd public/linux
- chmod +x ifsc
- ./ifsc index
- ./ifsc check KARB0000001
- ./ifsc search axis karol
# REST API tests
- ./ifsc server &
- curl -f http://localhost:9000/HDFC0CAGSBK
- curl -f http://localhost:9000/search?q=hitech%20city
only:
changes:
- Dockerfile
- cmd/**/*.go
- ./*.{sh,go,yml}
# build the docker image & push to the dockerhub
docker_image:
image: docker:20.10.19
stage: deploy
script:
- docker login -u kskarthik -p $DOCKERHUB_TOKEN
- docker build -t kskarthik/ifsc:$CI_COMMIT_TAG --build-arg IFSC_VERSION=$IFSC_VERSION .
- docker tag kskarthik/ifsc:$CI_COMMIT_TAG kskarthik/ifsc:latest
- docker push kskarthik/ifsc:latest
- docker push kskarthik/ifsc:$CI_COMMIT_TAG
only:
- tags
# deploy the build_ifsc job artifcats gitlab pages when there is a release
pages:
stage: deploy
image: busybox:latest
variables:
swagger_version: 5.9.1
script:
# download swagger ui & mv to public dir
- wget https://github.com/swagger-api/swagger-ui/archive/refs/tags/v$swagger_version.tar.gz
- tar -xf v$swagger_version.tar.gz
- mv swagger-ui-$swagger_version/dist/* public/
- mv swagger-initializer.js public/
artifacts:
paths:
- public
only:
- tags