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

Use goreleaser for binary releases #57

Merged
merged 2 commits into from
Dec 11, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@ jobs:
run: cd tests ; ../bin/rye main.rye test
timeout-minutes: 1

- name: Build WASM
run: |
GOOS=js GOARCH=wasm go build -v -tags "b_tiny,b_norepl" -o wasm/rye.wasm main_wasm.go

# - name: Test
# run: go test -v -tags "b_tiny,b_sqlite,b_http,b_sql,b_postgres,b_openai,b_bson,b_crypto,b_smtpd,b_mail,b_postmark,b_bcrypt,b_telegram" ./...
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# .github/workflows/release.yml
name: goreleaser

on:
push:
tags:
- 'v*.*.*'

permissions:
contents: write
# packages: write
# issues: write

jobs:
goreleaser:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needs full git history for changelog generation
submodules: true

- run: git fetch --force --tags

- uses: actions/setup-go@v4
with:
go-version: stable

- uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro':
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ data.txt
*.bleve
*.big.csv
*.tar.gz

dist/
59 changes: 59 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines bellow are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

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:
- env:
- CGO_ENABLED=0
goos:
- linux
# - windows
refaktor marked this conversation as resolved.
Show resolved Hide resolved
- darwin
- js
goarch:
- amd64
- arm
- arm64
- wasm

ignore: # List of combinations of GOOS + GOARCH + GOARM to ignore.
# - goos: windows
# goarch: arm64
# - goos: windows
# goarch: arm

flags:
- -tags=b_tiny,b_norepl
Copy link
Contributor Author

@stefanb stefanb Dec 12, 2023

Choose a reason for hiding this comment

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

@refaktor, here are the release build tags defined, including the b_norepl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because omitting b_norepl tag is not ok for wasm build I made an override:


archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
3 changes: 3 additions & 0 deletions term/term.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build !wasm
// +build !wasm

package term

import (
Expand Down
33 changes: 33 additions & 0 deletions term/term_wasm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//go:build wasm
// +build wasm

package term

import (
"rye/env"
)

// DisplayBlock is dummy non-implementation for wasm for display builtin
func DisplayBlock(bloc env.Block, idx *env.Idxs) (env.Object, bool) {
panic("unimplemented")
}

// DisplayDict is dummy non-implementation for wasm for display builtin
func DisplayDict(bloc env.Dict, idx *env.Idxs) (env.Object, bool) {
panic("unimplemented")
}

// DisplaySpreadsheetRow is dummy non-implementation for wasm for display builtin
func DisplaySpreadsheetRow(bloc env.SpreadsheetRow, idx *env.Idxs) (env.Object, bool) {
panic("unimplemented")
}

// DisplayTable is dummy non-implementation for wasm for display builtin
func DisplayTable(bloc env.Spreadsheet, idx *env.Idxs) (env.Object, bool) {
panic("unimplemented")
}

// SaveCurPos is dummy non-implementation for wasm for display builtin
func SaveCurPos() {
panic("unimplemented")
}
Loading