Skip to content

Commit

Permalink
(feat) Squash and merge Zilliqa local changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
rrw-zilliqa committed May 2, 2024
1 parent 4ce2e10 commit 49d7123
Show file tree
Hide file tree
Showing 83 changed files with 4,425 additions and 183 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@ name: Publish Docker image
on:
push:
branches:
- "main"
- "develop"
tags:
- "*"
- "v*"

env:
IMAGE_NAME: ${{ github.repository }}

jobs:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Prepare
run: |
Expand Down Expand Up @@ -54,8 +51,12 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
otterscan/otterscan
ghcr.io/${{ env.IMAGE_NAME }}
zilliqa/otterscan
tags: |
type=ref,enable=false,priority=600,prefix=pr-,suffix=,event=pr
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=semver,pattern={{raw}}
- name: Build and push by digest
id: build
Expand Down
134 changes: 134 additions & 0 deletions .github/workflows/docker-publish.yaml.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Publish Docker image

on:
push:
branches:
- "develop"
tags:
- "*"

env:
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

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

- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v3

- name: Docker Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Docker Metadata action
id: meta
uses: docker/metadata-action@v5
with:
images: |
otterscan/otterscan
ghcr.io/${{ env.IMAGE_NAME }}

- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"

- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
needs:
- build
permissions:
contents: read
packages: write

steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true

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

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
otterscan/otterscan
ghcr.io/${{ env.IMAGE_NAME }}

- name: Docker Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *)

- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
25 changes: 25 additions & 0 deletions .github/workflows/docker-publish.yaml.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--- .github/workflows/docker-publish.yaml
+++ .github/workflows/docker-publish.yaml
@@ -47,15 +37,19 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
- otterscan/otterscan
- ghcr.io/${{ env.IMAGE_NAME }}
+ zilliqa/otterscan
+ tags: |
+ type=ref,enable=false,priority=600,prefix=pr-,suffix=,event=pr
+ type=ref,event=branch
+ type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
+ type=semver,pattern={{raw}}

- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: .
push: true
- platforms: linux/amd64,linux/arm64
+ platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
13 changes: 13 additions & 0 deletions .github/workflows/main-pr-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Check main PR source branch
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
check-pr-source:
runs-on: ubuntu-latest
steps:
- name: Verify source branch
if: github.base_ref == 'main' && github.head_ref != 'develop'
run: |
echo "Error: Pull request source branch is not 'develop'."
exit 1
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# Vite cache
.vite/

# emacs backups
*~
\.#*
\#*

# dependencies
/node_modules
Expand Down
30 changes: 30 additions & 0 deletions .gitignore.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage
/storybook-static
/cypress/screenshots
/cypress/videos

# production
/build
/dist

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

/.vscode
.gitsigners
12 changes: 12 additions & 0 deletions .gitignore.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- .gitignore
+++ .gitignore
@@ -14,6 +21,9 @@

# testing
/coverage
+/storybook-static
+/cypress/screenshots
+/cypress/videos

# production
/build
12 changes: 12 additions & 0 deletions .storybook/main.ts.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- .storybook/main.ts
+++ .storybook/main.ts
@@ -17,6 +17,9 @@ const config: StorybookConfig = {
typescript: {
reactDocgen: false,
},
+ core: {
+ disableTelemetry: true,
+ },
};

export default config;
6 changes: 6 additions & 0 deletions .storybook/preview-head.html.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--- .storybook/preview-head.html
+++ .storybook/preview-head.html
@@ -1,3 +1,3 @@
<script>
window.global = window;
-</script>+</script>
20 changes: 20 additions & 0 deletions .storybook/preview.tsx.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- .storybook/preview.tsx
+++ .storybook/preview.tsx
@@ -1,12 +1,11 @@
-import React from "react";
-import { Decorator } from "@storybook/react";
-import { INITIAL_VIEWPORTS } from "@storybook/addon-viewport";
-import { BrowserRouter as Router } from "react-router-dom";
import "@fontsource/fira-code/index.css";
-import "@fontsource/space-grotesk/index.css";
-import "@fontsource/roboto/index.css";
import "@fontsource/roboto-mono/index.css";
+import "@fontsource/roboto/index.css";
import "@fontsource/space-grotesk/files/space-grotesk-latin-400-normal.woff2";
+import "@fontsource/space-grotesk/index.css";
+import { INITIAL_VIEWPORTS } from "@storybook/addon-viewport";
+import { Decorator } from "@storybook/react";
+import { BrowserRouter as Router } from "react-router-dom";
import "../src/index.css";

