Skip to content

Commit

Permalink
feat: build & release darwin/arm64 binary (#961)
Browse files Browse the repository at this point in the history
* update goreleaser version

* install goreleaaser with apt

* fix version

* make apt quieter

* fix dockerfiles

* increase build executor resource class

* remove cache
  • Loading branch information
loderunner authored and JulesFaucherre committed Aug 7, 2023
1 parent d6df28a commit 92911e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
32 changes: 14 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ executors:
go:
docker:
- image: cimg/go:1.20
resource_class: large
environment:
CGO_ENABLED: 0
mac:
Expand All @@ -26,7 +27,7 @@ commands:
# https://app.circleci.com/jobs/github/CircleCI-Public/circleci-cli/6480
# curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
# The issue seems to be on the server-side, so force HTTP 1.1
name: 'cURL: Force HTTP 1.1'
name: "cURL: Force HTTP 1.1"
command: echo '--http1.1' >> ~/.curlrc
build-docker-image:
steps:
Expand All @@ -42,36 +43,31 @@ commands:
command: |
docker build -t circleci/circleci-cli:0.1.$CIRCLE_BUILD_NUM-alpine --file Dockerfile.alpine .
docker run --rm circleci/circleci-cli:0.1.$CIRCLE_BUILD_NUM-alpine update check
deploy-save-cache-workspace-and-artifacts:
deploy-save-workspace-and-artifacts:
steps:
- save_cache:
key: v4-goreleaser-{{ checksum "~/goreleaser_amd64.deb" }}
paths: [~/goreleaser_amd64.deb]
- persist_to_workspace:
root: .
paths:
- 'dist'
- "dist"
- store_artifacts:
path: ./dist
destination: dist
install-goreleaser:
parameters:
GORELEASER_URL:
version:
type: string
default: https://github.com/goreleaser/goreleaser/releases/download/v0.184.0/goreleaser_amd64.deb
default: "1.19.1"
steps:
- restore_cache:
keys: [v5-goreleaser-]
- run:
name: Install GoReleaser
command: |
[ -f ~/goreleaser_amd64.deb ] || curl --silent --location --fail --retry 3 << parameters.GORELEASER_URL >> > ~/goreleaser_amd64.deb
sudo apt-get update -y
sudo apt install ~/goreleaser_amd64.deb
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
sudo apt -q update -y
sudo apt -q install -y --no-install-recommends goreleaser=<< parameters.version >>
gomod:
steps:
- restore_cache:
keys: ['v3-gomod-{{ arch }}-']
keys: ["v3-gomod-{{ arch }}-"]
- run:
name: Download go module dependencies
command: go mod download
Expand Down Expand Up @@ -122,7 +118,7 @@ jobs:
- persist_to_workspace:
root: .
paths:
- 'build'
- "build"
cucumber:
docker:
- image: cimg/ruby:2.7
Expand All @@ -131,7 +127,7 @@ jobs:
- attach_workspace:
at: .
- run:
name: 'Install CLI tool from workspace'
name: "Install CLI tool from workspace"
command: sudo cp ~/project/build/linux/amd64/circleci /usr/local/bin/
- run:
command: bundle install
Expand Down Expand Up @@ -210,7 +206,7 @@ jobs:
docker_layer_caching: true
- build-docker-image
- build-alpine-image
- deploy-save-cache-workspace-and-artifacts
- deploy-save-workspace-and-artifacts

deploy:
executor: go
Expand Down Expand Up @@ -247,7 +243,7 @@ jobs:
docker push circleci/circleci-cli:0.1.$CIRCLE_BUILD_NUM-alpine
docker tag circleci/circleci-cli:0.1.$CIRCLE_BUILD_NUM-alpine circleci/circleci-cli:alpine
docker push circleci/circleci-cli:alpine
- deploy-save-cache-workspace-and-artifacts
- deploy-save-workspace-and-artifacts

snap:
docker:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ LABEL maintainer="Developer Experience Team <[email protected]>"

ENV CIRCLECI_CLI_SKIP_UPDATE_CHECK true

COPY ./dist/circleci-cli_linux_amd64/circleci /usr/local/bin
COPY ./dist/circleci-cli_linux_amd64_v1/circleci /usr/local/bin
2 changes: 1 addition & 1 deletion Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM alpine:3.8

ENV CIRCLECI_CLI_SKIP_UPDATE_CHECK true

COPY ./dist/circleci-cli_linux_amd64/circleci /usr/local/bin
COPY ./dist/circleci-cli_linux_amd64_v1/circleci /usr/local/bin

RUN apk add --no-cache --upgrade git openssh ca-certificates

Expand Down

0 comments on commit 92911e3

Please sign in to comment.