-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (126 loc) · 4.71 KB
/
wasip1_wasm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: wasip1/wasm (smoke test)
on:
push:
branches:
- 'master'
paths:
- 'action.yml'
- '.github/workflows/wasip1_wasm.yml'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
- name: Build go from tip
uses: iwdgo/gotip-build@master
id: gotip
with:
go_variables: GOOS=wasip1 GOARCH=wasm GOROOT_FINAL=/home/runner/work/gotip-build/gotip-build/go
test_build: false
- name: Install Go wasm
run: |
mv -f go/bin/${{ env.goos }}_${{ env.goarch }}/* go/bin/ # erase native build
- name: Test using wasmtime
run: |
curl https://wasmtime.dev/install.sh -sSf | bash
export WASMTIME_HOME="$HOME/.wasmtime"
echo $WASMTIME_HOME
export PATH="$WASMTIME_HOME/bin:$PATH"
echo $PATH
# wasmtime help
# Go config
export GOWASIRUNTIME=wasmtime
cd ./go
./misc/wasm/go_wasip1_wasm_exec ./bin/go env
./misc/wasm/go_wasip1_wasm_exec ./bin/go tool
# Set up as run.bash
export GO_TEST_TIMEOUT_SCALE=4
export GOPROXY="https://proxy.golang.org,direct"
export GOSUMDB="sum.golang.org"
export GOENV=off
eval $(./misc/wasm/go_wasip1_wasm_exec ./bin/go tool dist env)
unset CDPATH # in case user has it set
export GOHOSTOS
export CC
export GOPATH=/nonexist-gopath
# TODO Fails with go: RLock /home/runner/work/go-upon-ci/go-upon-ci/go/src/go.mod: unsupported operation
# ./misc/wasm/go_wasip1_wasm_exec ./bin/go test ./...
- name: Test using wazero
run: |
curl https://wazero.io/install.sh | sh
ls -l ./bin
export PATH="$(pwd)/bin:$PATH"
echo $PATH
wazero version
wazero -h
# Go config
export GOWASIRUNTIME=wazero
cd ./go
wazero run --cachedir=/home/runner/.cache/go-build -interpreter -mount=/:/ ./bin/go env
wazero run --cachedir=/home/runner/.cache/go-build -interpreter -mount=/:/ ./bin/go tool
# Set up as run.bash
export GO_TEST_TIMEOUT_SCALE=4
export GOPROXY="https://proxy.golang.org,direct"
export GOSUMDB="sum.golang.org"
export GOENV=off
eval $(./misc/wasm/go_wasip1_wasm_exec ./bin/go tool dist env)
unset CDPATH # in case user has it set
export GOHOSTOS
export CC
export GOPATH=/nonexist-gopath
# pattern ./...: directory prefix / does not contain main module or its selected dependencies
# wazero run --cachedir=/home/runner/.cache/go-build -interpreter -mount=/:/ ./bin/go test ./...
- name: Test using wasmedge
shell: bash
run: |
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash
source $HOME/.bashrc
export GOWASIRUNTIME=wasmedge
$HOME/.wasmedge/bin/wasmedge -v
# $HOME/.wasmedge/bin/wasmedge -h
echo $PATH
# Go config
export GOHOSTOS=wasip1 GOHOSTARCH=wasm
# Does not exist /home/runner/.config/go/env
cd ./go
$HOME/.wasmedge/bin/wasmedge --dir=/ --env PWD="$PWD" --env PATH="$PATH" ./bin/go env
$HOME/.wasmedge/bin/wasmedge --dir=/ --env PWD="$PWD" --env PATH="$PATH" ./bin/go tool
# Set up as run.bash
# export GO_TEST_TIMEOUT_SCALE=4
# export GOENV=off
# eval $($HOME/.wasmedge/bin/wasmedge --dir=/ --env PWD="$PWD" --env PATH="$PATH" ../bin/go run cmd/dist env)
# unset CDPATH # in case user has it set
# export CC
# export GOPATH=/nonexist-gopath
# $HOME/.wasmedge/bin/wasmedge --dir=/ --env PWD="$PWD" --env PATH="$PATH" ./bin/go
- name: Test using wasmer
if: false
run: |
curl https://get.wasmer.io -sSfL | sh
source /home/runner/.wasmer/wasmer.sh
export GOWASIRUNTIME=wasmer
wasmer -V
wasmer -h
# Go config
export GOHOSTOS=wasip1 GOHOSTARCH=wasm
# go env
cd ./go
wasmer run --dir=/ --env PWD="$PWD" --env PATH="$PATH" ./bin/go env
# Set up as run.bash
export GO_TEST_TIMEOUT_SCALE=4
export GOPROXY="https://proxy.golang.org,direct"
export GOSUMDB="sum.golang.org"
export GOENV=off
eval $(./misc/wasm/go_wasip1_wasm_exec ./bin/go run cmd/dist env)
unset CDPATH # in case user has it set
# export CC
export GOPATH=/nonexist-gopath
# ./misc/wasm/go_wasip1_wasm_exec ./bin/go test ./...
- name: Upload go executable
uses: actions/upload-artifact@v3
if: ${{ env.crosscompile == 'true' }}
with:
name: gotip-${{ env.goos }}-${{ env.arch }}
path: go/bin/