version: 2.1 jobs: build: docker: - image: cimg/go:1.14 steps: - checkout - restore_cache: keys: - go-mod-{{ checksum "go.sum" }}-v1 - go-mod-{{ checksum "go.sum" }} - go-mod - restore_cache: keys: - upx-3.96 - run: name: Install UPX command: | echo 'export PATH=$PATH:/home/circleci/upx/bin' >> $BASH_ENV if ! type "upx" > /dev/null; then wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz tar xf upx-3.96-amd64_linux.tar.xz mkdir -p /home/circleci/upx/bin mv upx-3.96-amd64_linux/upx /home/circleci/upx/bin chmod +x /home/circleci/upx/bin/upx fi - run: command: make dist - store_artifacts: path: build - save_cache: key: go-mod-{{ checksum "go.sum" }}-v1 paths: - /go/pkg/mod - save_cache: key: upx-3.96 paths: - /home/circleci/upx test: docker: - image: cimg/go:1.14 steps: - checkout - restore_cache: keys: - go-mod-{{ checksum "go.sum" }}-v1 - go-mod-{{ checksum "go.sum" }} - go-mod - run: command: make test workflows: version: 2 build-and-test: jobs: - build - test