ci: enable CGO builds

This commit is contained in:
Mohamed Sohail 2023-01-06 11:42:58 +00:00
parent 0ccdaa0345
commit d9866196f9
Signed by: kamikazechaser
GPG Key ID: 7DD45520C01CD85D
5 changed files with 66 additions and 42 deletions

View File

@ -1,4 +1,4 @@
name: goreleaser
name: binary_release
on:
push:
@ -8,6 +8,8 @@ on:
jobs:
goreleaser:
runs-on: ubuntu-latest
container:
image: goreleaser/goreleaser-cross
environment: build
steps:
- name: Checkout
@ -18,18 +20,12 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19.3
go-version: 1.19
- name: Login to Docker Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: --parallelism 1 --rm-dist --skip-validate
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

30
.github/workflows/docker_release.yaml vendored Normal file
View File

@ -0,0 +1,30 @@
name: docker_release
on:
push:
tags:
- "v*"
jobs:
build-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/login-action@v1.14.1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: docker compose build push
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
run: |
export TAG=$GITHUB_REF_NAME
docker-compose -f docker-compose.build.yaml build --progress plain
docker-compose -f docker-compose.build.yaml push
export TAG=latest
docker-compose -f docker-compose.build.yaml build --progress plain
docker-compose -f docker-compose.build.yaml push

View File

@ -1,33 +0,0 @@
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
main: ./cmd
ldflags:
- -s -w
archives:
- format: tar.gz
files:
- LICENSE
- config.toml
- queries.sql
- migrations/*
dockers:
- goos: linux
goarch: amd64
ids:
- cic-chain-events
image_templates:
- "ghcr.io/grassrootseconomics/cic-chain-events/cic-chain-events:latest"
- "ghcr.io/grassrootseconomics/cic-chain-events/cic-chain-events:{{ .Tag }}"
dockerfile: Dockerfile
extra_files:
- LICENSE
- config.toml
- queries.sql
- migrations/*

21
.goreleaser.yaml Normal file
View File

@ -0,0 +1,21 @@
builds:
- id: linux-amd64
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
goos:
- linux
goarch:
- amd64
main: ./cmd
ldflags:
- -s -w
archives:
- format: tar.gz
files:
- LICENSE
- config.toml
- queries.sql
- migrations/

10
docker-compose.build.yaml Normal file
View File

@ -0,0 +1,10 @@
version: '3.9'
services:
cic-chain-events:
image: ${IMAGE_BASE_URL:-ghcr.io/grassrootseconomics/cic-chain-events}/cic-chain-events:${TAG:-latest}
build:
context: .
dockerfile: Dockerfile
cache_from:
- ${IMAGE_BASE_URL:-ghcr.io/grassrootseconomics/cic-chain-events}/cic-chain-events:latest