Skip to content

Commit

Permalink
* Fixed build
Browse files Browse the repository at this point in the history
* Include self-cycles
* Add back doc images
* Update README.md and -help
  • Loading branch information
RyanJarv committed Aug 22, 2024
1 parent 5d1dad8 commit 8ee8640
Show file tree
Hide file tree
Showing 13 changed files with 169 additions and 215 deletions.
Binary file added .github/workflows/.go-release.yml.swp
Binary file not shown.
52 changes: 12 additions & 40 deletions .github/workflows/go-release.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,21 @@
name: Go Release

name: release
on:
push:
tags:
- 'v*'

permissions:
contents: write


- v*
jobs:
goreleaser:
release:
runs-on: ubuntu-latest
container:
image: ghcr.io/ryanjarv/xcgo:master@sha256:4db5d37a4762e6a074eb2f85c7267d521ddd9857b69467feaa56465f8375742a
volumes:
- ${{ github.workspace }}:/${{ github.workspace }}
defaults:
run:
shell: bash
working-directory: ${{ github.workspace }}
steps:
-
name: Checkout
- name: checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
submodules: 'true'
- run: git fetch --prune --unshallow
- name: setup dependencies
uses: actions/setup-go@v2
with:
stable: 'true'
go-version: 1.18.0
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Upload assets
uses: actions/upload-artifact@v2
with:
name: myapp
path: dist/*
- name: setup release environment
run: |-
echo 'GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}' > .release-env
- name: release publish
run: make release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
.sw[a-z]
.release-env

dist/
78 changes: 42 additions & 36 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,56 +1,62 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
- id: darwin
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
- id: darwin-amd64
main: ./
binary: liquidswards
goos:
- darwin
goarch:
- amd64
- arm64
- id: linux
env:
- CGO_ENABLED=1
- PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64
- PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig
- CC=o64-clang
- CXX=o64-clang++
flags:
- -mod=readonly
ldflags:
- -s -w -X main.version={{.Version}}
- id: linux-armhf
main: ./
binary: liquidswards
goos:
- linux
# Not working atm:
# - arm64
goarch:
- amd64
- id: windows
- arm
goarm:
- 7
env:
- CGO_ENABLED=1
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
goos:
- windows
goarch:
- amd64
# Not working atm:
# - arm64
- CC=arm-linux-gnueabihf-gcc
- CXX=arm-linux-gnueabihf-g++
- CGO_CFLAGS=--sysroot=/sysroot/linux/armhf
- CGO_LDFLAGS=--sysroot=/sysroot/linux/armhf
- PKG_CONFIG_SYSROOT_DIR=/sysroot/linux/armhf
- PKG_CONFIG_PATH=/sysroot/linux/armhf/opt/vc/lib/pkgconfig:/sysroot/linux/armhf/usr/lib/arm-linux-gnueabihf/pkgconfig:/sysroot/linux/armhf/usr/lib/pkgconfig:/sysroot/linux/armhf/usr/local/lib/pkgconfig
flags:
- -mod=readonly
ldflags:
- -s -w -X main.version={{.Version}}
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
- id: golang-cross
builds:
- darwin-amd64
- linux-armhf
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
format: zip
wrap_in_directory: true
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
name_template: "{{ .Tag }}"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

release:
github:
owner: goreleaser
name: golang-cross-example
prerelease: auto
draft: false
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
PACKAGE_NAME := github.com/ryanjarv/liquidswards
GOLANG_CROSS_VERSION ?= v1.19.5

SYSROOT_DIR ?= sysroots
SYSROOT_ARCHIVE ?= sysroots.tar.bz2

.PHONY: sysroot-pack
sysroot-pack:
@tar cf - $(SYSROOT_DIR) -P | pv -s $[$(du -sk $(SYSROOT_DIR) | awk '{print $1}') * 1024] | pbzip2 > $(SYSROOT_ARCHIVE)

.PHONY: sysroot-unpack
sysroot-unpack:
@pv $(SYSROOT_ARCHIVE) | pbzip2 -cd | tar -xf -

.PHONY: release
release:
@if [ ! -f ".release-env" ]; then \
echo "\033[91m.release-env is required for release\033[0m";\
exit 1;\
fi
docker run \
--rm \
-e CGO_ENABLED=1 \
--env-file .release-env \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-v `pwd`/sysroot:/sysroot \
-w /go/src/$(PACKAGE_NAME) \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
release --clean
Loading

0 comments on commit 8ee8640

Please sign in to comment.