Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: darwin arm64 binary #690

Merged
merged 10 commits into from May 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 13 additions & 11 deletions .github/workflows/release.yml
Expand Up @@ -9,22 +9,24 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Go 1.17
uses: actions/setup-go@v3
with:
go-version: 1.17
id: go
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is used.


- name: Checkout Code
uses: actions/checkout@v3

- name: Fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
with:
version: latest
args: release --rm-dist
- name: release dry run
run: make release-dry-run
Comment on lines +23 to +24
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This container image is awfully big. I wouldn't want this running that often as I don't personally understand the implications for GHA for this org.


- name: setup release environment
run: |-
echo 'GITHUB_TOKEN=${{secrets.GORELEASER_GITHUB_TOKEN }}' > .release-env

- name: release publish
run: make release

22 changes: 19 additions & 3 deletions .goreleaser.yml
@@ -1,5 +1,6 @@
# GoReleaser config

---
before:
hooks:
- go mod tidy
Expand All @@ -14,17 +15,32 @@ builds:
- amd64
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
- CC=/osxcross/target/bin/o64-clang
- CXX=/osxcross/target/bin/o64-clang++
flags:
- -tags
- sqlite

- id: pop_linux
- id: pop_darwin_arm64
binary: soda
main: soda/main.go
goos:
- darwin
goarch:
- arm64
env:
- CGO_ENABLED=1
- CC=/osxcross/target/bin/oa64-clang
- CXX=/osxcross/target/bin/oa64-clang++
flags:
- -tags
- sqlite

- id: pop_linux
binary: soda
main: soda/main.go
env:
- CGO_ENABLED=0
flags:
- -tags
- sqlite
Expand Down
41 changes: 40 additions & 1 deletion Makefile
@@ -1,3 +1,6 @@
PACKAGE_NAME := github.com/gobuffalo/pop
GOLANG_CROSS_VERSION ?= v1.17.6

TAGS ?= "sqlite"
GO_BIN ?= go

Expand Down Expand Up @@ -37,5 +40,41 @@ endif
release-test:
./test.sh

.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 -
Comment on lines +43 to +49
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see anywhere that these functions are explicitly used, they just came from https://github.com/goreleaser/goreleaser-cross-example/blob/master/Makefile#L7-L13. These could probably be removed.


.PHONY: release-dry-run
release-dry-run:
@docker run \
--rm \
--privileged \
-e CGO_ENABLED=1 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-v `pwd`/sysroot:/sysroot \
-w /go/src/$(PACKAGE_NAME) \
goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
--rm-dist --skip-validate --skip-publish --snapshot
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was running without --snapshot goreleaser was complaining about not having tags available.


.PHONY: release
release:
release -y -f soda/cmd/version.go
@if [ ! -f ".release-env" ]; then \
echo "\033[91m.release-env is required for release\033[0m";\
exit 1;\
fi
docker run \
--rm \
--privileged \
-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) \
goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
release --rm-dist
1 change: 1 addition & 0 deletions executors_test.go
Expand Up @@ -556,6 +556,7 @@ func Test_Embedded_Struct(t *testing.T) {
r.NoError(tx.Find(&actual, entry.ID))
r.Equal(entry.AdditionalField, actual.AdditionalField)


entry.AdditionalField = entry.AdditionalField + "; updated again"
count, err := tx.Where("id = ?", entry.ID).UpdateQuery(entry, "additional_field")
r.NoError(err)
Expand Down