github.com/honeycombio/honeytail@v1.9.0/.circleci/config.yml (about)

     1  version: 2.1
     2  
     3  orbs:
     4    aws-cli: circleci/aws-cli@3.2.0
     5    docker: circleci/docker@1.7.0
     6  
     7  platform_matrix: &platform_matrix
     8    matrix:
     9      parameters:
    10        os: &oses ["linux", "darwin"] # <-- "windows" in the future!
    11        arch: &arches ["amd64", "arm64", "arm"]
    12      exclude:
    13        - os: darwin
    14          arch: arm
    15      # exclude: # And when Windows comes, we'll need to exclude the Win+arm64 combo:
    16      #   - os: "windows"
    17      #     arch: "arm64"
    18  
    19  jobs:
    20    test:
    21      docker:
    22        - image: cimg/go:1.20
    23      steps:
    24        - checkout
    25        - run: go test --timeout 10s -v ./...
    26  
    27    verify-licenses:
    28      docker:
    29        - image: cimg/go:1.20
    30      steps:
    31        - checkout
    32        - run: make verify-licenses
    33  
    34    go-build:
    35      docker:
    36        - image: cimg/go:1.20
    37      parameters:
    38        os:
    39          description: Target operating system
    40          type: enum
    41          enum: *oses
    42          default: "linux"
    43        arch:
    44          description: Target architecture
    45          type: enum
    46          enum: *arches
    47          default: "amd64"
    48      steps:
    49        - checkout
    50        - run: |
    51            GOOS=<< parameters.os >> \
    52            GOARCH=<< parameters.arch >> \
    53            go build -ldflags "-X main.BuildID=${CIRCLE_TAG}" \
    54            -o ~/artifacts/honeytail-<< parameters.os >>-<< parameters.arch >> \
    55            .
    56        - persist_to_workspace:
    57            root: ~/
    58            paths:
    59              - artifacts
    60  
    61    build_packages:
    62      docker:
    63        - image: cimg/go:1.20
    64      steps:
    65        - attach_workspace:
    66            at: ~/
    67        - checkout
    68        - run: sudo apt-get -qq update
    69        - run: sudo apt-get install -y build-essential rpm ruby ruby-dev
    70        - run: sudo gem install fpm
    71        - run: ~/artifacts/honeytail-linux-amd64 --write_default_config > ./honeytail.conf
    72        - run: ./build-pkg.sh -m amd64 -v "${CIRCLE_TAG}" -t deb && mv *.deb ~/artifacts
    73        - run: ./build-pkg.sh -m arm64 -v "${CIRCLE_TAG}" -t deb && mv *.deb ~/artifacts
    74        - run: ./build-pkg.sh -m arm -v "${CIRCLE_TAG}" -t deb && mv *.deb ~/artifacts
    75        - run: ./build-pkg.sh -m amd64 -v "${CIRCLE_TAG}" -t rpm && mv *.rpm ~/artifacts
    76        - run: ./build-pkg.sh -m arm64 -v "${CIRCLE_TAG}" -t rpm && mv *.rpm ~/artifacts
    77        - run: ./build-pkg.sh -m arm -v "${CIRCLE_TAG}" -t rpm && mv *.rpm ~/artifacts
    78        - run: echo "finished builds" && find ~/artifacts -ls
    79        - persist_to_workspace:
    80            root: ~/
    81            paths:
    82              - artifacts
    83        - store_artifacts:
    84            path: ~/artifacts
    85  
    86    publish_github:
    87      docker:
    88        - image: cibuilds/github:0.13.0
    89      steps:
    90        - attach_workspace:
    91            at: ~/
    92        - run:
    93            name: "Publish Release on GitHub"
    94            command: |
    95              echo "about to publish to tag ${CIRCLE_TAG}"
    96              ls -l ~/artifacts/*
    97              ghr -draft -n ${CIRCLE_TAG} -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${CIRCLE_TAG} ~/artifacts
    98  
    99    publish_s3:
   100      executor: aws-cli/default
   101      steps:
   102        - attach_workspace:
   103            at: ~/
   104        - aws-cli/setup:
   105            role-arn: "arn:aws:iam::702835727665:role/circleci-public-repos"
   106            role-session-name: "honeytail"
   107            aws-region: AWS_REGION
   108        - run:
   109            name: sync_s3_artifacts
   110            command: aws s3 sync ~/artifacts s3://honeycomb-builds/honeycombio/honeytail/${CIRCLE_TAG}/
   111  
   112  workflows:
   113    version: 2
   114    build:
   115      jobs:
   116        - test:
   117            filters:
   118              tags:
   119                only: /.*/
   120        - verify-licenses:
   121            filters:
   122              tags:
   123                only: /.*/
   124        - go-build:
   125            <<: *platform_matrix
   126            requires:
   127              - test
   128            filters:
   129              tags:
   130                only: /.*/
   131        - build_packages:
   132            context: Honeycomb Secrets for Public Repos
   133            requires:
   134              - test
   135              - go-build
   136            filters:
   137              tags:
   138                only: /^v.*/
   139              branches:
   140                ignore: /.*/
   141        - publish_github:
   142            context: Honeycomb Secrets for Public Repos
   143            requires:
   144              - build_packages
   145            filters:
   146              tags:
   147                only: /^v.*/
   148              branches:
   149                ignore: /.*/
   150        - publish_s3:
   151            context: Honeycomb Secrets for Public Repos
   152            requires:
   153              - build_packages
   154            filters:
   155              tags:
   156                only: /^v.*/
   157              branches:
   158                ignore: /.*/