Skip to content

Commit

Permalink
reduce implementation complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxingloh committed Mar 14, 2024
1 parent 469f762 commit 260de90
Show file tree
Hide file tree
Showing 31 changed files with 111 additions and 121 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
# More details are here: https://help.github.com/articles/about-codeowners/

/.github/ @fuxingloh
/pnpm-lock.yaml @fuxingloh
25 changes: 25 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base", "helpers:pinGitHubActionDigests", ":semanticCommits", ":semanticCommitTypeAll(bump)"],
"dependencyDashboard": true,
"dependencyDashboardAutoclose": false,
"major": {
"dependencyDashboardApproval": false
},
"rangeStrategy": "bump",
"packageRules": [
{
"matchPackageNames": ["node", "npm", "pnpm", "yarn", "typescript", "@types/node"],
"groupName": "engines",
"enabled": false
},
{
"matchPackagePatterns": ["^@contentedjs/"],
"groupName": "@contentedjs"
},
{
"matchPackagePatterns": ["^@eslint/", "^eslint$"],
"groupName": "@eslint"
}
]
}
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: '.nvmrc'

Expand All @@ -37,7 +37,7 @@ jobs:
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: '.nvmrc'

Expand All @@ -51,9 +51,9 @@ jobs:
name: Lint [prettier]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: '.nvmrc'

