diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4eb7821c..e974c1ce 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 - - - 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 + + - name: setup release environment + run: |- + echo 'GITHUB_TOKEN=${{secrets.GORELEASER_GITHUB_TOKEN }}' > .release-env + + - name: release publish + run: make release + diff --git a/.goreleaser.yml b/.goreleaser.yml index f22cfd3f..5588bc8a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,6 @@ # GoReleaser config +--- before: hooks: - go mod tidy @@ -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 diff --git a/Makefile b/Makefile index 893e46e8..5bced524 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +PACKAGE_NAME := github.com/gobuffalo/pop +GOLANG_CROSS_VERSION ?= v1.17.6 + TAGS ?= "sqlite" GO_BIN ?= go @@ -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 - + +.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 + +.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 diff --git a/executors_test.go b/executors_test.go index ddafdb5a..e03ee2e3 100644 --- a/executors_test.go +++ b/executors_test.go @@ -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)