github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/swarmkit/.circleci/config.yml (about)

     1  version: 2
     2  jobs:
     3    build:
     4      # CircleCI by default sets the gopath to be ~/.go_workspace and /usr/local/go_workspace
     5      # apparently.  We cannot set the working directory or environment variables by using
     6      # other environment variables (although the working directory can use the `~` character,
     7      # but environment variables cannot), so to avoid having to override the GOPATH for every
     8      # run command, just hard code in the directory to be CircleCI expects it to be.
     9      working_directory: /home/circleci/.go_workspace/src/github.com/docker/swarmkit
    10      environment:
    11        # Needed to install go
    12        OS: linux
    13        ARCH: amd64
    14        GOVERSION: 1.12
    15        # Needed to install protoc
    16        PROTOC_VERSION: 3.6.1
    17  
    18      # Note(cyli): We create a tmpfs mount to be used for temporary files created by tests
    19      # to mitigate the excessive I/O latencies that sometimes cause the tests to fail.
    20      # See https://github.com/docker/swarmkit/pull/2254.
    21  
    22      # There is no way to mount tmpfs volumes in the docker executor, so we are using
    23      # the machine executor. However, this incur a performance overhead
    24      # (https://discuss.circleci.com/t/using-docker-compose-in-2-0/9492/4)
    25      # and in the future could incur additional pricing changes
    26      # (https://circleci.com/docs/2.0/executor-types/#using-machine).
    27  
    28      # One possible hack is the following:
    29  
    30      # /dev/shm in the container is tmpfs although files in /dev/shm are not executable.
    31      # If we specify TMPDIR=/dev/shm, /dev/shm will be used by our tests, which call
    32      # ioutil.TempDir/ioutil.TempFile, to write temporary files.
    33      # We can also specify GOTMPDIR=/tmp or some other non-tmpfs directory
    34      # (see https://golang.org/doc/go1.10#goroot) - this is the directory in which the
    35      # go tool itself will put temporarily compiled test executables, etc.
    36  
    37      # However, using this hack still resulted in occasional WAL test failures,
    38      # so it seems like it does not work, or there may be some other failure.
    39      # It may be something to explore again if the penalty for using the machine
    40      # executor becomes unacceptable.
    41  
    42      machine: true
    43  
    44      steps:
    45      - checkout
    46  
    47      # This would not be needed if we used a golang docker image
    48      - run:
    49          name: Install go
    50          command: |
    51              sudo rm -rf /usr/local/go
    52              curl -fsSL -o "$HOME/go.tar.gz" "https://storage.googleapis.com/golang/go$GOVERSION.$OS-$ARCH.tar.gz"
    53              sudo tar -C /usr/local -xzf "$HOME/go.tar.gz"
    54  
    55      - run:
    56          name: Output debugging information
    57          command: |
    58              go version
    59              env
    60  
    61      - run:
    62          name: Install protoc
    63          command: |
    64              curl --silent --show-error --location --output protoc.zip \
    65              https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-x86_64.zip \
    66              && sudo unzip -d /usr/local protoc.zip include/\* bin\/* \
    67              && sudo chmod -R a+r /usr/local/include/google/protobuf/
    68              rm -f protoc.zip
    69  
    70      - run:
    71          name: Install test/lint dependencies
    72          command: make setup
    73  
    74      - run:
    75          name: Validate dependency vendoring
    76          command: |
    77              git fetch origin
    78              if test -n "`git diff --stat=1000 origin/master | grep -E \"^[[:space:]]*vendor\"`"; then
    79                  make dep-validate;
    80              fi
    81  
    82      # The GOPATH setting would not be needed if we used the golang docker image
    83      - run:
    84          name: Compile/lint/vet/protobuf validation
    85          command: make check binaries checkprotos
    86  
    87      - run:
    88          name: Run unit tests
    89          command: |
    90              sudo mkdir /tmpfs
    91              sudo mount -t tmpfs tmpfs /tmpfs
    92              sudo chown 1000:1000 /tmpfs
    93              TMPDIR=/tmpfs make coverage
    94  
    95      - run:
    96          name: Run integration tests
    97          command: |
    98              # TMPFS has already been set up previously in the unit test step
    99              TMPDIR=/tmpfs make coverage-integration
   100  
   101      - run:
   102          name: Push coverage info to codecov.io
   103          command: bash <(curl -fsSL https://codecov.io/bash)