# Workflow based configuration version: 2 aliases: - &golang-image image: circleci/golang:1.10 - &working-dir /go/src/github.com/ansible-semaphore/semaphore - &store-bin-artifacts store_artifacts: path: /go/src/github.com/ansible-semaphore/semaphore/bin - &install-task-binary run: name: install task binary command: | cd /go/bin curl -L https://github.com/go-task/task/releases/download/v2.0.1/task_linux_amd64.tar.gz | tar xvz cd - - &persist-bin persist_to_workspace: root: . paths: - bin/* - &install-node run: name: Install node command: | set +e curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" nvm install 8.2.0 && nvm alias default 8.2.0 # Each step uses the same `$BASH_ENV`, so need to modify it echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV - &test-compile-changes run: name: test that compile did not create/modify untracked files command: git diff --exit-code --stat -- . ':(exclude)web/package-lock.json' - &save-npm-cache save_cache: key: v1-npm-deps-{{ checksum "web/package.json" }} paths: - web/node_modules - &save-go-cache save_cache: key: v1-go-deps-{{ checksum "Gopkg.lock" }}-{{ checksum "Gopkg.toml" }} paths: - vendor - &load-npm-cache restore_cache: keys: - v1-npm-deps-{{ checksum "web/package.json" }} - v1-npm-deps- - &load-go-cache restore_cache: keys: - v1-go-deps-{{ checksum "Gopkg.lock" }}-{{ checksum "Gopkg.toml" }} - v1-go-deps-{{ checksum "Gopkg.lock" }} - v1-go-deps- jobs: build:local: docker: - *golang-image working_directory: *working-dir steps: - run: export - *install-node - *install-task-binary - checkout - *load-go-cache - *load-npm-cache - run: task deps - *save-go-cache - *save-npm-cache - run: task compile - *test-compile-changes - run: task build:local - *store-bin-artifacts - *persist-bin build: docker: - *golang-image working_directory: *working-dir steps: - *install-node - *install-task-binary - run: sudo apt-get install rpm - checkout - *load-go-cache - *load-npm-cache - run: task deps - run: task compile - *test-compile-changes - run: task build - *store-bin-artifacts # Run goverage and post results test:golang: docker: - *golang-image working_directory: *working-dir steps: - *install-task-binary # Needed only in ci to post coverage reports - run: go get github.com/schrej/godacov - checkout - *load-go-cache - run: task deps:tools - run: task deps:be - run: task compile:be - run: task test - run: godacov -t "${CODACY_TOKEN}" -r ./coverage.out -c "${CIRCLE_SHA1}" || true - store_test_results: path: /go/src/github.com/ansible-semaphore/semaphore/coverage.out - store_artifacts: path: /go/src/github.com/ansible-semaphore/semaphore/coverage.out test:integration: docker: - *golang-image - image: circleci/mysql working_directory: *working-dir steps: - attach_workspace: at: *working-dir # This looks like utter filth in circleci v2 but we have no choice apart from this escaping madness - run: "cat > config.json <