github.com/jlowellwofford/u-root@v1.0.0/.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:latest
    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.4.1/dep-linux-amd64
    66              chmod +x ./dep-linux-amd64
    67        - run:
    68            name: Install ineffassign
    69            command: go get github.com/gordonklaus/ineffassign
    70        - run:
    71            name: Check vendored dependencies
    72            command: |
    73              ./dep-linux-amd64 hash-inputs
    74              ./dep-linux-amd64 status
    75              ./dep-linux-amd64 ensure -vendor-only
    76              if [[ -n "$(git status --porcelain vendor)" ]]; then
    77                echo 'vendor/ is out-of-date: run `dep ensure -vendor-only` and then check in the changes'
    78                git status --porcelain vendor
    79                exit 1
    80              fi
    81        - run:
    82            name: vet
    83            command: |
    84              go tool vet cmds xcmds pkg
    85              go tool vet u-root.go
    86        - run:
    87            name: gofmt
    88            command: test -z $(gofmt -s -l cmds xcmds pkg u-root.go)
    89        - run:
    90            name: ineffassign
    91            command: ineffassign .
    92    test:
    93      docker:
    94        - image: circleci/golang:latest
    95      working_directory: /go/src/github.com/u-root/u-root
    96      environment:
    97        - CGO_ENABLED: 0
    98      steps:
    99        - checkout
   100        - run:
   101            name: Test all
   102            command: go test -a -ldflags '-s' ./pkg/... ./cmds/... ./xcmds/...
   103        - run:
   104            name: Test coverage
   105            command: go test -cover ./pkg/... ./cmds/... ./xcmds/...
   106    test-integration:
   107      docker:
   108        - image: roleary/uroot-integration:latest
   109      working_directory: /go/src/github.com/u-root/u-root
   110      environment:
   111        - CGO_ENABLED: 0
   112      steps:
   113        - checkout
   114        - run:
   115            name: Test integration all
   116            command: go test -v -a -ldflags '-s' ./integration/...
   117    race:
   118      docker:
   119        - image: circleci/golang:latest
   120      working_directory: /go/src/github.com/u-root/u-root
   121      environment:
   122        - CGO_ENABLED: 1
   123      steps:
   124        - checkout
   125        - run:
   126            name: Race detector
   127            command: go test -race ./pkg/... ./cmds/... ./xcmds/...
   128    bb_amd64:
   129      docker:
   130        - image: circleci/golang:latest
   131      working_directory: /go/src/github.com/u-root/u-root
   132      environment:
   133        - CGO_ENABLED: 0
   134      steps:
   135        - checkout
   136        - run:
   137            name: Build u-root
   138            command: go build u-root.go
   139        - run:
   140            name: First bb build
   141            command: |
   142              ./u-root -build=bb
   143              mv /tmp/initramfs.linux_amd64.cpio /tmp/initramfs.linux_amd64.cpio.1
   144        - run:
   145            name: Second bb build
   146            command: ./u-root -build=bb
   147        - run:
   148            name: cmp bb test output (test reproducibility)
   149            command: cmp /tmp/initramfs.linux_amd64.cpio /tmp/initramfs.linux_amd64.cpio.1
   150        - run:
   151            name: Compress cpio
   152            command: lzma -9 /tmp/initramfs.linux_amd64.cpio
   153        - store_artifacts:
   154            path: /tmp/initramfs.linux_amd64.cpio.lzma
   155            destination: bb_initramfs.linux_amd64.cpio.lzma
   156        - store_artifacts:
   157            path: /tmp/initramfs.linux_amd64.cpio.1
   158            destination: bb_initramfs.linux_amd64.cpio.1
   159    bb_arm7:
   160      docker:
   161        - image: circleci/golang:latest
   162      working_directory: /go/src/github.com/u-root/u-root
   163      environment:
   164        - CGO_ENABLED: 0
   165        - GOARCH: arm
   166        - GOARM: 7
   167      steps:
   168        - checkout
   169        - run:
   170            name: Build u-root
   171            environment:
   172              - GOARCH: amd64
   173            command: go build u-root.go
   174        - run:
   175            name: ARM7 test build
   176            command: ./u-root -build=bb
   177        - run:
   178            name: Compress cpio
   179            command: lzma -9 /tmp/initramfs.linux_arm.cpio
   180        - store_artifacts:
   181            path: /tmp/initramfs.linux_arm.cpio.lzma
   182            destination: bb_initramfs.linux_arm.cpio.lzma
   183    bb_arm64:
   184      docker:
   185        - image: circleci/golang:latest
   186      working_directory: /go/src/github.com/u-root/u-root
   187      environment:
   188        - CGO_ENABLED: 0
   189        - GOARCH: arm64
   190      steps:
   191        - checkout
   192        - run:
   193            name: Build u-root
   194            environment:
   195              - GOARCH: amd64
   196            command: go build u-root.go
   197        - run:
   198            name: ARM64 test build
   199            command: ./u-root -build=bb
   200        - run:
   201            name: Compress cpio
   202            command: lzma -9 /tmp/initramfs.linux_arm64.cpio
   203        - store_artifacts:
   204            path: /tmp/initramfs.linux_arm64.cpio.lzma
   205            destination: bb_initramfs.linux_arm64.cpio.lzma
   206    bb_ppc64le:
   207      docker:
   208        - image: circleci/golang:latest
   209      working_directory: /go/src/github.com/u-root/u-root
   210      environment:
   211        - CGO_ENABLED: 0
   212        - GOARCH: ppc64le
   213      steps:
   214        - checkout
   215        - run:
   216            name: Build u-root
   217            environment:
   218              - GOARCH: amd64
   219            command: go build u-root.go
   220        - run:
   221            name: ppc64le test build
   222            command: ./u-root -build=bb
   223        - run:
   224            name: Compress cpio
   225            command: lzma -9 /tmp/initramfs.linux_ppc64le.cpio
   226        - store_artifacts:
   227            path: /tmp/initramfs.linux_ppc64le.cpio.lzma
   228            destination: bb_initramfs.linux_ppc64le.cpio.lzma
   229    compile_cmds:
   230      docker:
   231        - image: circleci/golang:latest
   232      working_directory: /go/src/github.com/u-root/u-root
   233      environment:
   234        - CGO_ENABLED: 0
   235      steps:
   236        - checkout
   237        - run:
   238            name: build all tools
   239            command: |
   240              cd cmds
   241              go install -a ./...
   242              cd ../tools
   243              go install -a ./...
   244              cd ../xcmds
   245              go install -a ./...
   246    source_amd64:
   247      docker:
   248        - image: circleci/golang:latest
   249      working_directory: /go/src/github.com/u-root/u-root
   250      environment:
   251        - CGO_ENABLED: 0
   252      steps:
   253        - checkout
   254        - run:
   255            name: Build u-root
   256            environment:
   257              - GOARCH: amd64
   258            command: go build u-root.go
   259        - run:
   260            name: Build ramfs
   261            command: ./u-root -build=source --tmpdir=/tmp/u-root
   262        - run:
   263            name: Compress cpio
   264            command: lzma -9 /tmp/initramfs.linux_amd64.cpio
   265        - store_artifacts:
   266            path: /tmp/initramfs.linux_amd64.cpio.lzma
   267            destination: source_initramfs.linux_amd64.cpio.lzma
   268    source_amd64_test_archive:
   269      docker:
   270        - image: circleci/golang:latest
   271      working_directory: /go/src/github.com/u-root/u-root
   272      environment:
   273        - CGO_ENABLED: 0
   274      steps:
   275        - checkout
   276        - run:
   277            name: Install cpio
   278            command: sudo apt-get install cpio
   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: make test directory
   289            command: mkdir /tmp/u-root-test
   290        - run:
   291            name: extract archive
   292            command: cpio -i -d --no-absolute-filenames "go/*" < /tmp/initramfs.linux_amd64.cpio
   293            working_directory: /tmp/u-root-test
   294        - run:
   295            name: run go build
   296            command: GOPATH=$(pwd) GOROOT=$(pwd)/go ./go/bin/go build ./go/src/...
   297            working_directory: /tmp/u-root-test
   298    extra_files:
   299      docker:
   300        - image: circleci/golang:latest
   301      working_directory: /go/src/github.com/u-root/u-root
   302      environment:
   303        - CGO_ENABLED: 0
   304      steps:
   305        - checkout
   306        - run:
   307            name: Install cpio
   308            command: sudo apt-get install cpio
   309        - run:
   310            name: Build u-root
   311            environment:
   312              - GOARCH: amd64
   313            command: go build u-root.go
   314        - run:
   315            name: Build ramfs
   316            command: ./u-root -build=bb --tmpdir=/tmp/u-root -files ///bin/bash
   317        - run:
   318            name: make test directory
   319            command: mkdir /tmp/u-root-test
   320        - run:
   321            name: extract archive
   322            command: cpio -i -d --no-absolute-filenames "bin/bash" < /tmp/initramfs.linux_amd64.cpio
   323            working_directory: /tmp/u-root-test
   324    extra_files_multiple_files:
   325      docker:
   326        - image: circleci/golang:latest
   327      working_directory: /go/src/github.com/u-root/u-root
   328      environment:
   329        - CGO_ENABLED: 0
   330      steps:
   331        - checkout
   332        - run:
   333            name: Install cpio
   334            command: sudo apt-get install cpio
   335        - run:
   336            name: Build u-root
   337            environment:
   338              - GOARCH: amd64
   339            command: go build u-root.go
   340        - run:
   341            name: Create sample file
   342            command: mkdir sample && touch sample/file
   343        - run:
   344            name: Build ramfs
   345            command: ./u-root -build=bb --tmpdir=/tmp/u-root -files /bin/bash -files /bin/ls -files sample/file
   346        - run:
   347            name: make test directory
   348            command: mkdir /tmp/u-root-test
   349        - run:
   350            name: extract archive
   351            command: cpio -i -d --no-absolute-filenames "bin/bash bin/ls sample/file" < /tmp/initramfs.linux_amd64.cpio
   352            working_directory: /tmp/u-root-test
   353    extra_files_comma_syntax:
   354      docker:
   355        - image: circleci/golang:latest
   356      working_directory: /go/src/github.com/u-root/u-root
   357      environment:
   358        - CGO_ENABLED: 0
   359      steps:
   360        - checkout
   361        - run:
   362            name: Install cpio
   363            command: sudo apt-get install cpio
   364        - run:
   365            name: Build u-root
   366            environment:
   367              - GOARCH: amd64
   368            command: go build u-root.go
   369        - run:
   370            name: Build ramfs
   371            command: ./u-root -build=bb --tmpdir=/tmp/u-root -files /bin/bash:bin/bush
   372        - run:
   373            name: make test directory
   374            command: mkdir /tmp/u-root-test
   375        - run:
   376            name: extract archive
   377            command: cpio -i -d --no-absolute-filenames "bin/bush" < /tmp/initramfs.linux_amd64.cpio
   378            working_directory: /tmp/u-root-test
   379    extra_files_multiple_files_mixed_syntax:
   380      docker:
   381        - image: circleci/golang:latest
   382      working_directory: /go/src/github.com/u-root/u-root
   383      environment:
   384        - CGO_ENABLED: 0
   385      steps:
   386        - checkout
   387        - run:
   388            name: Install cpio
   389            command: sudo apt-get install cpio
   390        - run:
   391            name: Build u-root
   392            environment:
   393              - GOARCH: amd64
   394            command: go build u-root.go
   395        - run:
   396            name: Build ramfs
   397            command: ./u-root -build=bb --tmpdir=/tmp/u-root -files /bin/bash:bin/bush -files /bin/ls:ls
   398        - run:
   399            name: make test directory
   400            command: mkdir /tmp/u-root-test
   401        - run:
   402            name: extract archive
   403            command: cpio -i -d --no-absolute-filenames "bin/bush ls" < /tmp/initramfs.linux_amd64.cpio
   404            working_directory: /tmp/u-root-test
   405    extra_files_wrong_comma_syntax:
   406      docker:
   407        - image: circleci/golang:latest
   408      working_directory: /go/src/github.com/u-root/u-root
   409      environment:
   410        - CGO_ENABLED: 0
   411      steps:
   412        - checkout
   413        - run:
   414            name: Install cpio
   415            command: sudo apt-get install cpio
   416        - run:
   417            name: Build u-root
   418            environment:
   419              - GOARCH: amd64
   420            command: go build u-root.go
   421        - run:
   422            name: Build ramfs
   423            command: if ./u-root -build=bb --tmpdir=/tmp/u-root -files /bin/bash:/bin/bash; then exit 1; else exit 0; fi
   424    check_licenses:
   425      docker:
   426        - image: circleci/golang:latest
   427      working_directory: /go/src/github.com/u-root/u-root
   428      environment:
   429        - CGO_ENABLED: 0
   430      steps:
   431        - checkout
   432        - run:
   433            name: Check licenses
   434            command: go run scripts/checklicenses/checklicenses.go