The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
wwek

travis-ci 多语言问题,同一个项目 vue+golang

  •  
  •   wwek ·
    wwek · Sep 2, 2017 · 1649 views
    This topic created in 3202 days ago, the information mentioned may be changed or developed.
    • 有朋友熟悉 travis-ci 的么,请教一个问题
    • 我一个 golang 小项目中, 后端使用 beego 开发的 api,前端使用 vue 做的 Webgui
    • 先 npm run build 生成 static 静态文件目录,再 go build
    • 然后 zip 打包,要把 static conf bin 2 个目录和 1 个可执行文件打包
    • travis-ci 应该怎么写
    • 目前我的这个写法是不行的, npm 编译的 静态文件 和 go build 这边的貌似是两个容器不是一个文件目录,导致 zip 打包不了 static

    https://github.com/wwek/haoma/ https://travis-ci.org/wwek/haoma

    Supplement 1  ·  Sep 2, 2017
    感谢大家问题已经解决
    ```
    language: go
    go: master
    node_js: "node"
    cache:
    directories:
    - "node_modules"
    env:
    - VERSION=$(cat VERSION)
    before_deploy:
    - "cd frontend"
    - "npm install"
    - "npm run build"
    - "cd .."
    - "GOOS=linux GOARCH=amd64 go build -o haoma-v$VERSION-linux-amd64"
    - "GOOS=darwin GOARCH=amd64 go build -o haoma-v$VERSION-darwin-amd64"
    - "GOOS=windows GOARCH=amd64 go build -o haoma-v$VERSION-windows-amd64.exe"
    - "tar -cvzf haoma-v$VERSION-linux-amd64.tar.gz haoma-v$VERSION-linux-amd64 gui/ conf/"
    - "tar -cvzf haoma-v$VERSION-darwin-amd64.tar.gz haoma-v$VERSION-darwin-amd64 gui/ conf/"
    - "tar -cvzf haoma-v$VERSION-windows-amd64.tar.gz haoma-v$VERSION-windows-amd64.exe gui/ conf/"
    ```

    1. 用 zip 压缩打包丢失文件夹的问题,改用 tar gz 的方式解决
    2. 既需要 npm 构建前端,也需要编译 go 的解决办法,见以上.travis.yml 片段
    3 replies    2017-09-02 22:55:43 +08:00
    Kokororin
        1
    Kokororin  
       Sep 2, 2017 via iPhone
    语言选择 go 然后

    install:
    - . $HOME/.nvm/nvm.sh
    - nvm install stable
    - nvm use stable
    - npm install
    Trim21
        2
    Trim21  
       Sep 2, 2017 via Android
    当初研究了半天前后端分离的项目怎么管理,最后的出的结论是前后端分两个 repo ……
    wwek
        3
    wwek  
    OP
       Sep 2, 2017
    @Kokororin 谢谢

    @Trim21 哈哈哈哈
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5191 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 09:20 · PVG 17:20 · LAX 02:20 · JFK 05:20
    ♥ Do have faith in what you're doing.