Circleci和GoBuffalo挑战

时间:2019-06-21 15:37:46

标签: go circleci buffalo

我目前正在尝试使GoBuffalo和CircleCi正常工作,但是到目前为止还没有运气。

Circleci在“ buffalo build”步骤中失败,并显示错误消息: enter image description here

我的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

有人可以向我解释这个错误吗?

2 个答案:

答案 0 :(得分:1)

它尝试将js与webpack捆绑在一起,请尝试--skip-assets,因为您可能没有它的前端:

- run: buffalo build --skip-assets

有关其前端要求的更多信息是here

答案 1 :(得分:0)

蒂诺(Tino),这就是我在带有牛头的CircleCi中运行测试的方法,重要的是,您可以使用牛头图像来构建/测试代码。

这有一些优点:

  1. 所有的水牛依赖项都已经存在于水牛图像中
  2. 它已经预安装了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 ./...