Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8a765f3
feat: nix flake for numscript wask with tiny go
debora-be Dec 24, 2024
5bebea5
feat: numscript-wasm github pipeline
debora-be Dec 24, 2024
7d92f45
feat: add wasm build pipeline and dev env config
debora-be Dec 24, 2024
a450c05
Merge branch 'main' into feat/ci-cd-for-numscript#86b37qfxt
debora-be Dec 27, 2024
4484331
feat: update release
debora-be Dec 27, 2024
ce0d9bc
feat: exact go version for testing with act
debora-be Dec 27, 2024
73ae6a3
feat: script for downloading wasm
debora-be Dec 27, 2024
ae223e8
chore: adjust .gitignore
debora-be Dec 27, 2024
f2e669d
feat: nix workflow
debora-be Dec 27, 2024
e583886
chore: apply suggestions from code review
debora-be Jan 3, 2025
5973823
chore: apply review suggestions
debora-be Jan 3, 2025
15b662c
chore: merge main
debora-be Jan 3, 2025
0a02fac
Merge main
Vinocis Jan 8, 2025
ea12888
Fix module name
Vinocis Jan 9, 2025
66a9a6c
Fix release CI
Vinocis Jan 9, 2025
9813bf1
Merge branch 'main' into feat/ci-cd-for-numscript#86b37qfxt
Vinocis Jan 9, 2025
dbf01cd
Fix build
Vinocis Jan 9, 2025
d5910d5
Fix module name on 'numscript.go'
Vinocis Jan 9, 2025
60c0bbd
Run go mod tidy
Vinocis Jan 10, 2025
3ba3ecc
Fix module name on 'numscript_test.go'
Vinocis Jan 10, 2025
c4da050
chore: improve nix ci
debora-be Jan 13, 2025
217c168
chore: fix nodejs version
debora-be Jan 13, 2025
b3c33d9
chore: fix build
debora-be Jan 13, 2025
dbf6104
feat: configure with matrix
debora-be Jan 13, 2025
6aea37e
Remove snapshot flag on release workflow
Vinocis Jan 13, 2025
52be60c
Put version on binary name
Vinocis Jan 14, 2025
20d12fb
Revert last commit
Vinocis Jan 14, 2025
c72056d
Remove unused script
Vinocis Jan 19, 2025
2ffba76
Rename release tar.gz file
Vinocis Jan 19, 2025
5d7928d
Archive just the binary on release
Vinocis Jan 20, 2025
bbe73a5
Strip unused features off of the binary
Vinocis Jan 20, 2025
d4443c9
Download TinyGo deb file on tmp dir
Vinocis Jan 21, 2025
564f0e4
Revert changes from commit '5973823'
Vinocis Jan 21, 2025
6c5efa4
update flake.nix
debora-be Jan 23, 2025
9abb84f
Now TinyGo builds with target flag instead of GOOS and GOARCH vars
Vinocis Jan 23, 2025
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
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
40 changes: 40 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Nix CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
configure:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: echo "matrix=$(nixci gh-matrix --systems=x86_64-linux,aarch64-darwin | jq -c .)" >> $GITHUB_OUTPUT

