Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
πŸ‘• refactor: update repo structure and add CI tests (#7)
Browse files Browse the repository at this point in the history
* 🚚 update: re-structure repository

Move things around, change packaging order, and make sure ONLY 1 go.mod in the entire tree except for `replace` directory.

Signed-off-by: Gaukas Wang <i@gaukas.wang>

* fix: wasm missing build constraints

Signed-off-by: Gaukas Wang <i@gaukas.wang>

* new: add plain example for WATM v0

Signed-off-by: Gaukas Wang <i@gaukas.wang>

* build: add github action workflow

Signed-off-by: Gaukas Wang <i@gaukas.wang>

* fix: missing build tag for watms

Signed-off-by: Gaukas Wang <i@gaukas.wang>

---------

Signed-off-by: Gaukas Wang <i@gaukas.wang>
  • Loading branch information
gaukas authored Feb 5, 2024
1 parent 2029dc7 commit 21695f9
Show file tree
Hide file tree
Showing 506 changed files with 244 additions and 105 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/build-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "Build example WATM on new tags"

# Build only on new tags
on:
push:
tags:
- '*'

env:
CGO_ENABLED: 0

jobs:
tinygo_v0:
name: "Build TinyGo Examples for WATM v0"
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
examples: [ "plain", "reverse", "utls" ] # Add more examples here, corresponding directories must exist under tinygo/v0/examples
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21.x"
- uses: acifani/setup-tinygo@v2
with:
tinygo-version: '0.30.0'
- name: Build WASI Artifacts
run: tinygo build -o ${{ matrix.examples }}.wasm
-target=wasi -no-debug -scheduler=none -gc=leaking
-tags=purego
./tinygo/v0/examples/${{ matrix.examples }}/
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: tinygo_v0_${{ matrix.examples }}.wasm
path: tinygo_v0_${{ matrix.examples }}.wasm
retention-days: 1

release:
needs: tinygo_v0
name: "Release WATM Examples for ${{ github.ref_name }}"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: release-${{ github.ref_name }} # all artifacts
- name: Release
uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ github.ref_name }}
files: |
release-${{ github.ref_name }}/*.wasm
51 changes: 51 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Go"

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
CGO_ENABLED: 0

jobs:
go_test_all:
name: "Run go test on all packages"
runs-on: ubuntu-latest
strategy:
matrix:
go: [ "1.20.x", "1.21.x" ] # we support the latest 2 stable versions of Go
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- run: go version
- name: Build and Test
run: |
go build -v ./...
go test -v ./...
tinygo_build:
name: "Build TinyGo"
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
go: [ "1.20.x", "1.21.x" ] # we support the latest 2 stable versions of Go
examples: [ "plain", "reverse", "utls" ] # Add more examples here, corresponding directories must exist under tinygo/v0/examples
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- uses: acifani/setup-tinygo@v2
with:
tinygo-version: '0.30.0'
- name: Build
run: |
tinygo build -o ${{ matrix.examples }}.wasm -target wasi -tags=purego ./tinygo/v0/examples/${{ matrix.examples }}/
ls -l
18 changes: 17 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,20 @@ module github.com/gaukas/watm

go 1.20

replace golang.org/x/sys v0.16.0 => ./x/sys
replace golang.org/x/sys v0.16.0 => ./replace/x/sys

replace github.com/tetratelabs/wazero v1.6.0 => github.com/gaukas/wazero v1.6.5-w

require (
github.com/refraction-networking/utls v1.6.2-wasm
github.com/tetratelabs/wazero v1.6.0
)

require (
github.com/andybalholm/brotli v1.0.6 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/quic-go/quic-go v0.40.1 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/sys v0.16.0 // indirect
)
24 changes: 24 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI=
github.com/andybalholm/brotli v1.0.6/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
github.com/gaukas/wazero v1.6.5-w h1:tSQbdHJjYcH9GmQ/5aObsTdbsw44pRT2eqw8HXIuWKg=
github.com/gaukas/wazero v1.6.5-w/go.mod h1:0U0G41+ochRKoPKCJlh0jMg1CHkyfK8kDqiirMmKY8A=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4=
github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q=
github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
github.com/quic-go/quic-go v0.40.1 h1:X3AGzUNFs0jVuO3esAGnTfvdgvL4fq655WaOi1snv1Q=
github.com/quic-go/quic-go v0.40.1/go.mod h1:PeN7kuVJ4xZbxSv/4OX6S1USOX8MJvydwpTx31vx60c=
github.com/refraction-networking/utls v1.6.2-wasm h1:drfuC2K0ooAWqEBc6fpZvFOO6O2go3jbd29UlrbUcjU=
github.com/refraction-networking/utls v1.6.2-wasm/go.mod h1:yil9+7qSl+gBwJqztoQseO6Pr3h62pQoY1lXiNR/FPs=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 21695f9

Please sign in to comment.