Expand All @@ -67,9 +67,9 @@ jobs:
name: Lint [eslint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: '.nvmrc'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: OSS Governance Labeler
name: PR Labeler

on:
pull_request_target:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
name: Draft Release
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@65c5fb495d1e69aa8c08a3317bc44ff8aabe9772 # v5.24.0
- uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 43 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
result: ${{ steps.version.outputs.result }}
steps:
- id: version
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const tag = "${{ github.event.release.tag_name }}";
Expand All @@ -34,9 +34,9 @@ jobs:
contents: read
id-token: write
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: '.nvmrc'

Expand All @@ -57,3 +57,43 @@ jobs:

- run: npm config delete "//registry.npmjs.org/:_authToken" --location=global
if: always()

ghcr:
name: Release GHCR
runs-on: ubuntu-latest
needs: version
environment: GHCR Packages
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
package:
- karfia-agent
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: '.nvmrc'

- run: corepack enable pnpm

- run: pnpm install --frozen-lockfile

- uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
with:
platforms: linux/amd64,linux/arm64

- run: docker buildx create --use --bootstrap --driver=docker-container

- run: pnpm -r exec npm version ${{ needs.version.outputs.result }} --git-tag-version=false

- run: pnpm turbo run push:docker --filter=${{ matrix.package }} --concurrency=1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"repository": {
"url": "git+https://github.com/fuxingloh/karfia"
},
"license": "MPL-2.0",
"scripts": {
"lint": "eslint .",
"test": "jest"
Expand All @@ -26,6 +27,5 @@
"@workspace/tsconfig": "workspace:*",
"karfia-definition": "workspace:*",
"karfia-testcontainers": "workspace:*"
},
"licnese": "MPL-2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "@karfia/bip122-0f9188f13cb7b2c71f2a335e3a4fc328",
"version": "0.0.0",
"private": false,
"repository": {
"url": "git+https://github.com/fuxingloh/karfia"
},
"license": "MPL-2.0",
"scripts": {
"lint": "eslint .",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"repository": {
"url": "git+https://github.com/fuxingloh/karfia"
},
"license": "MPL-2.0",
"scripts": {
"lint": "eslint .",
"test": "jest"
Expand All @@ -26,6 +27,5 @@
"@workspace/tsconfig": "workspace:*",
"karfia-definition": "workspace:*",
"karfia-testcontainers": "workspace:*"
},
"licnese": "MPL-2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"repository": {
"url": "git+https://github.com/fuxingloh/karfia"
},
"license": "MPL-2.0",
"scripts": {
"lint": "eslint .",
"test": "jest"
Expand All @@ -26,6 +27,5 @@
"@workspace/tsconfig": "workspace:*",
"karfia-definition": "workspace:*",
"karfia-testcontainers": "workspace:*"
},
"licnese": "MPL-2.0"
}
}
4 changes: 2 additions & 2 deletions definitions/eip155-1337/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"repository": {
"url": "git+https://github.com/fuxingloh/karfia"
},
"license": "MPL-2.0",
"scripts": {
"lint": "eslint .",
"test": "jest"
Expand All @@ -26,6 +27,5 @@
"@workspace/tsconfig": "workspace:*",
"karfia-definition": "workspace:*",
"karfia-testcontainers": "workspace:*"
},
"licnese": "MPL-2.0"
}
}
4 changes: 2 additions & 2 deletions definitions/eip155-31337/hardhat.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"name": "Hardhat",
"containers": {
"hardhat": {
"image": "docker.io/karfia/eip155-31337:hardhat-2.19.4",
"source": "https://github.com/fuxingloh/karfia/tree/main/definitions/eip155-31337/hardhat.Dockerfile",
"image": "ghcr.io/fuxingloh/hardhat-container:2.19.4",
"source": "https://github.com/fuxingloh/hardhat-container",
"resources": {
"cpu": 0.25,
"memory": 256
Expand Down
10 changes: 0 additions & 10 deletions definitions/eip155-31337/hardhat/Dockerfile

This file was deleted.

4 changes: 0 additions & 4 deletions definitions/eip155-31337/hardhat/hardhat.config.js

This file was deleted.

11 changes: 0 additions & 11 deletions definitions/eip155-31337/hardhat/hardhat.package.json

This file was deleted.

8 changes: 0 additions & 8 deletions definitions/eip155-31337/hardhat/package.json

This file was deleted.

10 changes: 0 additions & 10 deletions definitions/eip155-31337/hardhat/turbo.json

This file was deleted.

5 changes: 2 additions & 3 deletions definitions/eip155-31337/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"repository": {
"url": "git+https://github.com/fuxingloh/karfia"
},
"license": "MPL-2.0",
"scripts": {
"lint": "eslint .",
"test": "jest"
Expand All @@ -22,11 +23,9 @@
"preset": "@workspace/jest-preset"
},
"devDependencies": {
"@karfia/eip155-31337-hardhat": "workspace:*",
"@workspace/jest-preset": "workspace:*",
"@workspace/tsconfig": "workspace:*",
"karfia-definition": "workspace:*",
"karfia-testcontainers": "workspace:*"
},
"licnese": "MPL-2.0"
}
}
8 changes: 4 additions & 4 deletions packages/karfia-agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ RUN pnpm turbo run build --filter=karfia-agent

# Run agent
FROM node:20-alpine AS runner
RUN addgroup --system --gid 1001 karfia-agent && \
adduser --system --uid 1001 karfia-agent
USER karfia-agent
RUN addgroup --system --gid 1001 karfia && \
adduser --system --uid 1001 karfia
USER karfia

EXPOSE 1194
WORKDIR /app/packages/karfia-agent

COPY --from=builder --chown=karfia-agent:karfia-agent /app /app
COPY --from=builder --chown=karfia:karfia /app /app
CMD node "server.js"
7 changes: 4 additions & 3 deletions packages/karfia-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
"repository": {
"url": "git+https://github.com/fuxingloh/karfia"
},
"license": "MPL-2.0",
"scripts": {
"build": "tsc --project tsconfig.build.json",
"build:docker": "docker build -t docker.io/karfia/karfia-agent:$(node -p \"require('./package.json').version\") -f Dockerfile ../../",
"build:docker": "docker build -t ghcr.io/fuxingloh/karfia-agent:$(node -p \"require('./package.json').version\") -f Dockerfile ../../",
"clean": "tsc --build --clean",
"lint": "eslint .",
"push:docker": "docker buildx build -t ghcr.io/fuxingloh/karfia-agent:$(node -p \"require('./package.json').version\") -f Dockerfile ../../ --output type=registry --platform linux/amd64,linux/arm64",
"test": "jest --passWithNoTests"
},
"lint-staged": {
Expand All @@ -35,6 +37,5 @@
"devDependencies": {
"@workspace/jest-preset": "workspace:*",
"@workspace/tsconfig": "workspace:*"
},
"licnese": "MPL-2.0"
}
}
8 changes: 0 additions & 8 deletions packages/karfia-cdk8s/package.json

This file was deleted.

8 changes: 0 additions & 8 deletions packages/karfia-core/package.json

This file was deleted.

4 changes: 2 additions & 2 deletions packages/karfia-definition/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"repository": {
"url": "git+https://github.com/fuxingloh/karfia"
},
"license": "MPL-2.0",
"main": "index.json",
"types": "index.d.ts",
"files": [
Expand Down Expand Up @@ -36,6 +37,5 @@
"devDependencies": {
"@workspace/tsconfig": "workspace:*",
"json-schema-to-typescript": "^13.1.2"
},
"licnese": "MPL-2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ name: eip155_1337_ganache_7_9_1
services:
karfia-agent:
container_name: karfia-agent-\${KARFIA_DEPLOYMENT_ID}
image: docker.io/karfia/karfia-agent:0.0.0
image: ghcr.io/fuxingloh/karfia-agent:0.0.0
ports:
- '0:1194'
environment:
Expand Down
Loading

0 comments on commit 260de90

Please sign in to comment.