Skip to content

Commit

Permalink
Merge pull request #559 from 0xsend/dev
Browse files Browse the repository at this point in the history
deploy
  • Loading branch information
0xBigBoss authored Jul 7, 2024
2 parents d46ed6c + e33e6cb commit 93f2638
Show file tree
Hide file tree
Showing 110 changed files with 7,638 additions and 3,715 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# may be redundant but last thing we want is large dockerfiles. from here on out, it mostly mirrors the .gitignore
**/Tiltfile
**/**.tiltfile
**/**.Tiltfile
**/**.Tiltfile
**/*.tsbuildinfo
**/dist
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.11.1
v20.15.0
10 changes: 0 additions & 10 deletions .pierre/ci/tests.ts

This file was deleted.

4 changes: 0 additions & 4 deletions .tiltignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ packages/playwright/playwright-report
**/*.tsbuildinfo
**/node_modules
**/.turbo
# may be redundant but last thing we want is large dockerfiles. from here on out, it mostly mirrors the .gitignore
**/Tiltfile
**/**.tiltfile
**/**.Tiltfile
**/*.tsbuildinfo
**/dist
**/node_modules
Expand Down
13 changes: 13 additions & 0 deletions .yarn/patches/istanbul-lib-coverage-npm-3.2.2-5c0526e059.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/lib/file-coverage.js b/lib/file-coverage.js
index 4ed4c096185addd9960d023c5982bc36c98c58b5..08e272ceb980a8d91d530a2fd8c58fec0ba0bc51 100644
--- a/lib/file-coverage.js
+++ b/lib/file-coverage.js
@@ -206,6 +206,8 @@ class FileCoverage {
this.data = emptyCoverage(pathOrObj, reportLogic);
} else if (pathOrObj instanceof FileCoverage) {
this.data = pathOrObj.data;
+ } else if (typeof pathOrObj === 'object' && pathOrObj.data) {
+ this.data = pathOrObj.data;
} else if (typeof pathOrObj === 'object') {
this.data = pathOrObj;
} else {
5 changes: 3 additions & 2 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ brew "jq" unless system "jq --version"
brew "yj" unless system "yj -v"
brew "tilt" unless system "tilt version"
brew "caddy" unless system "caddy version"
brew "nss" unless system "type nss-policy-check"
brew "nss" unless system "nss-config --version"
brew "sqlfluff" unless CI or system "sqlfluff --version"
brew "postgresql@15" unless system "type pg_dump"
brew "postgresql@15" unless system "psql --version"
brew "gnu-sed" unless system "gsed --version"
brew "direnv" unless system "direnv --version"
brew "temporal" unless system "temporal --version"
318 changes: 7 additions & 311 deletions Tiltfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
load("ext://color", "color")
load("ext://dotenv", "dotenv")
load("ext://uibutton", "cmd_button", "location")
load("./tilt/common.tiltfile", "CFG", "CI", "DEBUG", "contract_files")
load("./tilt/utils.tiltfile", "files_matching", "require_env", "require_tools")
load("./tilt/common.Tiltfile", "CFG", "CI", "DEBUG")
load("./tilt/utils.Tiltfile", "require_env", "require_tools")

print(color.green("███████╗███████╗███╗ ██╗██████╗ ██╗████████╗"))

Expand Down Expand Up @@ -80,317 +79,14 @@ Add the following to your /etc/hosts file:
print(color.red("NEXT_PUBLIC_SUPABASE_URL is not pointing to host.docker.internal. Please update your environment to point to a local supabase instance."))
fail(color.red("NEXT_PUBLIC_SUPABASE_URL is not pointing to host.docker.internal"))

include("tilt/infra.tiltfile")
include("tilt/infra.Tiltfile")

include("tilt/deps.tiltfile")
include("tilt/deps.Tiltfile")

# APPS
labels = ["apps"]
include("./tilt/apps.Tiltfile")

next_app_resource_deps = [
"yarn:install",
"supabase",
"supabase:generate",
"wagmi:generate",
"ui:build",
"ui:generate-theme",
"daimo-expo-passkeys:build",
"anvil:fixtures",
"shovel",
] + ([
"aa_bundler:base",
] if not CI else [])

# Next
if CFG.dockerize:
GIT_BRANCH = str(local("git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD")).strip()
GIT_HASH = str(local("git rev-parse --short=10 HEAD")).strip()

# FIXME: when we support dev mode and dockerize.
# docker_build(
# "0xsend/sendapp/next-app",
# ".",
# dockerfile = "apps/next/Dockerfile",
# extra_tag = ["latest", GIT_HASH],
# platform = "linux/amd64",
# secret = [
# "id=SUPABASE_DB_URL,src=./var/SUPABASE_DB_URL.txt",
# "id=SUPABASE_SERVICE_ROLE,src=./var/SUPABASE_SERVICE_ROLE.txt",
# ],
# build_args=[

# ]
# )
docker_compose("./docker-compose.yml")
dc_resource(
"next-app",
labels = ["apps"],
new_name = "next:web",
resource_deps = [
"yarn:install",
"supabase",
"anvil:fixtures",
"aa_bundler:base",
"shovel",
],
)
else:
local_resource(
"next:web",
"yarn workspace next-app next:build" if CI else "", # In CI, only build the web app
labels = labels,
links = ["http://localhost:3000"],
readiness_probe = None if CI else probe(
http_get = http_get_action(
path = "/api/healthz",
port = 3000,
),
period_secs = 15,
),
resource_deps = next_app_resource_deps,
serve_cmd =
"" if CI else "yarn next-app dev", # In CI, playwright tests start the web server
)

local_resource(
"distributor:web",
allow_parallel = True,
labels = labels,
links = ["http://localhost:3050"],
readiness_probe = probe(
http_get = http_get_action(
path = "/",
port = 3050,
),
period_secs = 15,
),
resource_deps = [
"yarn:install",
"anvil:mainnet",
"supabase",
"supabase:generate",
"wagmi:generate",
],
serve_cmd =
"yarn run distributor start" if CI else "yarn run distributor dev",
)

local_resource(
"caddy:web",
auto_init = not CI,
labels = labels,
serve_cmd = "caddy run --watch --config dev.Caddyfile",
trigger_mode = TRIGGER_MODE_MANUAL,
)

# TESTS
labels = ["test"]

local_resource(
"app:test",
"yarn workspace app test",
allow_parallel = True,
labels = labels,
resource_deps = [
"yarn:install",
"contracts:build",
"wagmi:generate",
"supabase:generate",
"snaplet:generate",
"ui:build",
"ui:generate-theme",
"daimo-expo-passkeys:build",
"webauthn-authenticator:build",
"shovel:generate-config",
],
deps =
files_matching(
os.path.join("packages", "app"),
lambda f: f.endswith(".ts") or f.endswith(".tsx"),
),
)

cmd_button(
"app:test:update-snapshots",
argv = [
"yarn",
"workspace",
"app",
"test",
"-u",
],
icon_name = "update",
location = location.RESOURCE,
resource = "app:test",
text = "update snapshots",
)

local_resource(
"webauthn-authenticator:test",
"yarn workspace @0xsend/webauthn-authenticator test:coverage --run",
allow_parallel = True,
labels = labels,
resource_deps = ["yarn:install"],
deps =
files_matching(
os.path.join("packages", "webauthn-authenticator"),
lambda f: f.endswith(".ts"),
),
)

local_resource(
"playwright:deps",
"echo 🥳",
labels = labels,
resource_deps = [
"anvil:mainnet",
"anvil:base",
"anvil:fixtures",
"aa_bundler:base",
"snaplet:generate",
"next:web",
"supabase",
"shovel",
],
)

local_resource(
"playwright:test",
"yarn playwright test",
allow_parallel = True,
auto_init = CI,
labels = labels,
resource_deps = [
"next:web",
"playwright:deps",
],
trigger_mode = CI and TRIGGER_MODE_AUTO or TRIGGER_MODE_MANUAL,
deps = files_matching(
os.path.join("packages", "playwright"),
lambda f: f.endswith(".ts"),
),
)

cmd_button(
"playwright:show-report",
argv = [
"yarn",
"playwright",
"playwright",
"show-report",
],
icon_name = "info",
location = location.RESOURCE,
resource = "playwright:test",
text = "playwright report",
)

cmd_button(
"playwright:test:ui",
argv = [
"yarn",
"playwright",
"test",
"--ui",
],
icon_name = "bug_report",
location = location.RESOURCE,
resource = "playwright:test",
text = "playwright test --ui",
)

local_resource(
"distributor:test",
"yarn workspace distributor test --run",
allow_parallel = True,
labels = labels,
resource_deps = [
"yarn:install",
"anvil:mainnet",
"supabase",
"supabase:generate",
"wagmi:generate",
],
deps =
files_matching(
os.path.join("apps", "distributor", "test"),
lambda f: f.endswith(".ts"),
),
)

local_resource(
"supabase:test",
"yarn supabase test",
allow_parallel = True,
labels = labels,
resource_deps = [
"supabase",
"snaplet:generate", # hack to ensure snaplet doesn't include test pg_tap schema
],
deps = files_matching(
os.path.join("supabase", "tests"),
lambda f: f.endswith(".sql"),
),
)

local_resource(
"contracts:test",
"yarn contracts test",
allow_parallel = True,
labels = labels,
resource_deps = [
"yarn:install",
"contracts:build",
],
deps = contract_files,
)

local_resource(
"contracts:cov",
"yarn contracts test:cov -vvv",
allow_parallel = True,
auto_init = False,
labels = labels,
resource_deps = [
"yarn:install",
"contracts:build",
"contracts:test",
],
deps = contract_files,
)

local_resource(
name = "shovel:test",
allow_parallel = True,
auto_init = not CI,
cmd = "yarn workspace @my/shovel test",
labels = labels,
resource_deps = [
"yarn:install",
"shovel:generate-config",
],
trigger_mode = CI and TRIGGER_MODE_MANUAL or TRIGGER_MODE_AUTO,
deps = files_matching(
os.path.join("packages", "shovel", "etc"),
lambda f: f.endswith(".json"),
),
)

local_resource(
name = "unit-tests",
allow_parallel = True,
cmd = "echo 🥳",
labels = labels,
resource_deps = [
# messy but create a single resource that runs all the tests
"app:test",
"webauthn-authenticator:test",
"supabase:test",
"contracts:test",
"distributor:test",
],
)
include("./tilt/tests.Tiltfile")

if config.tilt_subcommand == "down":
include("./tilt/cleanup.tiltfile")
include("./tilt/cleanup.Tiltfile")

Loading

0 comments on commit 93f2638

Please sign in to comment.