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

3
stages:
4
  - sync_medias
5 6 7
  - test
  - deploy

8
sync_medias:
Guillaume Lebigot's avatar
Guillaume Lebigot committed
9
  stage: sync_medias
10 11 12 13 14 15 16 17 18
  interruptible: false
  script:
    - mkdir ~/.ssh
    - echo "$SSH_KEY" > ~/.ssh/id_rsa
    - HOSTKEYS=`ssh-keyscan -H $HOST`
    - echo "$HOSTKEYS" > ~/.ssh/known_hosts
    - chmod -R 700 ~/.ssh
    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
    - ssh -l root $HOST
Guillaume Lebigot's avatar
Guillaume Lebigot committed
19 20
  only:
    - master
21

Guillaume Lebigot's avatar
Guillaume Lebigot committed
22 23
test:
  stage: test
24
  interruptible: true
25 26 27 28 29
  services:
    - postgres:10.6
  variables:
    POSTGRES_USER: karaokemugen_app
    POSTGRES_PASSWORD: musubi
30
  artifacts:
31
    expire_in: 1 day
32
    name: names.php
33
    paths:
34
      - names.php
35 36 37
  script:
    - git clone https://lab.shelter.moe/karaokemugen/karaokemugen-app.git
    - cd karaokemugen-app
Guillaume Lebigot's avatar
Guillaume Lebigot committed
38
    - git checkout next
Guillaume Lebigot's avatar
Guillaume Lebigot committed
39
    - yarn pull
Guillaume Lebigot's avatar
Guillaume Lebigot committed
40
    - yarn install
41
    - touch mpv
42
    - cp -f database.CICD.json database.json
Guillaume Lebigot's avatar
Guillaume Lebigot committed
43
    - cp -f ../tools/config.CICD.yml config.yml
Guillaume Lebigot's avatar
Guillaume Lebigot committed
44
    - node util/extUnaccent.js
45
    - node -v
46
    - yarn start --debug --generate --strict
Guillaume Lebigot's avatar
Guillaume Lebigot committed
47
    - cd ..
48
    - php -f tools/export_karaokesmoe.php >names.php
49
  only:
50
    - master
51 52

export:
53
  stage: deploy
54
  interruptible: true
55
  script:
56
    - 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
57
    - 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"
58
    - echo "Triggering KM Server generation"
59
    - "curl -X POST -H authorization:$KMSERVERAUTH http://kara.moe/api/generate"
60
    - "curl -X POST -H authorization:$KMSERVERDEVAUTH http://dev.kara.moe/api/generate"
61
  only:
62
    - master