Skip to content

Commit

Permalink
Build arm64, multi-arch image, update to go-1.22 and add HTTP2 support (
Browse files Browse the repository at this point in the history
#70)

* Test github runners

Testing different runners

* Add http2 support and update to go 1.22

* Fix some lint warning and optimize GH actions
  • Loading branch information
adidenko authored Jun 20, 2024
1 parent 71a6f14 commit 06f7cc9
Show file tree
Hide file tree
Showing 13 changed files with 164 additions and 530 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build-binaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ jobs:
build:
strategy:
matrix:
go-version: ["1.20"]
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ["1.22"]
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -22,4 +25,4 @@ jobs:
run: make build-${{ matrix.os }}

- name: List files
run: ls output/*
run: file output/*
46 changes: 46 additions & 0 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build Docker images

on: [pull_request]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion .github/workflows/go-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.22"
- name: Test
run: make test
7 changes: 5 additions & 2 deletions .github/workflows/publish-release-binaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ jobs:
package:
strategy:
matrix:
go-version: ["1.20"]
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ["1.22"]
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}

steps:
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/publish-release-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,30 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@f7b4ed12385588c3f9bc252f0a2b520d83b52d48
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.6.0] - 2024-07-20

### Added

- Support for HTTP2
- Update to Go 1.22
- Build GH actions to build arm64 binaries and multi-arch Docker images

## [0.5.1] - 2023-11-06

### Added
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# @authors Minigun Maintainers
# @copyright 2020 Wayfair, LLC -- All rights reserved.

FROM golang:1.20 as test
FROM golang:1.22 as test
ENV GOPATH=/go
ENV PATH="$PATH:$GOPATH/bin"
WORKDIR /go/src/github.com/wayfair-incubator/minigun
Expand Down
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,23 @@ test: $(VENDOR_DIR)
.PHONY: build-ubuntu-latest
build-ubuntu-latest: $(VENDOR_DIR) $(OUTPUT_DIR)
CGO_ENABLED=1 go build -a -ldflags '-extldflags "-static"' -o output/minigun .
cd output && tar czf minigun-linux64.tar.gz minigun
tar czf output/minigun-linux-amd64.tar.gz output/minigun
rm -f output/minigun
GOARCH=arm64 CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o output/minigun .
tar czf output/minigun-linux-arm64.tar.gz output/minigun
rm -f output/minigun

.PHONY: build-macos-latest
build-macos-latest: $(VENDOR_DIR) $(OUTPUT_DIR)
CGO_ENABLED=1 go build -a -ldflags '-extldflags "-static"' -o output/minigun .
cd output && tar czf minigun-darwin64.tar.gz minigun
tar czf output/minigun-darwin-amd64.tar.gz output/minigun
rm -f output/minigun
GOARCH=arm64 CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o output/minigun .
tar czf output/minigun-darwin-arm64.tar.gz output/minigun
rm -f output/minigun

.PHONY: build-windows-latest
build-windows-latest: $(VENDOR_DIR) $(OUTPUT_DIR)
CGO_ENABLED=1 go build -a -ldflags '-extldflags "-static"' -o output/minigun.exe .
cd output && tar czf minigun-win64.tar.gz minigun.exe
tar czf output/minigun-win64.tar.gz output/minigun.exe
rm -f output/minigun.exe
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Minigun

[![Minigun Version](https://img.shields.io/badge/Minigun-0.5.1-7f187f.svg)](https://github.com/wayfair-incubator/minigun/blob/main/CHANGELOG.md)
[![Minigun Version](https://img.shields.io/badge/Minigun-0.6.0-7f187f.svg)](https://github.com/wayfair-incubator/minigun/blob/main/CHANGELOG.md)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](CODE_OF_CONDUCT.md)

## About The Project
Expand Down Expand Up @@ -177,7 +177,7 @@ Or by checking the [following documentation page](./docs/report-help.md)
This is an example of how to list things you need to use the software and how to install them.

- Docker for image build.
- Golang 1.20 for local binary build.
- Golang 1.22 for local binary build.

### Building a Docker image

Expand Down
30 changes: 15 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
module github.com/wayfair-incubator/minigun

go 1.20
go 1.22

require (
github.com/dustin/go-humanize v1.0.0
github.com/google/logger v1.1.0
github.com/gorilla/mux v1.7.4
github.com/olekukonko/tablewriter v0.0.4
github.com/prometheus/client_golang v1.13.1
github.com/prometheus/client_model v0.2.0
github.com/dustin/go-humanize v1.0.1
github.com/google/logger v1.1.1
github.com/gorilla/mux v1.8.1
github.com/olekukonko/tablewriter v0.0.5
github.com/prometheus/client_golang v1.19.1
github.com/prometheus/client_model v0.6.1
golang.org/x/net v0.26.0
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/mattn/go-runewidth v0.0.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
google.golang.org/protobuf v1.28.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)
Loading

0 comments on commit 06f7cc9

Please sign in to comment.