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

asd #525

Closed
wants to merge 8 commits into from
Closed

asd #525

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
8 changes: 4 additions & 4 deletions .github/actions/docker-publish/action.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: 'Build & Plush Docker'
name: 'Build & Push Docker'

inputs:
compose-version:
description: 'Docker Dompose version'
description: 'Docker Compose version'
default: 2.6.0
registry:
description: 'Docker registry service'
Expand Down Expand Up @@ -30,7 +30,7 @@ inputs:
outputs:
image:
description: 'Image url'
value: ${{ steps.imageOuput.outputs.imageUrl }}
value: ${{ steps.imageOutput.outputs.imageUrl }}
imageid:
description: 'Image ID'
value: ${{ steps.publish.outputs.imageId }}
Expand Down Expand Up @@ -77,7 +77,7 @@ runs:
build-args: ${{ inputs.build-args }}
cache-from: type=gha
cache-to: type=gha,mode=max
- id: imageOuput
- id: imageOutput
shell: bash
run: |
echo "imageUrl=${{ fromJSON(steps.publish.outputs.metadata)['image.name'] }}" >> $GITHUB_OUTPUT
111 changes: 80 additions & 31 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,84 @@
name: Build and publish Docker image
name: 'Build & Push Docker'

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize]
release:
types: [published]
inputs:
compose-version:
description: 'Docker Compose version'
default: 2.6.0
registry:
description: 'Docker registry service'
default: ghcr.io
username:
description: 'Username for https://ghcr.io'
required: true
password:
description: 'Password for https://ghcr.io'
required: true
image:
description: 'Image name with provider url'
required: true
dockerfile:
description: 'Path to the Dockerfile'
required: true
context:
description: 'Path to the Context'
default: .
required: true
build-args:
description: 'List of build-time variables'
required: false

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
outputs:
image:
description: 'Image url'
value: ${{ steps.imageOutput.outputs.imageUrl }}
imageid:
description: 'Image ID'
value: ${{ steps.publish.outputs.imageId }}
digest:
description: 'Image digest'
value: ${{ steps.publish.outputs.digest }}
metadata:
description: 'Build result metadata'
value: ${{ steps.publish.outputs.metadata }}

jobs:
build-and-publish-image:
runs-on: buildjet-4vcpu-ubuntu-2204
if: |
(github.event_name == 'release' && github.event.action == 'published') ||
github.ref == 'refs/heads/main' ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository)
steps:
- uses: actions/checkout@v3
runs:
using: 'composite'
steps:
- name: Log in to the ghcr.io registry
uses: docker/login-action@v2
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.username }}
password: ${{ inputs.password }}

- name: Build and push Fuel Explorer Graphql image
uses: ./.github/actions/docker-publish
id: publish
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
image: ghcr.io/fuellabs/fuel-explorer
dockerfile: deployment/Dockerfile
context: .
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
${{ inputs.image }}
tags: |
type=ref,event=branch
type=sha,prefix=
type=semver,pattern={{raw}}

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

