github.com/system-transparency/u-root@v6.0.1-0.20190919065413-ed07a650de4c+incompatible/.circleci/config.yml (about)

     1  version: 2
     2  
     3  templates:
     4    golang-template: &golang-template
     5      docker:
     6        - image: uroottest/test-image-amd64:v3.2.7
     7      working_directory: /go/src/github.com/u-root/u-root
     8      environment:
     9        - CGO_ENABLED: 0
    10        # Double all timeouts for QEMU VM tests since they run without KVM.
    11        - UROOT_QEMU_TIMEOUT_X: 2
    12    integration-template: &integration-template
    13      working_directory: /go/src/github.com/u-root/u-root
    14      environment:
    15        - CGO_ENABLED: 0
    16        # Double all timeouts for QEMU VM tests since they run without KVM.
    17        - UROOT_QEMU_TIMEOUT_X: 2
    18      steps:
    19        - checkout
    20        - run:
    21            name: Test integration
    22            command: go test -a -ldflags '-s' ./integration/...
    23  
    24  workflows:
    25    version: 2
    26    build_and_test:
    27      jobs:
    28        - clean-code
    29        - test:
    30            requires:
    31              - clean-code
    32        - test-integration-amd64:
    33            requires:
    34              - clean-code
    35        - test-integration-arm:
    36            requires:
    37              - clean-code
    38        - race:
    39            requires:
    40              - clean-code
    41        - compile_cmds:
    42            requires:
    43              - clean-code
    44        - check_licenses:
    45            requires:
    46              - clean-code
    47  jobs:
    48    clean-code:
    49      <<: *golang-template
    50      steps:
    51        - checkout
    52        - run:
    53            name: Install dep
    54            command: |
    55              wget https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64
    56              mv dep-linux-amd64 dep
    57              chmod +x dep
    58        - run:
    59            name: Install gometalinter
    60            command: |
    61              go get -u golang.org/x/lint/golint
    62              go get github.com/alecthomas/gometalinter
    63        - run:
    64            name: Install ineffassign
    65            command: go get github.com/gordonklaus/ineffassign
    66        - run:
    67            name: Check vendored dependencies
    68            command: |
    69              ./dep version
    70              ./dep status
    71              ./dep ensure -vendor-only
    72              git status
    73              if [[ -n "$(git status --porcelain vendor)" ]]; then
    74                echo 'vendor/ is out-of-date: run `dep ensure -vendor-only` and then check in the changes'
    75                echo 'If `dep ensure` results in no changes, make sure you are using the latest relase of dep'
    76                git status --porcelain vendor
    77                exit 1
    78              fi
    79        - run:
    80            name: vet
    81            command: |
    82              go vet -composites=false ./cmds/... ./pkg/... ./
    83        - run:
    84            name: gofmt
    85            command: |
    86              test -z "$(gofmt -s -l $(find -name '*.go' | grep -v /vendor/))"
    87        - run:
    88            name: gometalinter
    89            command: |
    90                gometalinter --vendor ./... --disable-all --enable=golint \
    91                  --skip=pkg/uroot/test \
    92                  --skip=cmds/core/elvish \
    93                  --exclude="exported (function|type|const|method|var) (\w|_|\.)+ should have comment" \
    94                  --exclude="don't use underscores" \
    95                  --exclude="don't use ALL_CAPS" \
    96                  --exclude="comment on exported (function|type|const|method|var) (\w|_|\.)+ should be of the form" \
    97                  --exclude="package comment should be of the form" \
    98                  --exclude="(function|type|const|method|var|type field|struct field) (\w|_|\.)+ should be (\w|_|\.)+" \
    99                  --exclude="stutter" \
   100                  --exclude="which can be annoying to use"
   101        - run:
   102            name: ineffassign
   103            command: ineffassign .
   104    test:
   105      <<: *golang-template
   106      steps:
   107        - checkout
   108        - run:
   109            name: Test all
   110            command: go test -a -timeout 15m -ldflags '-s' ./cmds/... ./pkg/...
   111            no_output_timeout: 15m
   112        - run:
   113            name: Test coverage
   114            command: go test -cover ./cmds/... ./pkg/...
   115    race:
   116      <<: *golang-template
   117      environment:
   118        - CGO_ENABLED: 1
   119      steps:
   120        - checkout
   121        - run:
   122            name: Race detector
   123            command: go test -race ./cmds/... ./pkg/...
   124    compile_cmds:
   125      <<: *golang-template
   126      steps:
   127        - checkout
   128        - run:
   129            name: build all tools
   130            command: |
   131              cd cmds
   132              go install -a ./...
   133              cd ../tools
   134              go install -a ./...
   135    check_licenses:
   136      <<: *golang-template
   137      steps:
   138        - checkout
   139        - run:
   140            name: Check licenses
   141            command: go run tools/checklicenses/checklicenses.go -c tools/checklicenses/config.json
   142    check_symlinks:
   143      <<: *golang-template
   144      steps:
   145        - checkout
   146        - run:
   147            name: Symbol tests to ensure we do not break symlink handling
   148            command: mkdir /tmp/usr && ln -s /tmp/usr/x /tmp/usr/y && go run u-root.go -build=bb -files /tmp/usr minimal
   149    check_templates:
   150      <<: *golang-template
   151      steps:
   152        - checkout
   153        - run:
   154            name: ensure that every template builds for a variety of options.
   155            command: |
   156                    go run u-root.go -build=bb minimal
   157                    go run u-root.go minimal
   158                    go run u-root.go -build=bb core
   159                    go run u-root.go core
   160                    go run u-root.go -build=bb coreboot-app
   161                    go run u-root.go coreboot-app
   162                    go run u-root.go -build=bb all
   163                    go run u-root.go all
   164                    go run u-root.go -build=bb all core
   165                    go run u-root.go all core
   166                    go run u-root.go -fourbins minimal
   167    test-integration-amd64:
   168      <<: *integration-template
   169      docker:
   170        - image: uroottest/test-image-amd64:v3.2.7
   171    test-integration-arm:
   172      <<: *integration-template
   173      docker:
   174        - image: uroottest/test-image-arm:v3.0.1