Skip to content

Commit 6bd279c

Browse files
authored
Merge pull request #22 from p2p-org/Amine/feat/add-story-geth-protocol-support
feat: Add support for Geth protocol with new configs for story network
2 parents fd8ac9c + 9040995 commit 6bd279c

11 files changed

Lines changed: 912 additions & 3 deletions

File tree

.github/workflows/story-geth.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build and Push Story-Geth Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- "story-geth-v[0-9]+.[0-9]+.[0-9]+*"
7+
workflow_dispatch:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
INFRA_TOOLKIT: v0.1.6
13+
14+
jobs:
15+
build-and-push-story-geth:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v2
24+
25+
- name: Set up Go
26+
uses: actions/setup-go@v3
27+
with:
28+
go-version: '1.23'
29+
30+
- name: Log in to the Container registry
31+
uses: docker/login-action@v1
32+
with:
33+
registry: ${{ env.REGISTRY }}
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Build Heighliner binary
38+
run: |
39+
go build -o heighliner
40+
41+
- name: Extract version from tag
42+
id: extract_version
43+
run: echo "VERSION=${GITHUB_REF#refs/tags/story-geth-}" >> $GITHUB_ENV
44+
45+
- name: Manually pull the base Docker image
46+
run: |
47+
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
48+
docker pull ghcr.io/p2p-org/cosmos-heighliner:infra-toolkit-${{ env.INFRA_TOOLKIT }}
49+
50+
- name: Build and push story-geth Docker image
51+
run: |
52+
./heighliner build -c story-geth --git-ref ${{ env.VERSION }}
53+
54+
- name: Tag and push Docker image
55+
run: |
56+
docker tag story-geth:${{ env.VERSION }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:story-geth-${{ env.VERSION }}
57+
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:story-geth-${{ env.VERSION }}

.github/workflows/story.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build and Push Story Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- "story-v[0-9]+.[0-9]+.[0-9]+*"
7+
workflow_dispatch:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
INFRA_TOOLKIT: v0.1.6
13+
14+
jobs:
15+
build-and-push-story:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v2
24+
25+
- name: Set up Go
26+
uses: actions/setup-go@v3
27+
with:
28+
go-version: '1.23'
29+
30+
- name: Log in to the Container registry
31+
uses: docker/login-action@v1
32+
with:
33+
registry: ${{ env.REGISTRY }}
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Build Heighliner binary
38+
run: |
39+
go build -o heighliner
40+
41+
- name: Extract version from tag
42+
id: extract_version
43+
run: echo "VERSION=${GITHUB_REF#refs/tags/story-}" >> $GITHUB_ENV
44+
45+
- name: Manually pull the base Docker image
46+
run: |
47+
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
48+
docker pull ghcr.io/p2p-org/cosmos-heighliner:infra-toolkit-${{ env.INFRA_TOOLKIT }}
49+
50+
- name: Build and push story Docker image
51+
run: |
52+
./heighliner build -c story --git-ref ${{ env.VERSION }}
53+
54+
- name: Tag and push Docker image
55+
run: |
56+
docker tag story:${{ env.VERSION }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:story-${{ env.VERSION }}
57+
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:story-${{ env.VERSION }}

builder/builder.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,19 @@ func rawDockerfile(
141141
return dockerfileEmbeddedOrLocal("cosmos/Dockerfile", dockerfile.Cosmos)
142142
}
143143
return dockerfileEmbeddedOrLocal("cosmos/native.Dockerfile", dockerfile.CosmosNative)
144+
145+
case DockerfileTypeGeth:
146+
if local {
147+
if useBuildKit {
148+
return dockerfileEmbeddedOrLocal("geth/localcross.Dockerfile", dockerfile.GethLocalCross)
149+
}
150+
return dockerfile.GethLocal
151+
}
152+
if useBuildKit {
153+
return dockerfileEmbeddedOrLocal("geth/Dockerfile", dockerfile.Geth)
154+
}
155+
return dockerfileEmbeddedOrLocal("geth/native.Dockerfile", dockerfile.GethNative)
156+
144157
case DockerfileTypeAvalanche:
145158
if useBuildKit {
146159
return dockerfileEmbeddedOrLocal("avalanche/Dockerfile", dockerfile.Avalanche)
@@ -232,9 +245,8 @@ func getModFile(
232245

233246
goMod, err := modfile.Parse("go.mod", goModBz, nil)
234247
if err != nil {
235-
// Only apply the fallback parsing for go-build dockerfile type
236-
// to avoid affecting existing builds
237-
if dockerfileType == DockerfileTypeGoBuild {
248+
// Apply fallback parsing for go-build, cosmos, and geth dockerfile types
249+
if dockerfileType == DockerfileTypeGoBuild || dockerfileType == DockerfileTypeCosmos || dockerfileType == DockerfileTypeGeth {
238250
// If parsing fails (e.g., due to unknown block types like "tool"),
239251
// try to extract just the Go version manually
240252
goVersion := extractGoVersionFromModFile(goModBz)

builder/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ type DockerfileType string
44

55
const (
66
DockerfileTypeCosmos DockerfileType = "cosmos"
7+
DockerfileTypeGeth DockerfileType = "geth"
78
DockerfileTypeAvalanche DockerfileType = "avalanche"
89
DockerfileTypeCargo DockerfileType = "cargo"
910
DockerfileTypeImported DockerfileType = "imported"

chains.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,23 @@
12501250
build-env:
12511251
- BUILD_TAGS=muslc
12521252

1253+
# Story
1254+
- name: story
1255+
github-organization: piplabs
1256+
github-repo: story
1257+
dockerfile: cosmos
1258+
build-target: go build -o story ./client
1259+
binaries:
1260+
- story
1261+
1262+
- name: story-geth
1263+
github-organization: piplabs
1264+
github-repo: story-geth
1265+
dockerfile: geth
1266+
build-target: go run build/ci.go install -static ./cmd/geth
1267+
binaries:
1268+
- build/bin/geth
1269+
12531270
# Stride
12541271
- name: stride
12551272
github-organization: Stride-Labs

chains/story.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Story
2+
- name: story
3+
github-organization: piplabs
4+
github-repo: story
5+
dockerfile: cosmos
6+
build-target: go build -o story ./client
7+
binaries:
8+
- story
9+
10+
- name: story-geth
11+
github-organization: piplabs
12+
github-repo: story-geth
13+
dockerfile: geth
14+
build-target: go run build/ci.go install -static ./cmd/geth
15+
binaries:
16+
- build/bin/geth

dockerfile/dockerfiles.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ var CosmosLocal []byte
2020
//go:embed cosmos/localcross.Dockerfile
2121
var CosmosLocalCross []byte
2222

23+
//go:embed geth/Dockerfile
24+
var Geth []byte
25+
26+
//go:embed geth/native.Dockerfile
27+
var GethNative []byte
28+
29+
//go:embed geth/local.Dockerfile
30+
var GethLocal []byte
31+
32+
//go:embed geth/localcross.Dockerfile
33+
var GethLocalCross []byte
34+
2335
//go:embed imported/Dockerfile
2436
var Imported []byte
2537

0 commit comments

Comments
 (0)