From a1f5778c8b6faad1a71418d69e5a7adb9dcab7f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0tefan=20Baebler?= Date: Mon, 11 Dec 2023 20:02:41 +0100 Subject: [PATCH 1/2] Enable wasm build in CI, dummy term package non-implementation The dummy term package is needed in "display" builtin. --- .github/workflows/build.yml | 4 ++++ term/term.go | 3 +++ term/term_wasm.go | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 term/term_wasm.go diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 586a223d..6f098d01 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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" ./... diff --git a/term/term.go b/term/term.go index 1e9ea91a..fdc94aae 100644 --- a/term/term.go +++ b/term/term.go @@ -1,3 +1,6 @@ +//go:build !wasm +// +build !wasm + package term import ( diff --git a/term/term_wasm.go b/term/term_wasm.go new file mode 100644 index 00000000..30af0598 --- /dev/null +++ b/term/term_wasm.go @@ -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") +} From 37d5b38e9e68446de8c6a2b714dd63cbbb10ec60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0tefan=20Baebler?= Date: Mon, 11 Dec 2023 21:01:45 +0100 Subject: [PATCH 2/2] Use goreleaser for binary releases Test it localy via goreleaser release --snapshot --clean See - https://goreleaser.com/ - https://github.com/goreleaser/goreleaser --- .github/workflows/release.yml | 37 ++++++++++++++++++++++ .gitignore | 2 ++ .goreleaser.yaml | 59 +++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..a5ac1706 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/.gitignore b/.gitignore index f61f5e21..eb282c0e 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,5 @@ data.txt *.bleve *.big.csv *.tar.gz + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 00000000..0ef9e567 --- /dev/null +++ b/.goreleaser.yaml @@ -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 + - 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 + +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:"