.gitlab-ci.yml 1.82 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
21
22
  variables:
    DATABASE_URL: "sqlite://"
Eliot Berriot's avatar
Eliot Berriot committed
23
24

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

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:
45
    - tags
Eliot Berriot's avatar
Eliot Berriot committed
46
47
48
49
    - master
    - develop
  tags:
    - docker
50

51

52
pages:
Eliot Berriot's avatar
Attempt    
Eliot Berriot committed
53
  stage: test
54
55
56
57
58
59
60
61
  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
62
    - mv _build/html/ ../public
63
64
65
66
  artifacts:
    paths:
      - public
  only:
67
    - develop
Eliot Berriot's avatar
Eliot Berriot committed
68
69
  tags:
    - docker
70

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

85
86
87
88
89
90
91
92
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
93
  script: echo Done!
94
95
96
97
98
99
  only:
    - tags
    - master
    - develop


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