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

Refactor and test the compiler #93

Merged
merged 33 commits into from
May 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a4fe23a
add initial compiler test
matthewmueller May 19, 2022
4eeac85
test CI against a linked V8
matthewmueller May 20, 2022
a42820c
wip compiler refactor
matthewmueller May 20, 2022
a809cd4
starting to consolidate
matthewmueller May 22, 2022
1d17888
more consolidation
matthewmueller May 22, 2022
4167724
wip
matthewmueller May 23, 2022
cb1f483
consolidating
matthewmueller May 23, 2022
13772d5
working on new test runner
matthewmueller May 24, 2022
3e1dc52
finalize testing apis
matthewmueller May 25, 2022
31395f1
migrating tests
matthewmueller May 25, 2022
c735268
improve testcli http response handling and started refactoring contro…
matthewmueller May 25, 2022
a155e3f
refactor controller, view and public tests
matthewmueller May 25, 2022
eab452f
revert error formatting, will do it top-level instead. refactor remai…
matthewmueller May 26, 2022
333fa39
extract out file descriptor passing. work on remaining tests
matthewmueller May 26, 2022
1ee44d2
fix remaining failed tests
matthewmueller May 26, 2022
0fe3c08
update test script to install bud binary into /usr/local/go/bin:/usr/…
matthewmueller May 26, 2022
6f26ec6
use go to install bud
matthewmueller May 26, 2022
3d04db9
fix public test for CI
matthewmueller May 26, 2022
7571323
fix public tests
matthewmueller May 26, 2022
2f1436c
add hot client for testing the hot server. trying to reproduce view e…
matthewmueller May 27, 2022
10c17ec
add custom flag parsing support
matthewmueller May 27, 2022
3649a90
add dockerfile for development and fix failing ubuntu tests
matthewmueller May 28, 2022
3a6795d
update timeout
matthewmueller May 28, 2022
63bfe61
remove unused go modules
matthewmueller May 28, 2022
7c9ca94
delete unused files
matthewmueller May 28, 2022
9b51c92
replace matryer/is with internal/is.
matthewmueller May 28, 2022
9716d66
fix formatting
matthewmueller May 28, 2022
96ce936
fix hot reload and scaffolding new root controllers
matthewmueller May 28, 2022
c8300d7
debug panic
matthewmueller May 28, 2022
94870e8
fix test
matthewmueller May 28, 2022
7dc82cf
debug panic
matthewmueller May 28, 2022
d3f11a4
add error check and test for panic seen in CI
matthewmueller May 29, 2022
6430b17
Support Go 1.16+
matthewmueller May 29, 2022
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
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jobs:
livebud/package-lock.json
package-lock.json
# Temporary fix to get the tests working until we pass the V8 client as a
# os.Pipe
- name: Install bud binary into $PATH
run: go install github.com/livebud/bud@latest

Copy link
Contributor Author

@matthewmueller matthewmueller May 29, 2022

Choose a reason for hiding this comment

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

This will go away soon, we'll change v8client to use os.Pipe and the same technique we're using with TCP listeners to pass the file descriptors through the binaries via ExtraFiles. This is mostly setup now, just needs to be refactored in.

- name: Install bud node_modules
run: npm ci

