diff --git a/.circleci/config.yml b/.circleci/config.yml index 90fc4e238082..026ae1d24fad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,77 +1,16 @@ version: 2.1 -orbs: - sonarcloud: sonarsource/sonarcloud@1.0.1 -commands: - restore_go_mod: - steps: - - restore_cache: - name: Restore go mod cache - keys: - - go-mod-v3-{{ checksum "go.sum" }}-{{ .Environment.CIRCLE_JOB }} - save_go_mod: - steps: - - save_cache: - name: Save go mod cache - key: go-mod-v3-{{ checksum "go.sum" }}-{{ .Environment.CIRCLE_JOB }} - paths: - - /home/circleci/.go_workspace/go/pkg/mod - when: always - install_golang: +jobs: + ci: + docker: + - image: cimg/base:2020.01 steps: - run: - name: Install Golang v1.13.4 + name: hello command: | - go get golang.org/dl/go1.13.4 - [ -e /home/circleci/sdk/go1.13.4 ] || go1.13.4 download - echo "export GOPATH=/home/circleci/.go_workspace" | tee -a $BASH_ENV - echo "export PATH=/home/circleci/sdk/go1.13.4/bin:\$PATH" | tee -a $BASH_ENV - save_go_cache: - steps: - - save_cache: - name: Save Golang cache - key: go-v7-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }} - paths: - - /home/circleci/.cache/go-build - - /home/circleci/sdk/go1.13.4 - when: always - restore_go_cache: - steps: - - restore_cache: - name: Restore Golang cache - keys: - - go-v7-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }} - - go-v7-master-{{ .Environment.CIRCLE_JOB }} -jobs: - sonar: - working_directory: /home/circleci/.go_workspace/src/github.com/argoproj/argo - machine: - image: ubuntu-1604:201903-01 - steps: - - checkout - - restore_go_cache - - install_golang - - restore_go_mod - - run: | - mkdir dist - cp sonar-project.properties dist/ - if [ "$(echo "$CIRCLE_BRANCH" | grep 'master\|release-')" = '' ]; then - echo "sonar.pullrequest.branch=$CIRCLE_BRANCH" >> sonar-project.properties - echo "sonar.pullrequest.key=$CIRCLE_PR_NUMBER" >> sonar-project.properties - fi - - sonarcloud/scan - - run: cp dist/sonar-project.properties . - - store_test_results: - path: test-results - when: always - - store_artifacts: - path: test-results - destination: . - when: always - - save_go_cache - - save_go_mod + echo "Hello, world" workflows: version: 2 - CI: + workflow: jobs: - - sonar + - ci