-
Notifications
You must be signed in to change notification settings - Fork 0
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: add docker ci #7
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a10e3cf
feat: add latest block metrics
parketh 1cdc67d
update css
parketh d09dbb0
feat: improve loading state handler for tx component
parketh 84c2716
feat: rename latestBlockInfo -> chainSyncStatus
parketh 1cc050d
fix: refactor hardcoded api url
parketh a1c902b
rename NEXT_PUBLIC_FINALITY_GADGET_API_URL for clarity
parketh 2a79c49
fix: chain sync status
parketh f63098c
nit: remove unused assets
parketh 3bd302b
nit: remove console logs
parketh 5950155
feat: add docker ci
parketh ef8b86a
nit: update for clarity + inline docs
parketh 622cc6c
feat: add docker ci
parketh c786a00
Merge branch 'feat/add-docker-ci' of https://github.com/Snapchain/fin…
parketh ac77f92
test: trigger docker ci
parketh 0b94b6f
test: remove test ci
parketh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
NEXT_PUBLIC_API_URL=http://localhost:8080 | ||
NEXT_PUBLIC_FINALITY_GADGET_API_URL=http://localhost:8080 | ||
NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Docker | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
# Publish semver tags as releases. | ||
tags: ["v*.*.*"] | ||
|
||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: docker.io | ||
# Remove the slash at the end of the username | ||
IMAGE_NAME: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ github.event.repository.name }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Set up QEMU for multi-architecture support | ||
# https://github.com/docker/setup-qemu-action | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
# Set up BuildKit Docker container builder to be able to build | ||
# multi-platform images and export cache | ||
# https://github.com/docker/setup-buildx-action | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# Login against a Docker registry | ||
# https://github.com/docker/login-action | ||
- name: Log into Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
type=sha | ||
|
||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: true | ||
context: . | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ChainSyncStatus } from "../types/chainSyncStatus"; | ||
|
||
import { apiWrapper } from "./apiWrapper"; | ||
|
||
export const getChainSyncStatus = async (): Promise<ChainSyncStatus> => { | ||
const response = await apiWrapper( | ||
"GET", | ||
`/v1/chainSyncStatus`, | ||
"Error fetching chain sync status", | ||
); | ||
|
||
return response.data; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import Image from "next/image"; | ||
import { Fragment } from "react"; | ||
import { AiOutlineInfoCircle } from "react-icons/ai"; | ||
import { Tooltip } from "react-tooltip"; | ||
|
||
import { ChainSyncStatus } from "@/app/types/chainSyncStatus"; | ||
|
||
import blockIcon from "./icons/block.svg"; | ||
|
||
interface StatsProps { | ||
chainSyncStatus: ChainSyncStatus | undefined; | ||
} | ||
|
||
export const Stats: React.FC<StatsProps> = ({ chainSyncStatus }) => { | ||
const sections = [ | ||
[ | ||
{ | ||
title: "Latest", | ||
value: chainSyncStatus?.latest_block, | ||
icon: blockIcon, | ||
tooltip: "Latest L2 block number", | ||
}, | ||
{ | ||
title: "ETH Finalized", | ||
value: chainSyncStatus?.latest_eth_finalized_block, | ||
icon: blockIcon, | ||
tooltip: "Latest ETH finalized L2 block number", | ||
}, | ||
{ | ||
title: "Earliest BTC Finalized", | ||
value: chainSyncStatus?.earliest_btc_finalized_block, | ||
icon: blockIcon, | ||
tooltip: "Earliest consecutively BTC finalized L2 block number", | ||
}, | ||
{ | ||
title: "Latest BTC Finalized", | ||
value: chainSyncStatus?.latest_btc_finalized_block, | ||
icon: blockIcon, | ||
tooltip: "Latest BTC finalized L2 block number", | ||
}, | ||
], | ||
]; | ||
|
||
return ( | ||
<div className="card flex flex-col gap-4 bg-base-300 p-1 shadow-sm lg:flex-row lg:justify-between"> | ||
<div className="flex items-center gap-2 md:flex-1 md:flex-col lg:flex-initial lg:flex-row flex-wrap justify-center p-5"> | ||
<strong>Block Status</strong> | ||
</div> | ||
{sections.map((section, index) => ( | ||
<div | ||
key={index} | ||
className="card flex justify-between bg-base-400 p-4 text-sm md:flex-row" | ||
> | ||
{section.map((subSection, subIndex) => ( | ||
<Fragment key={subSection.title}> | ||
<div className="flex items-center gap-2 md:flex-1 md:flex-col lg:flex-initial lg:flex-row flex-wrap justify-center"> | ||
<div className="flex items-center gap-2"> | ||
<Image src={subSection.icon} alt={subSection.title} /> | ||
<div className="flex items-center gap-1"> | ||
<p className="dark:text-neutral-content"> | ||
{subSection.title} | ||
</p> | ||
{subSection.tooltip && ( | ||
<> | ||
<span | ||
className="cursor-pointer text-xs" | ||
data-tooltip-id={`tooltip-${subSection.title}`} | ||
data-tooltip-content={subSection.tooltip} | ||
data-tooltip-place="top" | ||
> | ||
<AiOutlineInfoCircle /> | ||
</span> | ||
<Tooltip | ||
id={`tooltip-${subSection.title}`} | ||
className="tooltip-wrap" | ||
/> | ||
</> | ||
)} | ||
</div> | ||
</div> | ||
<div> | ||
<p className="flex-1 text-right"> | ||
{!!chainSyncStatus ? ( | ||
<strong>{subSection.value}</strong> | ||
) : ( | ||
<span className="loading loading-spinner text-primary" /> | ||
)} | ||
</p> | ||
</div> | ||
</div> | ||
{/* Add divider between sections */} | ||
{subIndex !== section.length - 1 && ( | ||
<div className="divider mx-0 my-2 md:divider-horizontal" /> | ||
)} | ||
</Fragment> | ||
))} | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a quick way to test is to add feat/docker-ci here and remove it before merging to main :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it - tested!