doupao6698 2014-07-07 15:46
浏览 16
已采纳

在Travis中编译App Engine应用程序

Is there any way to run the compiler on an App Engine application written in Go without continue to serve the application with the development server and instead get an exit code?

Because I want to add a check in my automated tests in Travis that the application actually compiles.

To clarify: I have access to the App Engine SDK / Development Server in Travis, but I dont want to run goapp serve since it never exits.

  • 写回答

2条回答 默认 最新

  • dqcuq4138 2014-07-20 04:47
    关注

    Without actually implementing test, your solution looks pretty hacky. Why not use goapp build? Here's my .travis.yml:

    language: go
    go:
    - 1.2.1
    
    # Grab newest version and suck down
    install:
        - export FILE=go_appengine_sdk_linux_amd64-$(curl https://appengine.google.com/api/updatecheck | grep release | grep -o '[0-9\.]*').zip
        - curl -O https://storage.googleapis.com/appengine-sdks/featured/$FILE
        - unzip -q $FILE
    
    # Run build and tests
    script:
        - ./go_appengine/goapp test ./tests; # If you are testing
        - ./go_appengine/goapp build ./packagedir; # Wherever you keep your stuff
    

    For reference on tests or just to see a project that builds

    Edit:

    It has been awhile, but I noticed recently that some of my builds randomly break. It is infuriating and I have occasionally hardcoded SDK values to overcome this. No more. Here's a very hacky implementation of grabbing the first featured (and thus hosted as /updatecheck fails to always return a hosted version) of the SDK desired:

    export FILE=$(curl https://storage.googleapis.com/appengine-sdks/ | grep -o 'featured/go_appengine_sdk_linux_amd64-[^\<]*' | head -1)
    

    For just the file:

    export FILE=$(curl https://storage.googleapis.com/appengine-sdks/ | grep -oP '(?<=featured/)go_appengine_sdk_linux_amd64-[^\<]*' | head -1)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?
  • ¥15 关于#vue.js#的问题:修改用户信息功能图片无法回显,数据库中只存了一张图片(相关搜索:字符串)
  • ¥15 texstudio的问题,
  • ¥15 spaceclaim模型变灰色
  • ¥15 求一份华为esight平台V300R009C00SPC200这个型号的api接口文档
  • ¥15 字符串比较代码的漏洞
  • ¥15 欧拉系统opt目录空间使用100%
  • ¥15 ul做导航栏格式不对怎么改?