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