config.yml 1.9 KB
Newer Older
S
stormgbs 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
# Golang CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
jobs:
  build:
    docker:
    - image: circleci/golang:1.13
    working_directory: /go/src/github.com/alibaba/shim-rune
    steps:
    - checkout
    - setup_remote_docker
    - run:
        name: run tests
        command: |
          test -z $(go fmt ./...)
          go vet -asmdecl=false ./...
          go test -race -v ./...
    - run: 
        name: build binary
        command: |
          make binary
    - run:
        name: golangci-lint
        command: |
          curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.22.2
          golangci-lint run --disable govet
  markdown-lint:
    docker: # run the steps with Docker
    - image: circleci/node:12
    working_directory: ~/shim-rune
    steps:
    - checkout
    - setup_remote_docker
    - run:
        name: markdownlint
        command: |
          sudo npm install -g markdownlint-cli
          markdownlint -i vendor -f **/*.md
    - run:
        name: use markdown-link-check(https://github.com/tcort/markdown-link-check) to check links in markdown files
        command: |
          sudo npm install -g markdown-link-check
          set +e
          for name in $(find . -name \*.md | grep -v vendor); do 
            if [ -f $name ]; then 
              markdown-link-check -q $name; 
              if [ $? -ne 0 ]; then
                code=1
              fi
            fi 
          done 
          bash -c "exit $code";
    - run:
        name: markdown-spellcheck
        command: |
          sudo npm install -g markdown-spellcheck
          find . -name \*.md | grep -v '^./vendor' | xargs mdspell --ignore-numbers --ignore-acronyms --en-us -r -x
workflows:
  version: 2
  ci:
    jobs:
      - build
      - markdown-lint