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

3 4 5 6
stages:
  - test
  - deploy

Guillaume Lebigot's avatar
Guillaume Lebigot committed
7 8
test:
  stage: test
9 10 11 12 13
  services:
    - postgres:10.6
  variables:
    POSTGRES_USER: karaokemugen_app
    POSTGRES_PASSWORD: musubi
14
  artifacts:
15
    expire_in: 1 day
16
    paths:
17
      - names.php
18
  script:
Guillaume Lebigot's avatar
Guillaume Lebigot committed
19 20
    - mkdir ~/.ssh
    - echo "$SSH_KEY" > ~/.ssh/id_rsa
Guillaume Lebigot's avatar
Guillaume Lebigot committed
21
    - HOSTKEYS=`ssh-keyscan -H $HOST`
22
    - echo "$HOSTKEYS" > ~/.ssh/known_hosts
Guillaume Lebigot's avatar
Guillaume Lebigot committed
23 24
    - chmod -R 700 ~/.ssh
    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
25
    - ssh -l root $HOST
26 27
    - git clone https://lab.shelter.moe/karaokemugen/karaokemugen-app.git
    - cd karaokemugen-app
Guillaume Lebigot's avatar
Guillaume Lebigot committed
28
    - git checkout next
Guillaume Lebigot's avatar
Guillaume Lebigot committed
29
    - yarn pull
Guillaume Lebigot's avatar
Guillaume Lebigot committed
30
    - yarn install
31
    - touch mpv
32
    - cp -f database.CICD.json database.json
Guillaume Lebigot's avatar
Guillaume Lebigot committed
33
    - cp -f ../tools/config.CICD.yml config.yml
Guillaume Lebigot's avatar
Guillaume Lebigot committed
34
    - node util/extUnaccent.js
35
    - node -v
36
    - yarn start --debug --generate --strict
Guillaume Lebigot's avatar
Guillaume Lebigot committed
37
    - cd ..
38
    - php -f tools/export_karaokesmoe.php >names.php
39
  only:
40
    - master
41 42

export:
43 44
  stage: deploy
  script:
45
    - lftp -c "set cmd:fail-exit yes; set ftp:ssl-allow no; set ftp:charset "UTF-8" ; set file:charset utf-8; open -u $USERNAME,$PASSWORD $HOST; cd live; put names.php ; lcd lyrics ; cd subtitles ; mirror -Rnev --parallel=10"
Guillaume Lebigot's avatar
Guillaume Lebigot committed
46
    - lftp -c "set cmd:fail-exit yes; set ftp:ssl-allow no; set ftp:charset "UTF-8" ; set file:charset utf-8; open -u $USERNAME,$PASSWORD $HOST; cd kmserver/app/data/karas ; lcd karas ; mirror -Rnev --parallel=10 ; cd ../lyrics ; lcd ../lyrics ; mirror -Rnev --parallel=10 ; cd ../series ; lcd ../series ; mirror -Rnev --parallel=10 ; cd ../karaokes ; lcd ../karaokes ; mirror -Rnev --parallel=10 ; cd ../tags ; lcd ../tags ; mirror -Rnev --parallel=10"
47
    - echo "Triggering KM Server generation"
48
    - "curl -X POST -H authorization:$KMSERVERAUTH http://kara.moe/api/generate"
49
    - "curl -X POST -H authorization:$KMSERVERDEVAUTH http://dev.kara.moe/api/generate"
50
  only:
51
    - master