.gitlab-ci.yml 3.53 KB
Newer Older
1
image: axelterizaki/karaokemugen-ci:node-10
2

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

10 11 12 13 14 15
stages:
  - test
  - build
  - package
  - deploy

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

33 34
build:
  stage: build
35 36 37 38 39
  artifacts:
    expire_in: 1 day
    paths:
      - dist/
      - react_client/build/
40
  script:
41
    - npm install -g modclean
42
    - yarn build
43
    - yarn install --production
44
    - cd node_modules
45 46
    - find -name *.node -delete
    - modclean -r
47 48 49 50 51 52
  only:
    - master
    - next
    - tags

pkg_win:
53
  stage: package
54 55
  dependencies:
    - build
56 57 58 59 60
  artifacts:
    name: "$CI_COMMIT_REF_NAME-win"
    expire_in: 1 day
    paths:
      - bin/
61
  script:
62
    - mkdir -p bin
63
    - npm install -g pkg
64
    - pkg . -d --targets node10-win-x64 --out-path bin
65 66 67 68 69 70
  only:
    - master
    - next
    - tags

pkg_osx:
71
  stage: package
72 73
  dependencies:
    - build
74 75 76 77
  artifacts:
    expire_in: 1 day
    paths:
      - bin/
78
  script:
79
    - mkdir -p bin
80
    - npm install -g pkg
81
    - pkg . -d --targets node10-macos-x64 --out-path bin
82 83 84 85 86 87
  only:
    - master
    - next
    - tags

deploy_win:
88
  stage: deploy
89 90
  dependencies:
    - pkg_win
91 92 93
  script:
    - mkdir build_win
    - cd build_win
94
    - wget -qO- http://mugen.karaokes.moe/downloads/dist_win_node10.tar.gz | tar xvz
95 96
    - mkdir -p app/jingles
    - cd app/jingles
97
    - wget -qO- https://lab.shelter.moe/karaokemugen/jingles/repository/master/archive.tar | tar xv
98
    - mv -f jingles-master*/* .
99
    - rm -Rf jingles-master*
100
    - cd ../..
101
    - cp -f ../bin/karaokemugen-app.exe KaraokeMugen.exe
Guillaume Lebigot's avatar
Guillaume Lebigot committed
102
    - cp -f ../config.ini.sample .
103
    - cp -Rf ../samples .
104
    - zip -r KaraokeMugen-$CI_COMMIT_REF_NAME-win64.zip *
105
    - cd ..
106
    - 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"
107 108 109 110
  only:
    - master
    - next
    - tags
111

112
latest_tag:
113
  stage: deploy
Guillaume Lebigot's avatar
Guillaume Lebigot committed
114
  script:
115
    - echo $CI_COMMIT_REF_NAME >latest
116
    - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; cd site/downloads; put latest"
117
  only:
118 119
    - tags

120
deploy_osx:
121
  stage: deploy
122
  dependencies:
123
    - pkg_osx
124 125 126
  script:
    - mkdir build_mac
    - cd build_mac
127
    - wget -qO- http://mugen.karaokes.moe/downloads/dist_macos.tar.gz | tar xvz
128
    - chmod -R +x app/bin
129 130
    - mkdir -p app/jingles
    - cd app/jingles
131
    - wget -qO- https://lab.shelter.moe/karaokemugen/jingles/repository/master/archive.tar | tar xv
132
    - mv -f jingles-master*/* .
133
    - rm -Rf jingles-master*
134
    - rm -f archive.tar
135
    - cd ../..
136
    - cp -f ../bin/karaokemugen-app KaraokeMugen
137 138
    - cp -f ../config.ini.sample .
    - cp -Rf ../samples .
139
    - tar cvz * >KaraokeMugen-$CI_COMMIT_REF_NAME-macOS.tar.gz
140
    - cd ..
141
    - 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"
142 143
  only:
    - master
144
    - next
145 146
    - tags

147 148
apidoc:
  stage: deploy
149
  script:
150
    - npm install -g apidoc
151
    - apidoc -i src/_controllers -o apidoc -t apidoc_template
152
    - cd apidoc
153
    - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; cd site/apidoc; mirror -Rnev --parallel=10"
154
  only:
155 156
    - master
    - tags