nix:
runs-on: ${{ matrix.system }}
permissions:
contents: read
needs: configure
strategy:
matrix: ${{ fromJson(needs.configure.outputs.matrix) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- run: |
nixci \
--extra-access-tokens "github.com=${{ secrets.GITHUB_TOKEN }}" \
build \
--systems "${{ matrix.system }}" \
.#default.${{ matrix.subflake}}

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: numscript-wasm-${{ matrix.system }}
path: build/numscript.wasm
47 changes: 32 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,48 @@
name: release
name: Release

on:
release:
types: [created]

permissions:
contents: write

jobs:
build:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
with:
go-version: "1.22"
- uses: actions/checkout@v2
- uses: actions/cache@v2
fetch-depth: 0

- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
path: /tmp/.cache
key: ${{ runner.os }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-go-
- name: get deps
run: go mod download
${{ runner.os }}-build-

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22"
cache: true

- name: Install TinyGo
run: |
wget -P tmp/ https://github.com/tinygo-org/tinygo/releases/download/v0.34.0/tinygo_0.34.0_amd64.deb
sudo dpkg -i tmp/tinygo_0.34.0_amd64.deb

- name: Get dependencies
run: |
go mod download
go mod verify

- name: Run GoReleaser
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,14 @@ coverage.*

numscript
numscript.wasm


# WASM builds
build/
*.wasm

# Go specific
/vendor/
/bin/
*.test
/coverage.txt
34 changes: 13 additions & 21 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,27 @@ builds:
- CGO_ENABLED=0
main: ./internal/numscript/numscript.go
goos:
- linux
- windows
- darwin
- wasip1
goarch:
- amd64
- arm64
- wasm
tool: "tinygo"
hooks:
pre:
pre:
- mkdir -p {{ dir .Path }}
binary: numscript
binary: ../numscript
ldflags:
- -X main.Version=v{{ .Version }}
flags:
- -scheduler=none
- -no-debug
- -target=wasi

checksum:
name_template: "numscript_checksums.txt"

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{ .Version }}_
{{- 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
- format: binary
name_template: "numscript"

changelog:
sort: asc
Expand Down
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
description = "A Nix flake for NumScript WASM compilation";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
inherit (pkgs.lib) optional optionals;
pkgs = import nixpkgs { inherit system; };

inputs = with pkgs; [
go
tinygo
git
just
] ++ optional stdenv.isLinux inotify-tools
++ optionals stdenv.isDarwin
(with darwin.apple_sdk.frameworks; [ CoreFoundation CoreServices ]);

in with pkgs; {
devShells.default = mkShell {
name = "numscript-wasm";
packages = inputs;

shellHook = ''
echo "NumScript WASM development environment"
echo "TinyGo version: $(tinygo version)"
echo "Go version: $(go version)"
'';
};
});
}
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module github.com/PagoPlus/numscriptex
module github.com/PagoPlus/numscript-wasm

go 1.22.1

replace github.com/PagoPlus/numscriptex => github.com/PagoPlus/numscriptex v0.0.0-20241202132127-f10ae2504bbc

require (
github.com/Jeffail/gabs/v2 v2.7.0
github.com/antlr4-go/antlr/v4 v4.13.1
Expand Down
4 changes: 2 additions & 2 deletions internal/analysis/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"math/big"
"slices"

"github.com/PagoPlus/numscriptex/internal/parser"
"github.com/PagoPlus/numscriptex/internal/utils"
"github.com/PagoPlus/numscript-wasm/internal/parser"
"github.com/PagoPlus/numscript-wasm/internal/utils"
)

const TypeMonetary = "monetary"
Expand Down
4 changes: 2 additions & 2 deletions internal/analysis/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"math/big"
"testing"

"github.com/PagoPlus/numscriptex/internal/analysis"
"github.com/PagoPlus/numscriptex/internal/parser"
"github.com/PagoPlus/numscript-wasm/internal/analysis"
"github.com/PagoPlus/numscript-wasm/internal/parser"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
4 changes: 2 additions & 2 deletions internal/analysis/diagnostic_kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"math/big"

"github.com/PagoPlus/numscriptex/internal/ansi"
"github.com/PagoPlus/numscriptex/internal/utils"
"github.com/PagoPlus/numscript-wasm/internal/ansi"
"github.com/PagoPlus/numscript-wasm/internal/utils"
)

type Severity = byte
Expand Down
2 changes: 1 addition & 1 deletion internal/analysis/document_symbols.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package analysis

import (
"github.com/PagoPlus/numscriptex/internal/parser"
"github.com/PagoPlus/numscript-wasm/internal/parser"
)

type DocumentSymbolKind = float64
Expand Down
4 changes: 2 additions & 2 deletions internal/analysis/document_symbols_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"slices"
"testing"

"github.com/PagoPlus/numscriptex/internal/analysis"
"github.com/PagoPlus/numscriptex/internal/parser"
"github.com/PagoPlus/numscript-wasm/internal/analysis"
"github.com/PagoPlus/numscript-wasm/internal/parser"

"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/analysis/goto_definition.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package analysis

import "github.com/PagoPlus/numscriptex/internal/parser"
import "github.com/PagoPlus/numscript-wasm/internal/parser"

type GotoDefinitionResult struct {
Range parser.Range
Expand Down
4 changes: 2 additions & 2 deletions internal/analysis/goto_definition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package analysis_test
import (
"testing"

"github.com/PagoPlus/numscriptex/internal/analysis"
"github.com/PagoPlus/numscriptex/internal/parser"
"github.com/PagoPlus/numscript-wasm/internal/analysis"
"github.com/PagoPlus/numscript-wasm/internal/parser"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
4 changes: 2 additions & 2 deletions internal/analysis/hover.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package analysis

import (
"github.com/PagoPlus/numscriptex/internal/parser"
"github.com/PagoPlus/numscriptex/internal/utils"
"github.com/PagoPlus/numscript-wasm/internal/parser"
"github.com/PagoPlus/numscript-wasm/internal/utils"
)

type Hover interface{ hover() }
Expand Down
4 changes: 2 additions & 2 deletions internal/analysis/hover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package analysis_test
import (
"testing"

"github.com/PagoPlus/numscriptex/internal/analysis"
"github.com/PagoPlus/numscriptex/internal/parser"
"github.com/PagoPlus/numscript-wasm/internal/analysis"
"github.com/PagoPlus/numscript-wasm/internal/parser"

"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"sort"

"github.com/PagoPlus/numscriptex/internal/analysis"
"github.com/PagoPlus/numscript-wasm/internal/analysis"

"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/lsp.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/PagoPlus/numscriptex/internal/lsp"
"github.com/PagoPlus/numscript-wasm/internal/lsp"

"github.com/spf13/cobra"
)
Expand Down
Loading
Loading