github.com/mem/u-root@v2.0.1-0.20181004165302-9b18b4636a33+incompatible/.circleci/config.yml (about)

     1  version: 2
     2  workflows:
     3    version: 2
     4    build_and_test:
     5      jobs:
     6        - clean-code
     7        - test:
     8            requires:
     9              - clean-code
    10        - test-integration:
    11            requires:
    12              - clean-code
    13        - race:
    14            requires:
    15              - clean-code
    16        - compile_cmds:
    17            requires:
    18              - clean-code
    19        - bb_amd64:
    20            requires:
    21              - clean-code
    22        - bb_arm7:
    23            requires:
    24              - clean-code
    25        - bb_arm64:
    26            requires:
    27              - clean-code
    28        - bb_ppc64le:
    29            requires:
    30              - clean-code
    31        - source_amd64:
    32            requires:
    33              - clean-code
    34        - source_amd64_test_archive:
    35            requires:
    36              - clean-code
    37        - extra_files:
    38            requires:
    39              - clean-code
    40        - extra_files_multiple_files:
    41            requires:
    42              - clean-code
    43        - extra_files_comma_syntax:
    44            requires:
    45              - clean-code
    46        - extra_files_multiple_files_mixed_syntax:
    47            requires:
    48              - clean-code
    49        - extra_files_wrong_comma_syntax:
    50            requires:
    51              - clean-code
    52        - check_licenses:
    53            requires:
    54              - clean-code
    55  jobs:
    56    clean-code:
    57      docker:
    58        - image: circleci/golang:1.11
    59      working_directory: /go/src/github.com/u-root/u-root
    60      steps:
    61        - checkout
    62        - run:
    63            name: Install dep
    64            command: |
    65              wget https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64
    66              mv dep-linux-amd64 dep
    67              chmod +x dep
    68        - run:
    69            name: Install gometalinter
    70            command: |
    71              go get -u golang.org/x/lint/golint
    72              go get github.com/alecthomas/gometalinter
    73        - run:
    74            name: Install ineffassign
    75            command: go get github.com/gordonklaus/ineffassign
    76        - run:
    77            name: Check vendored dependencies
    78            command: |
    79              ./dep version
    80              ./dep status
    81              ./dep ensure -vendor-only
    82              git status
    83              if [[ -n "$(git status --porcelain vendor)" ]]; then
    84                echo 'vendor/ is out-of-date: run `dep ensure -vendor-only` and then check in the changes'
    85                echo 'If `dep ensure` results in no changes, make sure you are using the latest relase of dep'
    86                git status --porcelain vendor
    87                exit 1
    88              fi
    89        - run:
    90            name: vet
    91            command: |
    92              go tool vet cmds xcmds pkg
    93              go tool vet u-root.go
    94        - run:
    95            name: gofmt
    96            command: |
    97                test -z "$(gofmt -s -l $(go list ./... | 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/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      docker:
   117        - image: circleci/golang:1.11
   118      working_directory: /go/src/github.com/u-root/u-root
   119      environment:
   120        - CGO_ENABLED: 0
   121      steps:
   122        - checkout
   123        - run:
   124            name: Test all
   125            command: go test -a -ldflags '-s' ./pkg/... ./cmds/... ./xcmds/...
   126        - run:
   127            name: Test coverage
   128            command: go test -cover ./pkg/... ./cmds/... ./xcmds/...
   129    test-integration:
   130      docker:
   131        - image: uroottest/x86-integration:latest
   132      working_directory: /go/src/github.com/u-root/u-root
   133      environment:
   134        - CGO_ENABLED: 0
   135      steps:
   136        - checkout
   137        - run:
   138            name: Test integration all
   139            command: go test -v -a -ldflags '-s' ./integration/...
   140        - store_artifacts:
   141            path: integration/serial
   142    race:
   143      docker:
   144        - image: circleci/golang:1.11
   145      working_directory: /go/src/github.com/u-root/u-root
   146      environment:
   147        - CGO_ENABLED: 1
   148      steps:
   149        - checkout
   150        - run:
   151            name: Race detector
   152            command: go test -race ./pkg/... ./cmds/... ./xcmds/...
   153    bb_amd64:
   154      docker:
   155        - image: circleci/golang:1.11
   156      working_directory: /go/src/github.com/u-root/u-root
   157      environment:
   158        - CGO_ENABLED: 0
   159      steps:
   160        - checkout
   161        - run:
   162            name: Build u-root
   163            command: go build u-root.go
   164        - run:
   165            name: First bb build
   166            command: |
   167              ./u-root -build=bb
   168              mv /tmp/initramfs.linux_amd64.cpio /tmp/initramfs.linux_amd64.cpio.1
   169        - run:
   170            name: Second bb build
   171            command: ./u-root -build=bb
   172        - run:
   173            name: cmp bb test output (test reproducibility)
   174            command: cmp /tmp/initramfs.linux_amd64.cpio /tmp/initramfs.linux_amd64.cpio.1
   175        - run:
   176            name: Compress cpio
   177            command: lzma -9 /tmp/initramfs.linux_amd64.cpio
   178        - store_artifacts:
   179            path: /tmp/initramfs.linux_amd64.cpio.lzma
   180            destination: bb_initramfs.linux_amd64.cpio.lzma
   181        - store_artifacts:
   182            path: /tmp/initramfs.linux_amd64.cpio.1
   183            destination: bb_initramfs.linux_amd64.cpio.1
   184    bb_arm7:
   185      docker:
   186        - image: circleci/golang:1.11
   187      working_directory: /go/src/github.com/u-root/u-root
   188      environment:
   189        - CGO_ENABLED: 0
   190        - GOARCH: arm
   191        - GOARM: 7
   192      steps:
   193        - checkout
   194        - run:
   195            name: Build u-root
   196            environment:
   197              - GOARCH: amd64
   198            command: go build u-root.go
   199        - run:
   200            name: ARM7 test build
   201            command: ./u-root -build=bb
   202        - run:
   203            name: Compress cpio
   204            command: lzma -9 /tmp/initramfs.linux_arm.cpio
   205        - store_artifacts:
   206            path: /tmp/initramfs.linux_arm.cpio.lzma
   207            destination: bb_initramfs.linux_arm.cpio.lzma
   208    bb_arm64:
   209      docker:
   210        - image: circleci/golang:1.11
   211      working_directory: /go/src/github.com/u-root/u-root
   212      environment:
   213        - CGO_ENABLED: 0
   214        - GOARCH: arm64
   215      steps:
   216        - checkout
   217        - run:
   218            name: Build u-root
   219            environment:
   220              - GOARCH: amd64
   221            command: go build u-root.go
   222        - run:
   223            name: ARM64 test build
   224            command: ./u-root -build=bb
   225        - run:
   226            name: Compress cpio
   227            command: lzma -9 /tmp/initramfs.linux_arm64.cpio
   228        - store_artifacts:
   229            path: /tmp/initramfs.linux_arm64.cpio.lzma
   230            destination: bb_initramfs.linux_arm64.cpio.lzma
   231    bb_ppc64le:
   232      docker:
   233        - image: circleci/golang:1.11
   234      working_directory: /go/src/github.com/u-root/u-root
   235      environment:
   236        - CGO_ENABLED: 0
   237        - GOARCH: ppc64le
   238      steps:
   239        - checkout
   240        - run:
   241            name: Build u-root
   242            environment:
   243              - GOARCH: amd64
   244            command: go build u-root.go
   245        - run:
   246            name: ppc64le test build
   247            command: ./u-root -build=bb
   248        - run:
   249            name: Compress cpio
   250            command: lzma -9 /tmp/initramfs.linux_ppc64le.cpio
   251        - store_artifacts:
   252            path: /tmp/initramfs.linux_ppc64le.cpio.lzma
   253            destination: bb_initramfs.linux_ppc64le.cpio.lzma
   254    compile_cmds:
   255      docker:
   256        - image: circleci/golang:1.11
   257      working_directory: /go/src/github.com/u-root/u-root
   258      environment:
   259        - CGO_ENABLED: 0
   260      steps:
   261        - checkout
   262        - run:
   263            name: build all tools
   264            command: |
   265              cd cmds
   266              go install -a ./...
   267              cd ../tools
   268              go install -a ./...
   269              cd ../xcmds
   270              go install -a ./...
   271    source_amd64:
   272      docker:
   273        - image: circleci/golang:1.11
   274      working_directory: /go/src/github.com/u-root/u-root
   275      environment:
   276        - CGO_ENABLED: 0
   277      steps:
   278        - checkout
   279        - run:
   280            name: Build u-root
   281            environment:
   282              - GOARCH: amd64
   283            command: go build u-root.go
   284        - run:
   285            name: Build ramfs
   286            command: ./u-root -build=source --tmpdir=/tmp/u-root
   287        - run:
   288            name: Compress cpio
   289            command: lzma -9 /tmp/initramfs.linux_amd64.cpio
   290        - store_artifacts:
   291            path: /tmp/initramfs.linux_amd64.cpio.lzma
   292            destination: source_initramfs.linux_amd64.cpio.lzma
   293    source_amd64_test_archive:
   294      docker:
   295        - image: circleci/golang:1.11
   296      working_directory: /go/src/github.com/u-root/u-root
   297      environment:
   298        - CGO_ENABLED: 0
   299      steps:
   300        - checkout
   301        - run:
   302            name: Install cpio
   303            command: sudo apt-get install cpio
   304        - run:
   305            name: Build u-root
   306            environment:
   307              - GOARCH: amd64
   308            command: go build u-root.go
   309        - run:
   310            name: Build ramfs
   311            command: ./u-root -build=source --tmpdir=/tmp/u-root
   312        - run:
   313            name: make test directory
   314            command: mkdir /tmp/u-root-test
   315        - run:
   316            name: extract archive
   317            command: cpio -i -d --no-absolute-filenames "go/*" < /tmp/initramfs.linux_amd64.cpio
   318            working_directory: /tmp/u-root-test
   319        - run:
   320            name: run go build
   321            command: GOPATH=$(pwd) GOROOT=$(pwd)/go ./go/bin/go build ./go/src/...
   322            working_directory: /tmp/u-root-test
   323    extra_files:
   324      docker:
   325        - image: circleci/golang:1.11
   326      working_directory: /go/src/github.com/u-root/u-root
   327      environment:
   328        - CGO_ENABLED: 0
   329      steps:
   330        - checkout
   331        - run:
   332            name: Install cpio
   333            command: sudo apt-get install cpio
   334        - run:
   335            name: Build u-root
   336            environment:
   337              - GOARCH: amd64
   338            command: go build u-root.go
   339        - run:
   340            name: Build ramfs
   341            command: ./u-root -build=bb --tmpdir=/tmp/u-root -files ///bin/bash
   342        - run:
   343            name: make test directory
   344            command: mkdir /tmp/u-root-test
   345        - run:
   346            name: extract archive
   347            command: cpio -i -d --no-absolute-filenames "bin/bash" < /tmp/initramfs.linux_amd64.cpio
   348            working_directory: /tmp/u-root-test
   349    extra_files_multiple_files:
   350      docker:
   351        - image: circleci/golang:1.11
   352      working_directory: /go/src/github.com/u-root/u-root
   353      environment:
   354        - CGO_ENABLED: 0
   355      steps:
   356        - checkout
   357        - run:
   358            name: Install cpio
   359            command: sudo apt-get install cpio
   360        - run:
   361            name: Build u-root
   362            environment:
   363              - GOARCH: amd64
   364            command: go build u-root.go
   365        - run:
   366            name: Create sample file
   367            command: mkdir sample && touch sample/file
   368        - run:
   369            name: Build ramfs
   370            command: ./u-root -build=bb --tmpdir=/tmp/u-root -files /bin/bash -files /bin/ls -files sample/file
   371        - run:
   372            name: make test directory
   373            command: mkdir /tmp/u-root-test
   374        - run:
   375            name: extract archive
   376            command: cpio -i -d --no-absolute-filenames "bin/bash bin/ls sample/file" < /tmp/initramfs.linux_amd64.cpio
   377            working_directory: /tmp/u-root-test
   378    extra_files_comma_syntax:
   379      docker:
   380        - image: circleci/golang:1.11
   381      working_directory: /go/src/github.com/u-root/u-root
   382      environment:
   383        - CGO_ENABLED: 0
   384      steps:
   385        - checkout
   386        - run:
   387            name: Install cpio
   388            command: sudo apt-get install cpio
   389        - run:
   390            name: Build u-root
   391            environment:
   392              - GOARCH: amd64
   393            command: go build u-root.go
   394        - run:
   395            name: Build ramfs
   396            command: ./u-root -build=bb --tmpdir=/tmp/u-root -files /bin/bash:bin/bush
   397        - run:
   398            name: make test directory
   399            command: mkdir /tmp/u-root-test
   400        - run:
   401            name: extract archive
   402            command: cpio -i -d --no-absolute-filenames "bin/bush" < /tmp/initramfs.linux_amd64.cpio
   403            working_directory: /tmp/u-root-test
   404    extra_files_multiple_files_mixed_syntax:
   405      docker:
   406        - image: circleci/golang:1.11
   407      working_directory: /go/src/github.com/u-root/u-root
   408      environment:
   409        - CGO_ENABLED: 0
   410      steps:
   411        - checkout
   412        - run:
   413            name: Install cpio
   414            command: sudo apt-get install cpio
   415        - run:
   416            name: Build u-root
   417            environment:
   418              - GOARCH: amd64
   419            command: go build u-root.go
   420        - run:
   421            name: Build ramfs
   422            command: ./u-root -build=bb --tmpdir=/tmp/u-root -files /bin/bash:bin/bush -files /bin/ls:ls
   423        - run:
   424            name: make test directory
   425            command: mkdir /tmp/u-root-test
   426        - run:
   427            name: extract archive
   428            command: cpio -i -d --no-absolute-filenames "bin/bush ls" < /tmp/initramfs.linux_amd64.cpio
   429            working_directory: /tmp/u-root-test
   430    extra_files_wrong_comma_syntax:
   431      docker:
   432        - image: circleci/golang:1.11
   433      working_directory: /go/src/github.com/u-root/u-root
   434      environment:
   435        - CGO_ENABLED: 0
   436      steps:
   437        - checkout
   438        - run:
   439            name: Install cpio
   440            command: sudo apt-get install cpio
   441        - run:
   442            name: Build u-root
   443            environment:
   444              - GOARCH: amd64
   445            command: go build u-root.go
   446        - run:
   447            name: Build ramfs
   448            command: if ./u-root -build=bb --tmpdir=/tmp/u-root -files /bin/bash:/bin/bash; then exit 1; else exit 0; fi
   449    check_licenses:
   450      docker:
   451        - image: circleci/golang:1.11
   452      working_directory: /go/src/github.com/u-root/u-root
   453      environment:
   454        - CGO_ENABLED: 0
   455      steps:
   456        - checkout
   457        - run:
   458            name: Check licenses
   459            command: go run scripts/checklicenses/checklicenses.go