.gitlab-ci.yml 3.67 KB
Newer Older
1
image: axelterizaki/karaokemugen-ci
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 yarn apidoc
14

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

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

38 39 40 41 42 43
build:
  stage: build
  artifacts:
    expire_in: 1 day
    paths:
      - dist/
44
      - react_client/build/
45
  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 95 96
  script:
    - mkdir build_win
    - cd build_win
97
    - wget http://mugen.karaokes.moe/downloads/dist_win.tar.gz
98 99
    - tar xvzf dist_win.tar.gz
    - rm dist_win.tar.gz
100 101 102 103 104
    - 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*/* .
105
    - rm -Rf jingles-master*
106
    - rm -f archive.tar
107
    - cd ../..
108
    - cp -f ../bin/karaokemugen-app.exe KaraokeMugen.exe
Guillaume Lebigot's avatar
Guillaume Lebigot committed
109
    - cp -f ../config.ini.sample .
110
    - cp -Rf ../samples .
111
    - zip -r KaraokeMugen-$CI_COMMIT_REF_NAME-win64.zip *
112
    - cd ..
113
    - 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"
114 115 116 117
  only:
    - master
    - next
    - tags
118

119
latest_tag:
120
  stage: deploy
Guillaume Lebigot's avatar
Guillaume Lebigot committed
121
  script:
122
    - echo $CI_COMMIT_REF_NAME >latest
123
    - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; cd site/downloads; put latest"
124
  only:
125 126
    - tags

127
deploy_osx:
128
  stage: deploy
129
  dependencies:
130
    - pkg_osx
131 132 133
  script:
    - mkdir build_mac
    - cd build_mac
134
    - wget http://mugen.karaokes.moe/downloads/dist_macos.tar.gz
135 136
    - tar xvzf dist_macos.tar.gz
    - rm dist_macos.tar.gz
137
    - chmod -R +x app/bin
138 139 140 141 142
    - 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*/* .
143
    - rm -Rf jingles-master*
144
    - rm -f archive.tar
145
    - cd ../..
146
    - cp -f ../bin/karaokemugen-app KaraokeMugen
147 148
    - cp -f ../config.ini.sample .
    - cp -Rf ../samples .
149
    - tar cvz * >KaraokeMugen-$CI_COMMIT_REF_NAME-macOS.tar.gz
150
    - cd ..
151
    - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; cd site/downloads; put build_mac/KaraokeMugen-$CI_COMMIT_REF_NAME-macOS.tar.gz"
152 153
  only:
    - master
154
    - next
155 156
    - tags

157 158
apidoc:
  stage: deploy
159
  script:
160
    - apidoc -i src/_controllers -o apidoc -t apidoc_template
161
    - cd apidoc
162
    - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; cd site/apidoc; mirror -Rnev --parallel=10"
163
  only:
164 165
    - master
    - tags