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

feat(guardian-prover-health-check): ui + api #15324

Merged
merged 23 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
94 changes: 88 additions & 6 deletions .github/workflows/guardianproverhealthcheck.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,101 @@
name: Guardianproverhealthcheck
name: guardian-prover-health-check

on:
push:
branches: [main]
paths:
- "packages/guardian-prover-health-check/**"
pull_request:
paths:
- "packages/guardian-prover-health-check/**"

jobs:
build:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
- uses: actions/setup-go@v3
with:
go-version: 1.21.0
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest

# Optional: working directory, useful for monorepos
working-directory: ./packages/guardian-prover-health-check
args: --config=.golangci.yml --timeout=4m

test:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}

- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.21.0"

- name: guardian-prover-health-check - Unit Tests
working-directory: ./packages/guardian-prover-health-check
run: go test `go list ./... | grep -v ./contracts | grep -v ./mock | grep -v ./cmd` -coverprofile=coverage.txt -covermode=atomic

- name: guardian-prover-health-check - Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./packages/guardian-prover-health-check/coverage.txt
flags: guardian-prover-health-check

push-docker-image:
# only push docker image on PR merge to main
if: ${{ github.event }} == 'push'
name: Build and push docker image
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}

- name: Login to GCR
uses: docker/login-action@v2
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
gcr.io/evmchain/guardian-prover-health-check
tags: |
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=sha

- name: Build and push
uses: docker/build-push-action@v2
with:
submodules: recursive
platforms: linux/amd64
push: true
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
PACKAGE=guardian-prover-health-check
101 changes: 0 additions & 101 deletions .github/workflows/guardianproverhealthcheck.yml

This file was deleted.

3 changes: 3 additions & 0 deletions packages/eventindexer/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"log/slog"
"os"
"time"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -68,6 +69,8 @@ func (g *Generator) Start() error {
return err
}

os.Exit(0)

return nil
}

Expand Down
3 changes: 3 additions & 0 deletions packages/guardian-prover-health-check-ui/.default.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VITE_GUARDIAN_PROVER_API_URL=https://guardian-prover-health-check.internal.taiko.xyz
VITE_GUARDIAN_PROVER_CONTRACT_ADDRESS=0x8b93ED8567013837e75994A7cB182AFB83E85f4b
VITE_RPC_URL=https://l1rpc.internal.taiko.xyz
24 changes: 24 additions & 0 deletions packages/guardian-prover-health-check-ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["svelte.svelte-vscode"]
}
47 changes: 47 additions & 0 deletions packages/guardian-prover-health-check-ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Svelte + TS + Vite

This template should help get you started developing with Svelte and TypeScript in Vite.

## Recommended IDE Setup

[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).

## Need an official Svelte framework?

Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also powered by Vite. Deploy anywhere with its serverless-first approach and adapt to various platforms, with out of the box support for TypeScript, SCSS, and Less, and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more.

## Technical considerations

**Why use this over SvelteKit?**

- It brings its own routing solution which might not be preferable for some users.
- It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app.

This template contains as little as possible to get started with Vite + TypeScript + Svelte, while taking into account the developer experience with regards to HMR and intellisense. It demonstrates capabilities on par with the other `create-vite` templates and is a good starting point for beginners dipping their toes into a Vite + Svelte project.

Should you later need the extended capabilities and extensibility provided by SvelteKit, the template has been structured similarly to SvelteKit so that it is easy to migrate.

**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or `tsconfig.json`?**

Setting `compilerOptions.types` shuts out all other types not explicitly listed in the configuration. Using triple-slash references keeps the default TypeScript setting of accepting type information from the entire workspace, while also adding `svelte` and `vite/client` type information.

**Why include `.vscode/extensions.json`?**

Other templates indirectly recommend extensions via the README, but this file allows VS Code to prompt the user to install the recommended extension upon opening the project.

**Why enable `allowJs` in the TS template?**

While `allowJs: false` would indeed prevent the use of `.js` files in the project, it does not prevent the use of JavaScript syntax in `.svelte` files. In addition, it would force `checkJs: false`, bringing the worst of both worlds: not being able to guarantee the entire codebase is TypeScript, and also having worse typechecking for the existing JavaScript. In addition, there are valid use cases in which a mixed codebase may be relevant.

**Why is HMR not preserving my local component state?**

HMR state preservation comes with a number of gotchas! It has been disabled by default in both `svelte-hmr` and `@sveltejs/vite-plugin-svelte` due to its often surprising behavior. You can read the details [here](https://github.com/rixo/svelte-hmr#svelte-hmr).

If you have state that's important to retain within a component, consider creating an external store which would not be replaced by HMR.

```ts
// store.ts
// An extremely simple external store
import { writable } from "svelte/store";
export default writable(0);
```
13 changes: 13 additions & 0 deletions packages/guardian-prover-health-check-ui/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html data-theme="dark" lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Svelte + TS</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
Loading
Loading