...

Text file src/github.com/launchdarkly/go-server-sdk-redis-redigo/v2/.circleci/config.yml

Documentation: github.com/launchdarkly/go-server-sdk-redis-redigo/v2/.circleci

     1version: 2.1
     2
     3orbs:
     4  win: circleci/windows@1.0.0
     5
     6workflows:
     7  workflow:
     8    jobs:
     9      - go-test:
    10          name: Go 1.19
    11          docker-image: cimg/go:1.19
    12          with-coverage: true
    13          run-lint: true
    14      - go-test:
    15          name: Go 1.18
    16          docker-image: cimg/go:1.18
    17      - go-test-windows:
    18          name: Windows
    19          go-version: "1.18.5"
    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      - image: redis
    39
    40    steps:
    41      - checkout
    42
    43      - run:
    44          name: install go-junit-report
    45          command: go install github.com/jstemmer/go-junit-report@latest
    46
    47      - when:
    48          condition: <<parameters.run-lint>>
    49          steps:
    50            - run: make lint
    51
    52      - run:
    53          name: Build
    54          command: make
    55
    56      - run:
    57          name: Run tests
    58          command: |
    59            mkdir -p $CIRCLE_TEST_REPORTS
    60            mkdir -p $CIRCLE_ARTIFACTS
    61            make test | tee $CIRCLE_ARTIFACTS/report.txt
    62    
    63      - when:
    64          condition: <<parameters.with-coverage>>
    65          steps:
    66            - run:
    67                name: Make coverage report
    68                command: |
    69                  make test-coverage || true
    70            - run:
    71                name: Store coverage results
    72                command: cp build/coverage* /tmp/circle-artifacts
    73                when: always
    74    
    75      - run:
    76          name: Process test results
    77          command: go-junit-report < $CIRCLE_ARTIFACTS/report.txt > $CIRCLE_TEST_REPORTS/junit.xml
    78          when: always
    79      
    80      - store_test_results:
    81          path: /tmp/circle-reports
    82
    83      - store_artifacts:
    84          path: /tmp/circle-artifacts
    85
    86  go-test-windows:
    87    executor:
    88      name: win/vs2019
    89      shell: powershell.exe
    90
    91    parameters:
    92      go-version:
    93        type: string
    94
    95    environment:
    96      GOPATH: C:\Users\VssAdministrator\go
    97
    98    steps:
    99      - checkout
   100      - run:
   101          name: download Go <<parameters.go-version>>
   102          command: |
   103            $ErrorActionPreference = "Stop"
   104            $installerUrl = "https://go.dev/dl/go<<parameters.go-version>>.windows-amd64.msi"
   105            (New-Object System.Net.WebClient).DownloadFile($installerUrl, "go<<parameters.go-version>>.windows-amd64.msi")
   106      - run:
   107          name: install Go <<parameters.go-version>>
   108          command: Start-Process msiexec.exe -Wait -ArgumentList "/I go<<parameters.go-version>>.windows-amd64.msi /quiet"
   109      - run: go version
   110      - run:
   111          name: setup Redis
   112          command: |
   113            $ProgressPreference = "SilentlyContinue"
   114            iwr -outf redis.zip https://github.com/MicrosoftArchive/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.zip
   115            mkdir redis
   116            Expand-Archive -Path redis.zip -DestinationPath redis
   117            cd redis
   118            ./redis-server --service-install
   119            ./redis-server --service-start
   120      - run:
   121          name: build and test
   122          command: |
   123            cd ${env:GOPATH}\src\${env:PACKAGE_PATH}
   124            go test -race ./...

View as plain text