ali2210/WizDwarf

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
# Golang CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
jobs:
  build:
    docker:
      # specify the version
      - image: circleci/golang:1.16
        auth:
          username: ali2210
          password: hackmydockeraccount0511
      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/postgres:9.4
    parallelism: 2
        # environment varibles that build itself such as tests
    environment:
        # path where tests results store
        TEST_RESULTS: 
                /temp/test-results

    #### TEMPLATE_NOTE: go expects specific checkout path representing url
    #### expecting it in the form of
    ####   /go/src/github.com/circleci/go-tool
    ####   /go/src/bitbucket.org/circleci/go-tool
    working_directory: ~/my-app
    steps:
      - checkout
      ### create TEST_RESULTS Directory
      - run : sudo mkdir -p $TEST_RESULTS
      - setup_remote_docker:
          docker_layer_caching: false
          version: 19.03.13
      - restore_cache : #restore application state if there is no changes
          keys :
            - go mod-v4-{{ checksum  "go.sum" }}
            
      # build wizdwarfs docker image 
      - run: docker build -t ali2210/wizdwarfs-masterpiece . 
      
      # specify any bash command here prefixed with `run: `
      - run: go get -v -t -d ./...
      - run: go test -v ./...

      # pull and build dependencies
      # - run: make

      # save your cache
      - save-cache:
          key: 
              go mod-v4-{{checksum "go.sum"}}
          paths: 
             - "/go/pkg/mod" #path go mod

        # display artifacts summary
      - store_artifacts:
          path: 
            /temp/test-results
          destination: 
            raw-test-output

        #store test results
      - store_test_results:
          path: 
            /temp/test-results

    workflows:
      version: 2
      build-workflow:
            jobs:
              - build