Skip to content

Commit a4b88dd

Browse files
authored
Merge pull request #6 from devigned/compose
2 parents b4f406c + 6109efd commit a4b88dd

File tree

32 files changed

+561
-47
lines changed

32 files changed

+561
-47
lines changed

.github/workflows/ci.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: build
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
tags:
7+
- "v*"
8+
pull_request:
9+
branches:
10+
- "main"
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Set up QEMU
16+
uses: docker/setup-qemu-action@v3
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v3
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
- name: setup-tools
22+
uses: buildpacks/github-actions/[email protected]
23+
- name: setup-pack
24+
uses: buildpacks/github-actions/[email protected]
25+
- name: Build and test
26+
run: |
27+
make build test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
**/target
33

44
**/*.wasm
5+
6+
**/.projects.json

Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
SHELL:=/usr/bin/env bash
2+
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
3+
.DEFAULT_GOAL:=help
4+
5+
## --------------------------------------
6+
## Build
7+
## --------------------------------------
8+
9+
##@ Build:
10+
11+
.PHONY: build
12+
build: build-base-images build-builder ## Build all of the things \o/
13+
14+
.PHONY: build-base-images
15+
build-base-images: ## Build the base images.
16+
./base-images/build.sh wasm
17+
18+
.PHONY: build-builder
19+
build-builder: ## Build the builder image.
20+
pack builder create wasm/demo-builder:wasm --config ./builders/wasm/builder.toml
21+
22+
23+
## --------------------------------------
24+
## Test
25+
## --------------------------------------
26+
27+
##@ Test:
28+
29+
.PHONY: test
30+
test: test-js test-compose ## Run all tests.
31+
32+
.PHONY: test-compose
33+
test-compose: ## Test the compose project.
34+
pack build test-wasm-compose --builder wasm/demo-builder:wasm --path apps/compose
35+
36+
.PHONY: test-js
37+
test-js: ## Test the JS app.
38+
pack build test-wasm-js --builder wasm/demo-builder:wasm --path apps/js
39+
40+
help: ## Display this help.
41+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-25s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

apps/compose/app-js/componentize.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ const { component } = await componentize(jsSource, {
1313
enableAot,
1414
});
1515

16-
await writeFile("server.component.wasm", component);
16+
let componentName = process.env.COMPONENT_NAME ?? "server.component.wasm";
17+
await writeFile(componentName, component);

apps/compose/app-js/package-lock.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/compose/app-js/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
},
77
"scripts": {
88
"build": "wkg wit fetch && node componentize.js"
9+
},
10+
"dependencies": {
11+
"itty-router": "^5.0.18"
912
}
1013
}

apps/compose/compose.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"dependencies": {
3+
"example:math": "service-go",
4+
"example:server": "app-js"
5+
}
6+
}

apps/compose/package-lock.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/compose/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "module",
3+
"scripts": {
4+
"build": "echo 'faker!'"
5+
},
6+
"dependencies": {
7+
"itty-router": "^5.0.18"
8+
}
9+
}

apps/compose/service-go/compose

-1.47 MB
Binary file not shown.

0 commit comments

Comments
 (0)