gotest.tools/gotestsum@v1.11.0/.circleci/config.yml (about)

     1  version: 2.1
     2  
     3  orbs:
     4    go: gotest/tools@0.0.14
     5  
     6  workflows:
     7    ci:
     8      jobs:
     9        - go/test:
    10            name: test-go-1.18
    11            gotestsum-format: testname
    12            executor:
    13              name: go/golang
    14              tag: 1.18-alpine
    15  
    16        - go/test:
    17            name: test-go-1.19
    18            gotestsum-format: testname
    19            executor:
    20              name: go/golang
    21              tag: 1.19-alpine
    22  
    23        - go/test:
    24            name: test-go-1.20
    25            gotestsum-format: testname
    26            executor:
    27              name: go/golang
    28              tag: 1.20-alpine
    29  
    30        - go/test:
    31            name: test-windows
    32            executor: windows
    33            pre-steps:
    34              - run: |
    35                  git config --global core.autocrlf false
    36                  git config --global core.symlinks true
    37              - run: |
    38                  choco upgrade golang
    39                  echo 'export PATH="$PATH:/c/Program Files/Go/bin"' > $BASH_ENV
    40              - run: go version
    41  
    42        - lint
    43        - build
    44        - run
    45  
    46        - update-windows-golden:
    47            filters:
    48              branches: {ignore: '/.*/'}
    49  
    50        - build:
    51            name: release
    52            publish: true
    53            filters:
    54              tags: {only: '/v[0-9]+(\.[0-9]+)*/'}
    55              branches: {ignore: '/.*/'}
    56  
    57  executors:
    58    windows:
    59      machine:
    60        image: windows-server-2019-vs2019:stable
    61        resource_class: windows.medium
    62        shell: bash.exe
    63  
    64  commands:
    65    install-goreleaser:
    66      description: Install goreleaser
    67      steps:
    68        - run:
    69            name: Install goreleaser
    70            command: |
    71              wget https://github.com/goreleaser/goreleaser/releases/download/v1.17.0/goreleaser_Linux_x86_64.tar.gz
    72              echo "9fb13d0b9611794da8d71688a50b1f2ea221fcd5f2f4ad529f8b45ee909b2371  goreleaser_Linux_x86_64.tar.gz" > checksum.txt
    73              sha256sum -c checksum.txt
    74              tar -xf goreleaser_Linux_x86_64.tar.gz
    75              mkdir -p ./bin
    76              mv goreleaser ./bin
    77  
    78  
    79  jobs:
    80  
    81    build:
    82      parameters:
    83        publish:
    84          type: boolean
    85          default: false
    86      executor:
    87        name: go/golang
    88        tag: 1.20-alpine
    89      steps:
    90        - go/install: {package: git}
    91        - go/install-ssh
    92        - checkout
    93        - go/mod-download
    94        - go/mod-tidy-check
    95        - install-goreleaser
    96        - unless:
    97            condition: << parameters.publish >>
    98            steps:
    99              run:
   100                name: build binaries
   101                command: bin/goreleaser --clean --snapshot --config .project/goreleaser.yml
   102        - when:
   103            condition: << parameters.publish >>
   104            steps:
   105              run:
   106                name: build and publish binaries
   107                command: bin/goreleaser --clean --skip-validate --config .project/goreleaser.yml
   108        - store_artifacts:
   109            path: ./dist
   110            destination: dist
   111  
   112    run:
   113      executor:
   114        name: go/golang
   115        tag: 1.20-alpine
   116      steps:
   117        - go/install: {package: git}
   118        - go/install-ssh
   119        - checkout
   120        - go/mod-download
   121        - run: |
   122            mkdir -p dist
   123            go build -o dist/gotestsum .
   124        - run: dist/gotestsum
   125  
   126    lint:
   127      executor:
   128        name: go/golang
   129        tag: 1.20-alpine
   130      steps:
   131        - checkout
   132        - run: go mod download
   133        - run:
   134            name: Install golangci-lint
   135            command: |
   136              mkdir -p /go/bin
   137  
   138              download=https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
   139              wget -O- -q "$download" | sh -s -- -b /go/bin/ v1.51.1
   140        - run:
   141            name: Lint
   142            command: |
   143              golangci-lint run -v --concurrency 2 --config .project/golangci-lint.yml
   144  
   145  
   146    update-windows-golden:
   147      executor: windows
   148      steps:
   149        - checkout
   150        - go/install-gotestsum
   151        - run: |
   152            git config --global core.autocrlf false
   153            git config --global core.symlinks true
   154        - run: |
   155            choco upgrade golang
   156            go version
   157  
   158        - run: |
   159            /go/bin/gotestsum ./testjson ./internal/junitxml -test.update-golden
   160  
   161        - store_artifacts:
   162            path: testjson/testdata/
   163            destination: golden