- name: Build and push the image to ghcr.io
uses: docker/build-push-action@v4
id: publish
with:
context: ${{ inputs.context }}
file: ${{ inputs.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: ${{ inputs.build-args || '' }}
cache-from: type=gha
cache-to: type=gha,mode=max

- id: imageOutput
shell: bash
run: |
echo "imageUrl=${{ fromJSON(steps.publish.outputs.metadata)['image.name'] }}" >> $GITHUB_OUTPUT
17 changes: 3 additions & 14 deletions .github/workflows/helm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,17 @@ on:

permissions:
contents: read
packages: write

jobs:
helm-release:
name: Build Helm Chart
runs-on: buildjet-4vcpu-ubuntu-2204
runs-on: ubuntu-latest
if: |
(github.event_name == 'release' && github.event.action == 'published') ||
github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
permissions:
contents: read
packages: write

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Package and Push Charts
uses: bsord/[email protected]
with:
useOCIRegistry: true
registry-url: oci://ghcr.io/fuellabs/helmcharts
username: ${{ github.repository_owner }}
access-token: ${{ secrets.GITHUB_TOKEN }}
force: true
chart-folder: ./helm/fuel-explorer
- name:
11 changes: 6 additions & 5 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ jobs:
run: cp packages/app-explorer/.env.example packages/app-explorer/.env

- name: Setup Node
uses: FuelLabs/github-actions/setups/node@master
uses: FuelLabs/github-actions/setups/node@v1 # master yerine sürüm sabitlendi
with:
node-version: 20.15.1
pnpm-version: 9.5.0

- name: Setup Docker
uses: FuelLabs/github-actions/setups/docker@master
uses: FuelLabs/github-actions/setups/docker@v1 # master yerine sürüm sabitlendi
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -57,6 +57,7 @@ jobs:

- name: Stop Test Node
run: pnpm node:stop

tests-e2e-soft:
name: E2E Tests Soft
runs-on: buildjet-4vcpu-ubuntu-2204
Expand All @@ -71,13 +72,13 @@ jobs:
run: cp packages/app-explorer/.env.example packages/app-explorer/.env

- name: Setup Node
uses: FuelLabs/github-actions/setups/node@master
uses: FuelLabs/github-actions/setups/node@v1 # master yerine sürüm sabitlendi
with:
node-version: 20.15.1
pnpm-version: 9.5.0

- name: Setup Docker
uses: FuelLabs/github-actions/setups/docker@master
uses: FuelLabs/github-actions/setups/docker@v1 # master yerine sürüm sabitlendi
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -89,7 +90,7 @@ jobs:
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps chromium

- name: Run E2E Tests
- name: Run E2E Tests Soft
run: xvfb-run --auto-servernum -- pnpm test:e2e-soft

- uses: actions/upload-artifact@v4
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,32 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

audit:
name: Audit
name: Audit Dependencies for Critical Vulnerabilities
if: ${{ github.head_ref != 'changeset-release/master' }}
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
- uses: FuelLabs/github-actions/setups/node@v1 # master yerine sürüm sabitlendi
with:
node-version: 20.15.1
pnpm-version: 9.5.0

- name: Run Audit
# temporally avoid low severity vulnerabilities
run: pnpm audit --prod --audit-level critical
- name: Run Audit (Critical Vulnerabilities Only)
run: |
# Only checking for critical severity vulnerabilities
pnpm audit --prod --audit-level critical

lint-and-test:
name: Lint
name: Lint and TypeScript Check
if: ${{ github.head_ref != 'changeset-release/master' }}
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
- uses: FuelLabs/github-actions/setups/node@v1 # master yerine sürüm sabitlendi
with:
node-version: 20.15.1
pnpm-version: 9.5.0

- name: Run lint & ts:check
- name: Run Linter and TypeScript Check
run: |
pnpm lint:ci
10 changes: 4 additions & 6 deletions .github/workflows/release-npm-changeset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
# need this to get full git-history/clone in order to build changelogs and check changesets
fetch-depth: 0
# workaround to ensure force pushes to changeset branch use REPO_TOKEN owner's account
# see https://github.com/changesets/action/issues/70
persist-credentials: false
- uses: FuelLabs/github-actions/setups/node@master

- uses: FuelLabs/github-actions/setups/node@v1 # master yerine sürüm sabitlendi
with:
node-version: 20.15.1
pnpm-version: 9.5.0

- uses: FuelLabs/github-actions/setups/npm@master
- uses: FuelLabs/github-actions/setups/npm@v1 # master yerine sürüm sabitlendi
with:
npm-token: ${{ secrets.NPM_TOKEN }}

Expand All @@ -48,7 +46,7 @@ jobs:

- name: Create Release Pull Request or Publish to NPM
id: changesets
uses: FuelLabs/changesets-action@main
uses: FuelLabs/changesets-action@v1 # main yerine sürüm sabitlendi
with:
publish: pnpm changeset publish --tag next
commit: "ci(changesets): versioning packages"
Expand Down
25 changes: 11 additions & 14 deletions deployment/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This image contains the graphql server
# built for the fuel-explorer
FROM node:20 AS base

ENV DEBIAN_FRONTEND=noninteractive
Expand All @@ -13,29 +11,28 @@ ENV SYNCER_PORT="${SYNCER_PORT:-3001}"
ENV FUEL_PROVIDER="${FUEL_PROVIDER:-https://testnet.fuel.network/v1/graphql}"
ENV SERVER_BUILD=true
ENV SYNC_MISSING=true
ENV DB_HOST="${DB_HOST}"
ENV DB_PORT="${DB_PORT}"
ENV DB_NAME="${DB_NAME}"
ENV DB_USER="${DB_USER}"
ENV DB_PASS="${DB_PASS}"
ENV RABBITMQ_HOST="${RABBITMQ_HOST}"
ENV RABBITMQ_PORT="${RABBITMQ_PORT}"
ENV RABBITMQ_USER="${RABBITMQ_USER}"
ENV RABBITMQ_PASS="${RABBITMQ_PASS}"
ENV DB_HOST="${DB_HOST:-localhost}"
ENV DB_PORT="${DB_PORT:-5432}"
ENV DB_NAME="${DB_NAME:-postgres}"
ENV DB_USER="${DB_USER:-postgres}"
ENV DB_PASS="${DB_PASS:-postgres}"
ENV RABBITMQ_HOST="${RABBITMQ_HOST:-localhost}"
ENV RABBITMQ_PORT="${RABBITMQ_PORT:-5672}"
ENV RABBITMQ_USER="${RABBITMQ_USER:-guest}"
ENV RABBITMQ_PASS="${RABBITMQ_PASS:-guest}"

RUN corepack enable
RUN corepack enable && corepack prepare pnpm@latest --activate

FROM base AS build
COPY . /app
WORKDIR /app
RUN pnpm install --frozen-lockfile

FROM base AS explorer
COPY --from=build /app /app-explorer
COPY --chown=node:node --from=build /app /app-explorer
WORKDIR /app-explorer/packages/graphql

RUN pnpm build:lib

EXPOSE ${SERVER_PORT}
RUN chown -R node:node /app-explorer
CMD ["sh", "./scripts/run.sh"]
Loading