.gitlab-ci.yml 1.78 KB
Newer Older
1
2
variables:
  IMAGE_NAME: funkwhale/funkwhale
3
  IMAGE: $IMAGE_NAME:$CI_COMMIT_REF_NAME
4
5
6
7
  IMAGE_LATEST: $IMAGE_NAME:latest



Eliot Berriot's avatar
Attempt    
Eliot Berriot committed
8
9
stages:
  - test
Eliot Berriot's avatar
Eliot Berriot committed
10
  - build
11
  - deploy
Eliot Berriot's avatar
Eliot Berriot committed
12
13
14

test_api:
  stage: test
15
  image: funkwhale/funkwhale:base
Eliot Berriot's avatar
Eliot Berriot committed
16
  before_script:
17
18
    - cd api
    - pip install -r requirements/test.txt
Eliot Berriot's avatar
Eliot Berriot committed
19
  script:
20
    - pytest
Eliot Berriot's avatar
Eliot Berriot committed
21
22

  tags:
23
    - docker
Eliot Berriot's avatar
Eliot Berriot committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

build_front:
  stage: build
  image: node:6-alpine
  before_script:
    - cd front

  script:
    - npm install
    - npm run build
  cache:
    key: "$CI_COMMIT_REF_NAME"
    paths:
      - front/node_modules
  artifacts:
    name: "front_${CI_COMMIT_REF_NAME}"
    paths:
      - front/dist/
  only:
43
    - tags
Eliot Berriot's avatar
Eliot Berriot committed
44
45
46
47
    - master
    - develop
  tags:
    - docker
48

49

50
pages:
Eliot Berriot's avatar
Attempt    
Eliot Berriot committed
51
  stage: test
52
53
54
55
56
57
58
59
  image: alpine
  before_script:
    - cd docs
  script:
    - apk --no-cache add py2-pip python-dev
    - pip install sphinx
    - apk --no-cache add make
    - make html
Eliot Berriot's avatar
Attempt    
Eliot Berriot committed
60
    - mv _build/html/ ../public
61
62
63
64
  artifacts:
    paths:
      - public
  only:
65
    - develop
Eliot Berriot's avatar
Eliot Berriot committed
66
67
  tags:
    - docker
68

69
docker_develop:
70
  stage: deploy
71
  before_script:
72
    - docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
73
    - cp -r front/dist api/frontend
74
75
    - cd api
  script:
76
77
    - docker build -t $IMAGE .
    - docker push $IMAGE
78
79
  only:
    - develop
80
81
82
  tags:
    - dind

83
84
85
86
87
88
89
90
build_api:
  # Simply publish a zip containing api/ directory
  stage: deploy
  image: busybox
  artifacts:
    name: "api_${CI_COMMIT_REF_NAME}"
    paths:
      - api
Eliot Berriot's avatar
Eliot Berriot committed
91
  script: echo Done!
92
93
94
95
96
97
  only:
    - tags
    - master
    - develop


98
99
100
101
docker_release:
  stage: deploy
  before_script:
    - docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
102
    - cp -r front/dist api/frontend
103
104
105
106
107
108
    - cd api
  script:
    - docker build -t $IMAGE -t $IMAGE_LATEST .
    - docker push $IMAGE
    - docker push $IMAGE_LATEST
  only:
109
    - tags
110
111
  tags:
    - dind