.gitlab-ci.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. image: golang:latest
  2. #before_script:
  3. stages:
  4. - test
  5. - docker-push
  6. - deploy-staging
  7. test-server:
  8. stage: test
  9. script:
  10. - mkdir /go/src/cwtch.im
  11. - ln -s /builds/${CI_PROJECT_NAMESPACE}/cwtch /go/src/cwtch.im/cwtch
  12. - cd /go/src/cwtch.im/cwtch/server/app/
  13. - go get
  14. - go tool vet -composites=false -shadow=true *.go
  15. - go test
  16. test-client:
  17. stage: test
  18. script:
  19. - mkdir /go/src/cwtch.im
  20. - ln -s /builds/${CI_PROJECT_NAMESPACE}/cwtch /go/src/cwtch.im/cwtch
  21. - cd /go/src/cwtch.im/cwtch/app/cli/
  22. - go get
  23. - go tool vet -composites=false -shadow=true *.go
  24. - go test
  25. # We don't really care about the client here but it's useful to know what's
  26. # happening on t'other side of the coin
  27. allow_failure: true
  28. gitlab-registry:
  29. stage: docker-push
  30. image: docker:latest
  31. services:
  32. - docker:dind
  33. tags:
  34. script:
  35. - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN ${CI_REGISTRY}
  36. - docker build -t ${CI_REGISTRY_IMAGE}:latest -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA:0:8} .
  37. - docker push ${CI_REGISTRY_IMAGE}:latest
  38. - docker push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA:0:8}
  39. dependencies:
  40. - test-server
  41. docker-hub:
  42. stage: docker-push
  43. image: docker:latest
  44. services:
  45. - docker:dind
  46. tags:
  47. script:
  48. - docker login -u ${DOCKER_HUB_ID} -p ${DOCKER_HUB_PASSWORD} registry.hub.docker.com
  49. - docker build -t registry.hub.docker.com/${DOCKER_HUB_ID}/cwtch:latest -t registry.hub.docker.com/${DOCKER_HUB_ID}/cwtch:${CI_COMMIT_SHA:0:8} .
  50. - docker push registry.hub.docker.com/${DOCKER_HUB_ID}/cwtch:latest
  51. - docker push registry.hub.docker.com/${DOCKER_HUB_ID}/cwtch:${CI_COMMIT_SHA:0:8}
  52. dependencies:
  53. - test-server