简体   繁体   English

Circleci和GoBuffalo挑战

[英]Circleci and GoBuffalo challenge

I'm currently trying to get GoBuffalo and CircleCi working, but so far without luck. 我目前正在尝试使GoBuffalo和CircleCi正常工作,但到目前为止还没有运气。

Circleci fails on the "buffalo build" step with the error message: Circleci在“ buffalo构建”步骤中失败,并显示错误消息: 在此处输入图片说明

My config.yaml: 我的config.yaml:

version: 2
jobs:
  khw_build_and_test:
    docker:
      - image: circleci/golang:1.9
    working_directory: /go/src/github.com/khwerhahn/khw
    environment:
      TEST_RESULTS: /tmp/test-results
    steps:
      - checkout
      - run: mkdir -p $TEST_RESULTS # create the test results directory
      - run:
          name: Update PATH and Define Environment Variable at Runtime
          command: |
            echo 'export PATH=${GOPATH}/bin/:${PATH}' >> $BASH_ENV
            source $BASH_ENV
      - run: go get -v -t -d ./...
      - run: go get -u -v github.com/gobuffalo/buffalo/buffalo
      - run: buffalo build
      - restore_cache:
          keys:
            - v1-pkg-cache
      - save_cache: # Store cache in the /go/pkg directory
          key: v1-pkg-cache
          paths:
            - "/go/pkg"
  khw_deploy_to_production:
    xxxx cut out xxxx

workflows:
  version: 2
  build_test_deploy:
    jobs:
      - khw_build_and_test
      - khw_deploy_to_production:
          requires:
            - khw_build_and_test
          filters:
            branches:
              only: master

Can somebody explain this error to me? 有人可以向我解释这个错误吗?

It tries to bundle js with webpack, try --skip-assets as you probably don't have frontend for it: 它尝试将js与webpack捆绑在一起,尝试--skip-assets因为您可能没有它的前端:

- run: buffalo build --skip-assets

More on their frontend requirements are here 更多关于他们的前端需求在这里

Tino, this is how I run my tests in CircleCi with buffalo, one important thing is that you can use buffalo images to build/test your code. 蒂诺(Tino),这就是我在带有牛头的CircleCi中运行测试的方法,重要的是,您可以使用牛头图像来构建/测试代码。

This has some advantages: 这具有一些优点:

  1. All buffalo dependencies are already in the buffalo image 所有的水牛依赖项都已经在水牛图像中
  2. It has postgres preinstalled so I just have to start it and run tests against it. 它已经预安装了postgres,所以我只需要启动它并针对它运行测试。
version: 2

jobs:
  test:
    docker:
      - image: gobuffalo/buffalo:v0.14.0
    working_directory: /go/src/github.com/my/app
    steps:
      - checkout
      - run: GO111MODULE=off go get github.com/gobuffalo/buffalo-plugins
      - run: buffalo plugins install
      - run: service postgresql start && buffalo db create -e test && buffalo db migrate -e test
      - run: service postgresql start && buffalo test ./...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM