Skip to content

Commit

Permalink
[Release] Update the examples
Browse files Browse the repository at this point in the history
  • Loading branch information
reboot-dev-bot committed Oct 20, 2023
1 parent ec45dc1 commit b7cdbec
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 51 deletions.
32 changes: 16 additions & 16 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "Resemble Devcontainer",
"image": "ghcr.io/reboot-dev/resemble-devcontainer",
"remoteUser": "dev",
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {}
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000, 9991],
// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",
// Configure tool-specific properties.
// "customizations": {},
}
"name": "Resemble Devcontainer",
"image": "ghcr.io/reboot-dev/resemble-devcontainer",
"remoteUser": "dev",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {}

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000, 9991]

// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",

// Configure tool-specific properties.
// "customizations": {},
}
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,4 @@ jobs:
uses: devcontainers/[email protected]
with:
runCmd: |
pip install -r ./backend/src/requirements.txt
rsm protoc
pytest backend/
.tests/test.sh
2 changes: 1 addition & 1 deletion .mergequeue/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ merge_rules:
override_labels:
squash: ""
merge: ""
rebase: mergequeue-rebase
rebase: mergequeue-rebase
37 changes: 37 additions & 0 deletions .tests/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

set -e # Exit if a command exits with an error.
set -u # Treat expanding an unset variable as an error.
set -x # Echo executed commands to help debug failures.

# Check that this script has been invoked with the right working directory, by
# checking that the expected subdirectories exist.
ls -l api/ backend/src/ web/ 2> /dev/null > /dev/null || {
echo "ERROR: this script must be invoked from the root of the 'resemble-hello-world' repository."
echo "Current working directory is '$(pwd)'."
exit 1
}

# Create and activate a virtual environment so that we don't pollute the
# system's Python installation.
python -m venv ./.hello-world-venv
source ./.hello-world-venv/bin/activate

# Use the published Resemble pip packages by default, but allow the test system
# to override them with a different value.
REBOOT_RESEMBLE_PACKAGE=${REBOOT_RESEMBLE_PACKAGE:-"reboot-resemble"}

# Manually install the Resemble packages before installing the requirements.txt.
# This allows us to install unreleased versions of the Resemble packages during
# tests; the requirements.txt refers to the released versions, but it will skip
# packages that have already been installed.
pip install $REBOOT_RESEMBLE_PACKAGE

pip install -r backend/src/requirements.txt

rsm protoc

pytest backend/

# Clean up
rm -rf ./.hello-world-venv
16 changes: 16 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This `BUILD.bazel` file allows a `bazel` system (configured outside of this
# repository) to use code in this directory and its subdirectories.

filegroup(
name = "everything",
srcs = glob(
["**/*"],
exclude = [
# Folders that may be created by activity in this repository, such
# as manually following the steps of the `README.md` file, but which
# are not part of the "source code" of this repository.
".pytest_cache/**/*",
],
),
visibility = ["//visibility:public"],
)
2 changes: 1 addition & 1 deletion backend/src/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
import logging
from hello_world.v1.greeter_rsm import Greeter
from greeter_servicer import GreeterServicer
from hello_world.v1.greeter_rsm import Greeter
from resemble.aio.applications import Application
from resemble.aio.workflows import Workflow

Expand Down
2 changes: 1 addition & 1 deletion backend/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
reboot-resemble>=0.0.7
reboot-resemble>=0.1.0
pytest>=7.4.2
15 changes: 9 additions & 6 deletions backend/tests/greeter_servicer_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from hello_world.v1.greeter_rsm import Greeter, GreetResponse
from greeter_servicer import GreeterServicer
from hello_world.v1.greeter_rsm import Greeter, GreetResponse
from resemble.aio.tests import Resemble
from resemble.aio.workflows import Workflow

Expand Down Expand Up @@ -28,8 +28,11 @@ async def test_hello_world(self) -> None:
await greeter.Greet(workflow, greeting="Hello, Resemble!")
await greeter.Greet(workflow, greeting="Hello, Peace of Mind!")
response: GreetingsResponse = await greeter.Greetings(workflow)
self.assertEqual(response.greetings, [
"Hello, World",
"Hello, Resemble!",
"Hello, Peace of Mind!",
])
self.assertEqual(
response.greetings,
[
"Hello, World",
"Hello, Resemble!",
"Hello, Peace of Mind!",
],
)
26 changes: 13 additions & 13 deletions web/config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
const { removeModuleScopePlugin, override, babelInclude } = require("customize-cra");
const {
removeModuleScopePlugin,
override,
babelInclude,
} = require("customize-cra");
const path = require("path");

module.exports = function (config, env) {

return Object.assign(
config,
override(
removeModuleScopePlugin(),
babelInclude([
path.resolve('src'),
path.resolve('../api/hello_world/v1'),
])
)(config, env)
)
}
return Object.assign(
config,
override(
removeModuleScopePlugin(),
babelInclude([path.resolve("src"), path.resolve("../api/hello_world/v1")])
)(config, env)
);
};
4 changes: 2 additions & 2 deletions web/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import App from "./App";
import reportWebVitals from "./reportWebVitals";

const root = ReactDOM.createRoot(
document.getElementById("root") as HTMLElement,
document.getElementById("root") as HTMLElement
);
// Use TLS (via localhost.direct) so we get the advantage of HTTP/2
// multiplexing.
Expand All @@ -16,7 +16,7 @@ const client = new ResembleClient("https://localhost.direct:9991");
root.render(
<ResembleClientProvider client={client}>
<App />
</ResembleClientProvider>,
</ResembleClientProvider>
);

reportWebVitals();
10 changes: 2 additions & 8 deletions web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
Expand All @@ -20,7 +16,5 @@
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
"include": ["src"]
}

0 comments on commit b7cdbec

Please sign in to comment.