export const parameters = {
42 changes: 42 additions & 0 deletions Dockerfile.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
--- Dockerfile
+++ Dockerfile
@@ -1,10 +1,10 @@
-FROM node:20.8.1-alpine3.17 AS builder
+FROM node:20.10.0-alpine3.17 AS builder
WORKDIR /otterscan-build
-COPY ["package.json", "package-lock.json", "/otterscan-build/"]
-RUN npm ci
-COPY ["run-nginx.sh", "tsconfig.json", "tsconfig.node.json", "postcss.config.js", "tailwind.config.js", "vite.config.ts", "index.html", "/otterscan-build/"]
-COPY ["public", "/otterscan-build/public/"]
-COPY ["src", "/otterscan-build/src/"]
+COPY --link ["package.json", "package-lock.json", "/otterscan-build/"]
+RUN npm ci --fetch-timeout 600000 --verbose
+COPY --link ["run-nginx.sh", "tsconfig.json", "tsconfig.node.json", "postcss.config.js", "tailwind.config.js", "vite.config.ts", "index.html", "/otterscan-build/"]
+COPY --link ["public", "/otterscan-build/public/"]
+COPY --link ["src", "/otterscan-build/src/"]
RUN npm run build

# Add brotli module to official nginx image
@@ -71,14 +71,14 @@ RUN set -ex \
&& rm -rf /tmp/packages
RUN apk update && apk add jq
WORKDIR /usr/share/nginx/html/
-COPY --from=otterscan/otterscan-assets:v1.1.1 /usr/share/nginx/html/chains chains/
-COPY --from=otterscan/otterscan-assets:v1.1.1 /usr/share/nginx/html/topic0 topic0/
-COPY --from=otterscan/otterscan-assets:v1.1.1 /usr/share/nginx/html/assets assets/
-COPY --from=otterscan/otterscan-assets:v1.1.1 /usr/share/nginx/html/signatures signatures/
-COPY nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
-COPY nginx/nginx.conf /etc/nginx/nginx.conf
-COPY --from=builder /otterscan-build/dist /usr/share/nginx/html/
-COPY --from=builder /otterscan-build/run-nginx.sh /
+COPY --link --from=otterscan/otterscan-assets:v1.1.1 /usr/share/nginx/html/chains chains/
+COPY --link --from=otterscan/otterscan-assets:v1.1.1 /usr/share/nginx/html/topic0 topic0/
+COPY --link --from=otterscan/otterscan-assets:v1.1.1 /usr/share/nginx/html/assets assets/
+COPY --link --from=otterscan/otterscan-assets:v1.1.1 /usr/share/nginx/html/signatures signatures/
+COPY --link nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
+COPY --link nginx/nginx.conf /etc/nginx/nginx.conf
+COPY --link --from=builder /otterscan-build/dist /usr/share/nginx/html/
+COPY --link --from=builder /otterscan-build/run-nginx.sh /
WORKDIR /

CMD ["/run-nginx.sh"]
10 changes: 10 additions & 0 deletions README.md.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- README.md
+++ README.md
@@ -118,4 +118,6 @@ Follow the creator on Twitter for more updates ([@wmitsuda](https://twitter.com/

### Donation address

-If you like this project, feel free to send donations to `otterscan.eth` or use our gitcoin grant page: https://gitcoin.co/grants/3224/otterscan
+If you like this project, feel free to send donations to `otterscan.eth` on any EVM chain (it's an EOA).
+
+We also participate regularly on Gitcoin Grants rounds.
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Erigon based block explorer" />
<meta name="description" content="Zilliqa block explorer" />
<meta name="format-detection" content="telephone=no" />
<link rel="apple-touch-icon" href="/logo192.png" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Montserrat"
/>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand Down

0 comments on commit 49d7123

Please sign in to comment.