...

Text file src/github.com/launchdarkly/go-sdk-events/v2/.circleci/config.yml

Documentation: github.com/launchdarkly/go-sdk-events/v2/.circleci

     1version: 2.1
     2
     3orbs:
     4  win: circleci/windows@2.4.0
     5
     6workflows:
     7  workflow:
     8    jobs:
     9      - go-test:
    10          name: Go 1.19
    11          docker-image: cimg/go:1.19
    12          run-lint: true
    13          with-coverage: true
    14      - go-test:
    15          name: Go 1.18
    16          docker-image: cimg/go:1.18
    17      - go-test-windows:
    18          name: Windows
    19      - benchmarks
    20
    21jobs:
    22  go-test:
    23    parameters:
    24      docker-image:
    25        type: string
    26      run-lint:
    27        type: boolean
    28        default: false
    29      with-coverage:
    30        type: boolean
    31        default: false
    32  
    33    docker:
    34      - image: <<parameters.docker-image>>
    35        environment:
    36          CIRCLE_TEST_REPORTS: /tmp/circle-reports
    37          CIRCLE_ARTIFACTS: /tmp/circle-artifacts
    38          GOPRIVATE: github.com/launchdarkly/*-private
    39
    40    steps:
    41      - checkout
    42
    43      - run:
    44          name: install go-junit-report
    45          command: go install github.com/jstemmer/go-junit-report/v2@v2.0.0
    46
    47      - run: go build ./...
    48
    49      - when:
    50          condition: <<parameters.run-lint>>
    51          steps:
    52            - run: make lint
    53      
    54      - run:
    55          name: Run tests
    56          command: |
    57            mkdir -p $CIRCLE_TEST_REPORTS
    58            mkdir -p $CIRCLE_ARTIFACTS
    59            trap "go-junit-report < $CIRCLE_ARTIFACTS/report.txt > $CIRCLE_TEST_REPORTS/junit.xml" EXIT
    60            make test | tee $CIRCLE_ARTIFACTS/report.txt
    61
    62      - when:
    63          condition: <<parameters.with-coverage>>
    64          steps:
    65            - run:
    66                name: Verify test coverage
    67                command: make test-coverage
    68            - run:
    69                name: Store coverage results
    70                command: cp build/coverage* /tmp/circle-artifacts
    71                when: always
    72          
    73      - store_test_results:
    74          path: /tmp/circle-reports
    75
    76      - store_artifacts:
    77          path: /tmp/circle-artifacts
    78
    79  go-test-windows:
    80    executor:
    81      name: win/default
    82      shell: powershell.exe
    83
    84    environment:
    85      GOPATH: C:\Users\VssAdministrator\go
    86
    87    steps:
    88      - checkout
    89      - run: 
    90          name: download Go 1.18.5
    91          command: |
    92            $ErrorActionPreference = "Stop"
    93            $installerUrl = "https://go.dev/dl/go1.18.5.windows-amd64.msi"
    94            (New-Object System.Net.WebClient).DownloadFile($installerUrl, "go1.18.5.windows-amd64.msi")
    95      - run:
    96          name: install Go 1.18.5
    97          command: Start-Process msiexec.exe -Wait -ArgumentList "/I go1.18.5.windows-amd64.msi /quiet"
    98      - run: go version
    99      - run:
   100          name: build and test
   101          command: |
   102            go test -race ./...
   103
   104  benchmarks:
   105    docker:
   106      - image: cimg/go:1.19
   107        environment:
   108          CIRCLE_ARTIFACTS: /tmp/circle-artifacts
   109
   110    steps:
   111      - checkout
   112      - run: go build ./...      
   113      - run:
   114          name: Run benchmarks
   115          command: |
   116            mkdir -p $CIRCLE_ARTIFACTS
   117            make benchmarks | tee $CIRCLE_ARTIFACTS/benchmarks.txt
   118
   119      - store_artifacts:
   120          path: /tmp/circle-artifacts

View as plain text