.gitlab-ci.yml 4.09 KB
Newer Older
1
image: node:8-stretch
2 3

cache:
4
  key: km
5 6
  paths:
  - node_modules/
7
  - bin/
8
  - react_client/node_modules/
9 10

before_script:
11
  - rm -f /usr/local/bin/yarn
12
  - rm -f /usr/local/bin/yarnpkg
13
  - npm install -g pkg@4.2.6 yarn apidoc
14

15
stages:
16
  - test
17
  - build
18
  - package
19 20
  - deploy

21 22 23
test:
  stage: test
  script:
24
    - apt-get update -qq && apt-get install -y -qq ffmpeg
25
    - yarn install --check-files --force
26
    - touch mpv
27
    - echo "BinPlayerLinux=mpv" >>config.ini
28 29 30
    - mkdir -p /builds/karaokemugen/karaokemugen-app/app/data
    - cp -R samples/* /builds/karaokemugen/karaokemugen-app/app/data/
    - export LANG=en_US
31
    - node --version
32
    - yarn start --debug --test &disown
33
    - bash test/run.sh
34
  only:
35
    - master
36
    - next
37
    - tags
38

39 40 41 42 43 44 45
build:
  stage: build
  artifacts:
    expire_in: 1 day
    paths:
      - dist/
  script:
46
    - npm install -g modclean
47
    - yarn build
48
    - yarn install --production
49
    - cd node_modules
50 51
    - find -name *.node -delete
    - modclean -r
52 53 54 55 56 57
  only:
    - master
    - next
    - tags

pkg_win:
58
  stage: package
59 60 61 62 63 64 65 66
  dependencies:
    - build
  artifacts:
    name: "$CI_COMMIT_REF_NAME-win"
    expire_in: 1 day
    paths:
      - bin/
  script:
67
    - mkdir -p bin
68
    - pkg . -d --targets node8-win-x64 --out-path bin 
69 70 71 72 73 74
  only:
    - master
    - next
    - tags

pkg_osx:
75
  stage: package
76 77 78 79 80 81 82
  dependencies:
    - build
  artifacts:
    expire_in: 1 day
    paths:
      - bin/
  script:
83
    - mkdir -p bin
84
    - pkg . -d --targets node8-macos-x64 --out-path bin 
85 86 87 88 89 90
  only:
    - master
    - next
    - tags

deploy_win:
91
  stage: deploy
92 93
  dependencies:
    - pkg_win
94
  script:
95
    - apt-get update -qq && apt-get install -y -qq lftp zip  
96 97
    - mkdir build_win
    - cd build_win
98
    - wget http://mugen.karaokes.moe/downloads/dist_win.tar.gz
99 100
    - tar xvzf dist_win.tar.gz
    - rm dist_win.tar.gz
101 102 103 104 105 106
    - mkdir -p app/jingles
    - cd app/jingles
    - wget https://lab.shelter.moe/karaokemugen/jingles/repository/master/archive.tar
    - tar xvf archive.tar
    - mv -f jingles-master*/* .
    - rm -Rf jingles-master*    
107
    - rm -f archive.tar
108
    - cd ../..
109
    - cp -f ../bin/karaokemugen-app.exe KaraokeMugen.exe
Guillaume Lebigot committed
110
    - cp -f ../config.ini.sample .
111
    - zip -r KaraokeMugen-$CI_COMMIT_REF_NAME-win64.zip *    
112
    - cd ../updater_info
113 114
    - export RELFILE=`bash _ciPrepareInfoFiles.sh win32`
    - cd ..
115
    - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; cd site/downloads; put build_win/KaraokeMugen-$CI_COMMIT_REF_NAME-win64.zip ; put updater_info/$RELFILE"    
116 117 118 119
  only:
    - master
    - next
    - tags
120

121
latest_tag:
122
  stage: deploy
Guillaume Lebigot committed
123
  script:
124
    - apt-get update -qq && apt-get install -y -qq lftp
125
    - echo $CI_COMMIT_REF_NAME >latest
126
    - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; cd site/downloads; put latest"
127 128 129
  only: 
    - tags

130
deploy_osx:
131
  stage: deploy
132
  dependencies:
133
    - pkg_osx
134
  script:
135
    - apt-get update -qq && apt-get install -y -qq lftp zip  
136 137
    - mkdir build_mac
    - cd build_mac
138
    - wget http://mugen.karaokes.moe/downloads/dist_macos.tar.gz
139 140
    - tar xvzf dist_macos.tar.gz
    - rm dist_macos.tar.gz
141 142 143 144 145 146
    - mkdir -p app/jingles
    - cd app/jingles
    - wget https://lab.shelter.moe/karaokemugen/jingles/repository/master/archive.tar
    - tar xvf archive.tar
    - mv -f jingles-master*/* .
    - rm -Rf jingles-master*    
147
    - rm -f archive.tar
148
    - cd ../..
149
    - cp -f ../bin/karaokemugen-app KaraokeMugen
Guillaume Lebigot committed
150
    - cp -f ../config.ini.sample .
151
    - zip -r KaraokeMugen-$CI_COMMIT_REF_NAME-macOS.zip *
152
    - cd ../updater_info
153
    - export RELFILE=`bash _ciPrepareInfoFiles.sh darwin`
154
    - cd ..
155
    - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; cd site/downloads; put build_mac/KaraokeMugen-$CI_COMMIT_REF_NAME-macOS.zip ; put updater_info/$RELFILE"    
156 157
  only:
    - master
158
    - next
159 160
    - tags

161 162
apidoc:
  stage: deploy
163
  script:    
164
    - apt-get update -qq && apt-get install -y -qq lftp  
165
    - apidoc -i src/_controllers -o apidoc -t apidoc_template
166
    - cd apidoc
167
    - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; cd site/apidoc; mirror -Rnev --parallel=10"
168
  only:
169 170
    - master
    - tags