gitlab.com/apertussolutions/u-root@v7.0.0+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_licenses:
    55            requires:
    56              - clean-code
    57  
    58  jobs:
    59    clean-code:
    60      <<: *golang-template
    61      steps:
    62        - checkout
    63        - run:
    64            name: Install dep
    65            command: |
    66              wget https://github.com/golang/dep/releases/download/v0.5.4/dep-linux-amd64
    67              mv dep-linux-amd64 dep
    68              chmod +x dep
    69        - run:
    70            name: Install gometalinter
    71            command: |
    72              go get -u golang.org/x/lint/golint
    73              go get github.com/alecthomas/gometalinter
    74        - run:
    75            name: Install ineffassign
    76            command: go get github.com/gordonklaus/ineffassign
    77        - run:
    78            name: Check vendored dependencies
    79            command: |
    80              ./dep version
    81              ./dep status
    82              ./dep ensure -vendor-only
    83              git status
    84              if [[ -n "$(git status --porcelain vendor)" ]]; then
    85                echo 'vendor/ is out-of-date: run `dep ensure -vendor-only` and then check in the changes'
    86                echo 'If `dep ensure` results in no changes, make sure you are using the latest relase of dep'
    87                git status --porcelain vendor
    88                exit 1
    89              fi
    90        - run:
    91            name: vet
    92            command: |
    93              go vet -composites=false ./cmds/... ./pkg/... ./
    94        - run:
    95            name: gofmt
    96            command: |
    97              test -z "$(gofmt -s -l $(find -name '*.go' | grep -v /vendor/))"
    98        - run:
    99            name: gometalinter
   100            command: |
   101                gometalinter --vendor ./... --disable-all --enable=golint \
   102                  --skip=pkg/uroot/test \
   103                  --skip=cmds/core/elvish \
   104                  --exclude="exported (function|type|const|method|var) (\w|_|\.)+ should have comment" \
   105                  --exclude="don't use underscores" \
   106                  --exclude="don't use ALL_CAPS" \
   107                  --exclude="comment on exported (function|type|const|method|var) (\w|_|\.)+ should be of the form" \
   108                  --exclude="package comment should be of the form" \
   109                  --exclude="(function|type|const|method|var|type field|struct field) (\w|_|\.)+ should be (\w|_|\.)+" \
   110                  --exclude="stutter" \
   111                  --exclude="which can be annoying to use"
   112        - run:
   113            name: ineffassign
   114            command: ineffassign .
   115    test:
   116      <<: *golang-template
   117      steps:
   118        - checkout
   119        - run:
   120            name: Test all
   121            command: go test -a -timeout 15m -ldflags '-s' ./cmds/... ./pkg/...
   122            no_output_timeout: 15m
   123        - run:
   124            name: Test coverage
   125            command: go test -cover ./cmds/... ./pkg/...
   126    test-build:
   127      <<: *beefy-template
   128      steps:
   129        - checkout
   130        - run:
   131            name: Test u-root build
   132            command: go test -a -timeout 15m .
   133            no_output_timeout: 15m
   134    race:
   135      <<: *golang-template
   136      environment:
   137        - CGO_ENABLED: 1
   138      steps:
   139        - checkout
   140        - run:
   141            name: Race detector
   142            command: go test -race ./cmds/... ./pkg/...
   143    compile_cmds:
   144      <<: *golang-template
   145      steps:
   146        - checkout
   147        - run:
   148            name: build all tools
   149            command: |
   150              cd cmds
   151              go install -a ./...
   152              cd ../tools
   153              go install -a ./...
   154    check_licenses:
   155      <<: *golang-template
   156      steps:
   157        - checkout
   158        - run:
   159            name: Check licenses
   160            command: go run tools/checklicenses/checklicenses.go -c tools/checklicenses/config.json
   161    check_symlinks:
   162      <<: *golang-template
   163      steps:
   164        - checkout
   165        - run:
   166            name: Symbol tests to ensure we do not break symlink handling
   167            command: mkdir /tmp/usr && ln -s /tmp/usr/x /tmp/usr/y && go run u-root.go -build=bb -files /tmp/usr minimal
   168    check_templates:
   169      <<: *golang-template
   170      steps:
   171        - checkout
   172        - run:
   173            name: ensure that every template builds for a variety of options.
   174            command: |
   175                    go run u-root.go -build=bb minimal
   176                    go run u-root.go minimal
   177                    go run u-root.go -build=bb core
   178                    go run u-root.go core
   179                    go run u-root.go -build=bb coreboot-app
   180                    go run u-root.go coreboot-app
   181                    go run u-root.go -build=bb all
   182                    go run u-root.go all
   183                    go run u-root.go -build=bb all core
   184                    go run u-root.go all core
   185                    go run u-root.go -fourbins minimal
   186                    go build .
   187                    GOOS=plan9 ./u-root plan9 -defaultsh=/bbin/rush
   188    test-integration-amd64:
   189      <<: *integration-template
   190      docker:
   191        - image: uroottest/test-image-amd64:v3.2.12
   192    test-integration-arm:
   193      <<: *integration-template
   194      docker:
   195        - image: uroottest/test-image-arm:v3.0.4
   196    test-integration-arm64:
   197      <<: *integration-template
   198      docker:
   199        - image: uroottest/test-image-arm64:v0.0.2
   200      working_directory: /home/circleci/go/src/github.com/u-root/u-root