### 为web应用搭建CI服务器的一点经验 为我们的web app 开发搭建CI服务器以前一直欠缺两个必要条件: 1. 好用UI测试工具。如果只是编译、打包(甚至单元测试),个人感觉完全没有搭建CI服务器必要,投入产出**不成比例**,每个人在自己机器跑`npm script`就好了。 2. 搭建CI服务器的学习、维护成本。比如,让我们的人从头开始搭建[Jenkins](https://jenkins.io/) 或 [Travis CI](https://travis-ci.org/) 成本都太高了! 最近一段时间开发,上述两个问题都有很不错解决方案,我们的"CI服务器"终于也搭建完成: 首先, [katalon](https://www.katalon.com/katalon-studio/) 确实能胜任 UI的自动化测试(它应该是目前市面上能找到最好用的工具)。编写katalon测试用例需要投入一定时间和精力,但这部分的投入还是值得。 使用katalon目前就有两个小问题[1. How to "Allow" or "Block" in Permission popup](https://forum.katalon.com/discussion/2607/how-to-allow-or-block-in-permission-popup#latest) , [2. git 版本管理](https://forum.katalon.com/discussion/9587/every-time-i-run-test-suite--it--will-be-updated-then-i-have-a-new-git-commit) 但我们也都找到解决办法 其次,发现 [Gitlab Runner](https://docs.gitlab.com/runner/) 用起来还是挺方便,省去自己搭建CI服务器。 Bitbucket 其实也提供了[类似做法](https://confluence.atlassian.com/bitbucket/build-test-and-deploy-with-pipelines-792496469.html), [Pipelines](https://confluence.atlassian.com/bitbucket/get-started-with-bitbucket-pipelines-792298921.html): "Pipelines can build and test anything that can run on Linux as we run your builds in [Docker containers](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). " 但我们需要在CI服务器上运行 katalon,所以Gitlab runner适合。 一开始Gitlab runner没在Windows上顺利跑起来,虽然文档说了可以[在Windows上运行](https://docs.gitlab.com/runner/install/windows.html) ; mac上跑唯一问题就是一旦电脑休眠了,CI任务就不会执行。可是我理解的CI服务器就是应该经常处于休眠状态,有任务才唤醒。 不死心在两个论坛分别问了为啥 `wake for network access` 不生效,[1](https://forum.gitlab.com/t/gitlab-runner-can-not-wake-up-my-mac-when-it-goes-to-sleep/19103) ,[2](https://apple.stackexchange.com/questions/336716/why-wake-for-network-access-does-not-work-when-setting-ci-server) 看看会不会有人答复。目前先设置display sleep 解决这个问题。 这篇文档提到 [MacStadium](https://about.gitlab.com/2017/05/15/how-to-use-macstadium-and-gitlab-ci-to-build-your-macos-or-ios-projects/) 没有精力在学习研究。