Skip to content

Commit

Permalink
give installing built tools a name; rub some cache on things
Browse files Browse the repository at this point in the history
  • Loading branch information
robbkidd committed Sep 30, 2024
1 parent 2f044ba commit 1d6719d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
40 changes: 24 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ executors:
- image: cimg/go:1.21

commands:
setup_yq:
description: "Ensure the right yq is installed"
setup_build_tools:
description: "Ensure the build tools are installed"
steps:
- run:
name: Maybe install Python yq
name: Ensure the right yq is installed
command: |
if ! bin/yq --version; then
sudo apt-get update -qq
sudo apt-get install -y python3-pip
pip install yq
fi
- run:
name: Right yq?
command: |
bin/yq --version
- run:
name: Install build tools
command: make tools_exist

setup_remote_and_local_docker:
description: "Setup Docker and fiddle permissions when running local CI"
steps:
Expand All @@ -38,9 +39,9 @@ jobs:
test:
executor: go-executor
steps:
- setup_remote_and_local_docker
- checkout
- setup_yq
- setup_remote_and_local_docker
- setup_build_tools
- run:
name: Run tests
command: |
Expand All @@ -52,24 +53,31 @@ jobs:
build:
executor: go-executor
steps:
- setup_remote_and_local_docker
- checkout
- setup_yq
- attach_workspace:
at: .
- setup_remote_and_local_docker
- setup_build_tools
- run:
name: Build for target test platform
command: make build
- run:
name: Cross-compile binaries and build Docker image
name: Test
command: make test
- run:
name: Cross-compile binaries and build local Docker image
command: make all
- persist_to_workspace:
root: .
- save_cache:
key: go_build_cache-{{ .Environment.CIRCLE_SHA1 }}
paths:
- dist
- /home/circleci/.cache/go-build
- store_artifacts:
path: dist
publish_image:
executor: go-executor
steps:
- checkout
- restore_cache:
keys:
- go_build_cache-{{ .Environment.CIRCLE_SHA1 }}
- setup_remote_docker
- attach_workspace:
at: .
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ YQ=bin/yq
OCB=bin/ocb
GORELEASER=bin/goreleaser

.PHONY: tools_exist
tools_exist: $(YQ) $(OCB) $(GORELEASER)

.PHONY: all
all: config image

Expand Down

0 comments on commit 1d6719d

Please sign in to comment.