Travis CI의 Vim이 오래되고 테스트가 통과되지 않기 때문에 영적 전력 사용

8587 단어 VimTravisCI

Travis CI의 Vim이 오래되고 테스트가 통과되지 않기 때문에 영적 전력 사용



Travis CI 테스트에서 모든 버전의 Vim 사용



Travis CI 테스트에서 모든 버전의 Vim을 사용하는 방법.
(또는 vim-themis를 사용하여 Vim 플러그인을 테스트하기위한 .travis.yml 샘플로)

요점 정리


  • Travis CI가 기본적으로 가지고있는 Vim 버전이 낮고 테스트가 떨어집니다.

  • 해결 방법 => Vim을 GitHub에서 clone & 빌드하고 사용하도록 설정



  • 테스트 대상



    aref-web.vim



    사건



    .travis.yml
    language: viml
    
    install:
        - mkdir -p ~/.vim/bundle/repos/github.com
        - mkdir ~/.vim/bundle/repos/github.com/thinca
        - mkdir ~/.vim/bundle/repos/github.com/tyru
        - mkdir ~/Repository
        - git clone https://github.com/thinca/vim-themis ~/.vim/bundle/repos/github.com/thinca/vim-themis
        - git clone https://github.com/tyru/open-browser.vim ~/.vim/bundle/repos/github.com/tyru/open-browser.vim
        - git clone https://github.com/aiya000/aref-web.vim ~/Repository/aref-web.vim
    
    before_script:
        - vim --version
    
    script:
        - ~/.vim/bundle/repos/github.com/thinca/vim-themis/bin/themis ~/Repository/aref-web.vim/test --reporter spec
    
    branches:
        - master
    

    결과
    .
    .
    $ vim --version
    VIM - Vi IMproved 7.3 (2010 Aug 15, compiled May  4 2012 04:25:35)
    Included patches: 1-429
    .
    .
    $ ~/.vim/bundle/repos/github.com/thinca/vim-themis/bin/themis ~/Repository/aref-web.vim/test --reporter spec
    aref-web.vim
      [✓] is_supported_source_test
      [✓] get_target_url_test
      [✓] can_use_dump_cmd_test
      [✖] have_openbrowser_vim_test
          function 112()  (~/Repository/aref-web.vim/test/aref_web.vim)
          function <SNR>27_have_openbrowser_vim()  Line:5  (~/build/aiya000/aref-web.vim/autoload/aref_web.vim)
    
          Vim(return):E121: Undefined variable: v:false
    
    tests 4
    passes 3
    fails 1
    
    The command "~/.vim/bundle/repos/github.com/thinca/vim-themis/bin/themis ~/Repository/aref-web.vim/test --reporter spec" exited with 1.
    
    Done. Your build exited with 1.
    

    tests 4
    passes 3
    fails 1

    Vim(return):E121: Undefined variable: v:false

    「하아? 나니솔레, 이미와칸나이」



    v:false란 최근의 Vim의 업데이트로 추가된 값(변수)으로,
    Travis CI의 우분투가 기본적으로 제공하는 Vim 버전이 낮기 때문에
    대응하고 있지 않습니다.

    대책



    Travis CI의 영적 Ubuntu 파워를 사용하여 다음 흐름에서 영적 테스트를 받습니다.

  • GitHub의 Vim clone
  • clone Vim 빌드
  • 테스트에서 사용

  • ! 영적 야네

  • .travis.yml
    language: viml
    
    install:
        # Prepare environment
        - mkdir -p ~/.vim/bundle/repos/github.com
        - mkdir ~/.vim/bundle/repos/github.com/thinca
        - mkdir ~/.vim/bundle/repos/github.com/tyru
        - mkdir ~/Repository
        # Install needed plugins
        - git clone https://github.com/thinca/vim-themis ~/.vim/bundle/repos/github.com/thinca/vim-themis
        - git clone https://github.com/tyru/open-browser.vim ~/.vim/bundle/repos/github.com/tyru/open-browser.vim
        - git clone https://github.com/aiya000/aref-web.vim ~/Repository/aref-web.vim
        - git clone https://github.com/vim/vim /tmp/vim
        # Build just version vim to ~/bin/vim7.4.1689
        - mkdir ~/bin
        - cd /tmp/vim
        - sudo apt-get install -y gettext libncurses5-dev libacl1-dev libgpm-dev
        - git checkout v7.4.1689
        - ./configure --with-features=huge --enable-fail-if-missing --prefix=$HOME/bin/vim7.4.1689
        - make && make install
        - export THEMIS_VIM=$HOME/bin/vim7.4.1689/bin/vim
    
    before_script:
        - $HOME/bin/vim7.4.1689/bin/vim --version
    
    script:
        - ~/.vim/bundle/repos/github.com/thinca/vim-themis/bin/themis ~/Repository/aref-web.vim/test --reporter spec
    
    branches:
        - master
    

    결과 (영적)


    .
    .
    $ $HOME/bin/vim/bin/vim --version
    VIM - Vi IMproved 7.4 (2013 Aug 10, compiled May 20 2016 19:16:45)
    Included patches: 1-1689
    .
    .
    $ ~/.vim/bundle/repos/github.com/thinca/vim-themis/bin/themis ~/Repository/aref-web.vim/test --reporter spec
    aref-web.vim
      [✓] is_supported_source_test
      [✓] get_target_url_test
      [✓] can_use_dump_cmd_test
      [✓] have_openbrowser_vim_test
    
    tests 4
    passes 4
    
    The command "~/.vim/bundle/repos/github.com/thinca/vim-themis/bin/themis ~/Repository/aref-web.vim/test --reporter spec" exited with 0.
    
    Done. Your build exited with 0.
    

    Included patches: 1-1689

    tests 4
    passes 4

    Done. Your build exited with 0.

    "하라쇼!"

    포인트


  • Vim의 HEAD를 빌드하면 코와이이므로 리비전을 지정하고있다.
  • Vim 측의 버그가 나오면 여기에도 영향을주고 코와이에서!

  • ./configure에 최소 옵션을 전달합니다.
  • 빌드 빠른

  • cache에서 directories 지정

  • 스피리츄얼이야!

    덤 - cache 사용

    궁극적인 .travis.yml의 모양은 여기에 진정되었습니다! (상당히 개선하거나 cache를 가르쳐 주었다) .travis.yml language: generic sudo: false install: # Prepare environment - mkdir -p ~/.vim/bundle/repos/github.com - mkdir ~/.vim/bundle/repos/github.com/thinca - mkdir ~/.vim/bundle/repos/github.com/tyru - mkdir ~/Repository # Install needed plugins - git clone https://github.com/thinca/vim-themis ~/.vim/bundle/repos/github.com/thinca/vim-themis - git clone https://github.com/tyru/open-browser.vim ~/.vim/bundle/repos/github.com/tyru/open-browser.vim - git clone https://github.com/aiya000/aref-web.vim ~/Repository/aref-web.vim # Build just version vim to ~/vim-7.4.1689 - ( if [ ! -d ~/vim-7.4.1689/bin ]; then git clone https://github.com/vim/vim /tmp/vim && cd /tmp/vim && git checkout v7.4.1689 && . /configure --prefix=$HOME/vim-7.4.1689 && make && make install; fi ) - export THEMIS_VIM=$HOME/vim-7.4.1689/bin/vim cache: directories: - $HOME/vim-7.4.1689 before_script: - $HOME/vim-7.4.1689/bin/vim --version script: - ~/.vim/bundle/repos/github.com/thinca/vim-themis/bin/themis ~/Repository/aref-web.vim/test --reporter spec branches: - 마스터
  • Thanks
  • itchyny씨

  • 좋은 웹페이지 즐겨찾기