Expand Down
4 changes: 1 addition & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ Check out the Hacker News [demo](https://www.youtube.com/watch?v=LoypcRqn-xA), r

Recent discussions: [Reddit](https://www.reddit.com/r/golang/comments/uoxocj/bud_the_fullstack_web_framework_for_go_developers/), [Hacker News](https://news.ycombinator.com/item?id=31371340), [Twitter](https://twitter.com/golivebud)


# How did Bud come into existence?

I started working on Bud 2 years ago after seeing how productive people could be in [Laravel](https://laravel.com/). I wanted the same for Go, so I decided to try creating Laravel for the Go ecosystem. However, my first version after 6 months needed to scaffold many files just to get started. If you are coming from [Rails](https://github.com/rails/rails) or Laravel, you may shrug and consider this as pretty normal.
Expand All @@ -117,7 +116,6 @@ The goals are now:

- Bud should compile to a single binary that contains your entire web app and can be copied to a server that doesn't even have Go installed.


# Contributing

Please refer to the [Contributing Guide](./Contributing.md) to learn how to run and test Bud locally.
Please refer to the [Contributing Guide](./contributing/Readme.md) to learn how to develop Bud locally.
27 changes: 27 additions & 0 deletions contributing/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM ubuntu:18.04

ARG NODE_VERSION=8.10.0
ARG GO_VERSION=1.18.1
ARG BUD_VERSION=main

# Install basic dependencies
RUN apt-get -qq update
RUN apt-get -qq -y install curl git make gcc g++

# Install Node.js
RUN curl https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz | tar -xz -C /usr/local --strip-components 1
RUN node -v

# Install Go
RUN curl -L https://golang.org/dl/go$GO_VERSION.linux-amd64.tar.gz | tar -xz -C /usr/local --strip-components 1
RUN go version
ENV PATH "/root/go/bin:${PATH}"

# Install bud
RUN git clone https://github.com/livebud/bud /bud
WORKDIR /bud
RUN git checkout $BUD_VERSION
RUN make install
RUN go install .
RUN bud version
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Helped me track down some Ubuntu-only issues in CI!


12 changes: 12 additions & 0 deletions Contributing.md → contributing/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Currently, Bud must be developed using WSL/WSL2 if developing on Windows. While

- Node 14
- Go 1.18
- C++ compiler in your $PATH (for cgo to compile V8)

## Setting up Bud for Development

Expand Down Expand Up @@ -41,6 +42,17 @@ After running `go run main.go`, you should see the following:

If you run into any problems, please [open an issue](https://github.com/livebud/bud/issues/new).

### Developing with Docker

We've included a [Dockerfile](./Dockerfile) that you can use to run bud within a Docker container. This can be helpful for testing Bud within a Linux environment and debugging CI issues.

To build and start a Docker container with Bud, run the following commands:

```sh
docker build -t bud:latest contributing
docker run -it --rm -v $(PWD):/bud bud /bin/bash
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This allows you to make modifications in a local bud directory and see those changes within the docker container.

```

## Developing Bud with a Project

Now that you have Bud running locally, you can use the `-C, --chdir` functionality to test Bud against different projects.
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ require (
github.com/fatih/structtag v1.2.0
github.com/fsnotify/fsnotify v1.5.1
github.com/gitchander/permutation v0.0.0-20201214100618-1f3e7285f953
github.com/lithammer/dedent v1.1.0
github.com/matryer/is v1.4.0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We've internalized matryer/is. See: #86

github.com/matthewmueller/diff v0.0.0-20220104030700-cb2fe910d90c
github.com/matthewmueller/gotext v0.0.0-20210424201144-265ed61725ac
github.com/matthewmueller/text v0.0.0-20210424201111-ec1e4af8dfe8
Expand All @@ -36,6 +34,7 @@ require (
github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lithammer/dedent v1.1.0 // indirect
github.com/pointlander/compress v1.1.1-0.20190518213731-ff44bd196cc3 // indirect
github.com/pointlander/jetset v1.0.1-0.20190518214125-eee7eff80bd4 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lithammer/dedent v1.1.0 h1:VNzHMVCBNG1j0fh3OrsFRkVUwStdDArbgBWoPAffktY=
github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc=
github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
github.com/matthewmueller/diff v0.0.0-20220104030700-cb2fe910d90c h1:yjGBNrCIE7IghJAwrFcyDzwzwJKf0oRPeOHx60wfkmA=
github.com/matthewmueller/diff v0.0.0-20220104030700-cb2fe910d90c/go.mod h1:xIxeV0n2W+WNB3ik/j9lUkcrQAk71VrvT9ch8u4pcvM=
github.com/matthewmueller/gotext v0.0.0-20210424201144-265ed61725ac h1:SjopLdUF96kdJU8ynYmGVHoJmngpwFHRvR5p2plBXG4=
Expand Down
2 changes: 1 addition & 1 deletion internal/bail/bail.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (s *Struct) Recover2(err *error, prefix string) {
if _, ok := e.(bail); !ok {
panic(e)
}
*err = fmt.Errorf(prefix+" > %w", s.err)
*err = fmt.Errorf(prefix+" . %w", s.err)
}
}

Expand Down
144 changes: 0 additions & 144 deletions internal/bud/bud.go

This file was deleted.

10 changes: 0 additions & 10 deletions internal/bud/env.go

This file was deleted.

82 changes: 0 additions & 82 deletions internal/bud/project.go

This file was deleted.

Loading