...

Text file src/github.com/launchdarkly/go-sdk-common/v3/.circleci/config.yml

Documentation: github.com/launchdarkly/go-sdk-common/v3/.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
    39    steps:
    40      - checkout
    41      
    42      - run:
    43          name: install go-junit-report
    44          command: go install github.com/jstemmer/go-junit-report/v2@v2.0.0
    45      
    46      - run: go build ./...
    47
    48      - when:
    49          condition: <<parameters.run-lint>>
    50          steps:
    51            - run: make lint    
    52
    53      - run:
    54          name: Run tests
    55          command: |
    56            mkdir -p $CIRCLE_TEST_REPORTS
    57            mkdir -p $CIRCLE_ARTIFACTS
    58            make test | tee $CIRCLE_ARTIFACTS/report.txt
    59    
    60      - run:
    61          name: Run tests (easyjson implementation)
    62          command: |
    63            make test-easyjson | tee -a $CIRCLE_ARTIFACTS/report.txt
    64    
    65      - run:
    66          name: Process test results
    67          command: go-junit-report < $CIRCLE_ARTIFACTS/report.txt > $CIRCLE_TEST_REPORTS/junit.xml
    68          when: always
    69      
    70      - when:
    71          condition: <<parameters.with-coverage>>
    72          steps:
    73            - run:
    74                name: Verify test coverage
    75                command: make test-coverage
    76            - run:
    77                name: Store coverage results
    78                command: cp build/coverage* /tmp/circle-artifacts
    79                when: always
    80          
    81      - store_test_results:
    82          path: /tmp/circle-reports
    83
    84      - store_artifacts:
    85          path: /tmp/circle-artifacts
    86
    87  go-test-windows:
    88    executor:
    89      name: win/default
    90      shell: powershell.exe
    91
    92    environment:
    93      GOPATH: C:\Users\VssAdministrator\go
    94
    95    steps:
    96      - checkout
    97      - run: 
    98          name: download Go 1.18.5
    99          command: |
   100            $ErrorActionPreference = "Stop"
   101            $installerUrl = "https://go.dev/dl/go1.18.5.windows-amd64.msi"
   102            (New-Object System.Net.WebClient).DownloadFile($installerUrl, "go1.18.5.windows-amd64.msi")
   103      - run:
   104          name: install Go 1.18.5
   105          command: Start-Process msiexec.exe -Wait -ArgumentList "/I go1.18.5.windows-amd64.msi /quiet"
   106      - run: go version
   107      - run:
   108          name: build and test
   109          command: go test -race ./...
   110
   111  benchmarks:
   112    docker:
   113      - image: cimg/go:1.19
   114        environment:
   115          CIRCLE_ARTIFACTS: /tmp/circle-artifacts
   116
   117    steps:
   118      - checkout
   119      - run: go build ./...      
   120      - run:
   121          name: Run benchmarks
   122          command: |
   123            mkdir -p $CIRCLE_ARTIFACTS
   124            make benchmarks | tee $CIRCLE_ARTIFACTS/benchmarks.txt
   125      - run:
   126          name: Run benchmarks (easyjson implementation)
   127          command: |
   128            make benchmarks-easyjson | tee $CIRCLE_ARTIFACTS/benchmarks-easyjson.txt
   129
   130      - store_artifacts:
   131          path: /tmp/circle-artifacts

View as plain text