在Travis中编译App Engine应用程序 [英] Compile App Engine application in Travis
问题描述
有没有办法在用Go编写的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?
因为我想在Travis的自动测试中添加一个支票,以便应用程序实际编译。
Because I want to add a check in my automated tests in Travis that the application actually compiles.
澄清:我可以访问App Engine SDK /开发服务器在Travis中,但我不想运行goapp serve,因为它永远不会退出。
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.
推荐答案
测试,你的解决方案看起来很不好。为什么不使用 goapp build
?这是我的 .travis.yml
:
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
它已经有一段时间了,但我最近注意到我的一些构建是随机突破的。这真是令人愤慨,我偶尔会对SDK值进行硬编码以克服这一点。不再。这是一个非常冒险的实现,它抓住了所需SDK的第一个功能(因此/托管为/ updatecheck无法总是返回托管版本):
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)
这篇关于在Travis中编译App Engine应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!