@@ -108,8 +108,20 @@ jobs:
108108
109109 - name : Create development chain spec
110110 run : |
111- # Create Development directory in Chainspecs if it doesn't exist
112- mkdir -p Chainspecs/Development
111+ set -euo pipefail
112+
113+ # Create development directory in chainspecs if it doesn't exist
114+ mkdir -p chainspecs/development
115+
116+ # Debug: Check chain-spec-builder version and help
117+ echo "Chain-spec-builder version:"
118+ chain-spec-builder --version || echo "No version flag available"
119+
120+ echo -e "\nChain-spec-builder help:"
121+ chain-spec-builder --help || echo "No help available"
122+
123+ echo -e "\nChain-spec-builder create help:"
124+ chain-spec-builder create --help || echo "No create help available"
113125
114126 # Check if the runtime has a development preset
115127 echo "Checking available presets..."
@@ -120,75 +132,110 @@ jobs:
120132 echo "Checking if runtime WASM exists..."
121133 ls -la runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm || echo "Runtime WASM not found!"
122134
123- # Use the development preset from the runtime
124- echo "Creating development chain spec using 'development' preset..."
125- if ! chain-spec-builder create \
126- --runtime runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm \
127- named-preset development \
128- > Chainspecs/Development/development.json 2>&1; then
129- echo "Error creating development chain spec. Output:"
130- cat Chainspecs/Development/development.json
131- exit 1
132- fi
133-
134- # Check if file has content
135- if [ ! -s Chainspecs/Development/development.json ]; then
136- echo "Error: development.json is empty!"
137- exit 1
138- fi
139-
135+ # Generate development chain spec
136+ echo "Creating development chain spec..."
137+ chain-spec-builder \
138+ -c chainspecs/development/development.json \
139+ create \
140+ -r runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm \
141+ named-preset development
142+
140143 # Convert to raw format
141144 echo "Converting to raw format..."
142- chain-spec-builder convert-to-raw Chainspecs/Development/development.json > Chainspecs/Development/development-raw.json
145+ chain-spec-builder \
146+ -c chainspecs/development/development-raw.json \
147+ convert-to-raw \
148+ chainspecs/development/development.json
143149
144150 # Verify the specs were created
145151 echo "✅ Generated chain specifications:"
146- ls -l Chainspecs/Development /
152+ ls -l chainspecs/development /
147153
148- # Output the final chain spec structure
149- echo "Final chain spec structure:"
150- jq -r '.genesis.runtime | keys[]' Chainspecs/Development/development.json || true
151-
152- - name : Create staging chain specs with bootnodes
153- run : |
154- # Create Staging directory in Chainspecs if it doesn't exist
155- mkdir -p Chainspecs/Staging
154+ # Quick verification of content
155+ echo "Verifying development.json content:"
156+ jq '.name' chainspecs/development/development.json || echo "Failed to parse JSON"
157+
158+ # Comprehensive verification
159+ echo -e "\n📋 Verification of generated files:"
160+ ls -l chainspecs/development/development.json chainspecs/development/development-raw.json
161+
162+ echo -e "\n📄 Chain spec structure (first 5 lines):"
163+ jq . chainspecs/development/development.json | head -n 5
164+
165+ echo -e "\n🔍 Checking file sizes:"
166+ stat -c "development.json: %s bytes" chainspecs/development/development.json
167+ stat -c "development-raw.json: %s bytes" chainspecs/development/development-raw.json
156168
157- # Generate staging chain spec (plain) with bootnodes
158- echo "Generating staging chain spec with bootnodes..."
159- if ! chain-spec-builder create \
160- --runtime runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm \
161- named-preset staging \
162- > Chainspecs/Staging/staging-chainspec.json 2>&1; then
163- echo "Error creating staging chain spec. Output:"
164- cat Chainspecs/Staging/staging-chainspec.json
169+ # Verify raw spec is SCALE-encoded (not JSON)
170+ echo -e "\n🔬 Verifying raw spec format (first 200 bytes):"
171+ head -c 200 chainspecs/development/development-raw.json | xxd | head -n 5 || echo "Could not read raw spec"
172+
173+ # Ensure files are not empty
174+ if [ ! -s chainspecs/development/development.json ]; then
175+ echo "❌ Error: development.json is empty!"
165176 exit 1
166177 fi
167-
168- # Check if file has content
169- if [ ! -s Chainspecs/Staging/staging-chainspec.json ]; then
170- echo "Error: staging-chainspec.json is empty!"
178+ if [ ! -s chainspecs/development/development-raw.json ]; then
179+ echo "❌ Error: development-raw.json is empty!"
171180 exit 1
172181 fi
182+ echo "✅ All development chain spec files are populated"
183+
184+ - name : Create staging chain specs
185+ run : |
186+ set -euo pipefail
187+
188+ # Create staging directory in chainspecs if it doesn't exist
189+ mkdir -p chainspecs/staging
173190
174- # Add bootnodes to the staging chain spec
175- echo "Adding bootnodes to staging chain spec..."
176- jq '.bootNodes = [
177- "/dns/fennel-bootnode-1.fennel-staging.svc.cluster.local/tcp/30333/p2p/12D3KooWDCZGrnJhsgWJtDcs6eZc1hUBrVj5QqkEWggAkNVowRAi",
178- "/dns/fennel-bootnode-2.fennel-staging.svc.cluster.local/tcp/30333/p2p/12D3KooWDbfFv6oepAXmQaiwFaVjD9g7AxowQ8LQdWTcVYpKhnAx"
179- ]' Chainspecs/Staging/staging-chainspec.json > Chainspecs/Staging/staging-chainspec-temp.json && mv Chainspecs/Staging/staging-chainspec-temp.json Chainspecs/Staging/staging-chainspec.json
191+ # Generate staging chain spec
192+ echo "Generating staging chain spec..."
193+ chain-spec-builder \
194+ -c chainspecs/staging/staging-chainspec.json \
195+ create \
196+ -r runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm \
197+ named-preset staging
180198
181- # Generate staging chain spec (raw) with bootnodes
199+ # Generate raw staging chain spec
182200 echo "Generating raw staging chain spec..."
183- chain-spec-builder convert-to-raw Chainspecs/Staging/staging-chainspec.json > Chainspecs/Staging/staging-raw.json
201+ chain-spec-builder \
202+ -c chainspecs/staging/staging-raw.json \
203+ convert-to-raw \
204+ chainspecs/staging/staging-chainspec.json
184205
185206 # Verify the staging specs were created
186207 echo "✅ Generated staging chain specifications:"
187- ls -la Chainspecs/Staging/
208+ ls -la chainspecs/staging/
209+
210+ # Quick verification of content
211+ echo "Verifying staging-chainspec.json content:"
212+ jq '.name' chainspecs/staging/staging-chainspec.json || echo "Failed to parse JSON"
213+
214+ # Comprehensive verification
215+ echo -e "\n📋 Verification of generated files:"
216+ ls -l chainspecs/staging/staging-chainspec.json chainspecs/staging/staging-raw.json
188217
189- # Show bootnode configuration in the generated specs
190- echo "Bootnode configuration in staging spec:"
191- jq -r '.bootNodes[]' Chainspecs/Staging/staging-chainspec.json
218+ echo -e "\n📄 Chain spec structure (first 5 lines):"
219+ jq . chainspecs/staging/staging-chainspec.json | head -n 5
220+
221+ echo -e "\n🔍 Checking file sizes:"
222+ stat -c "staging-chainspec.json: %s bytes" chainspecs/staging/staging-chainspec.json
223+ stat -c "staging-raw.json: %s bytes" chainspecs/staging/staging-raw.json
224+
225+ # Verify raw spec is SCALE-encoded (not JSON)
226+ echo -e "\n🔬 Verifying raw spec format (first 200 bytes):"
227+ head -c 200 chainspecs/staging/staging-raw.json | xxd | head -n 5 || echo "Could not read raw spec"
228+
229+ # Ensure files are not empty
230+ if [ ! -s chainspecs/staging/staging-chainspec.json ]; then
231+ echo "❌ Error: staging-chainspec.json is empty!"
232+ exit 1
233+ fi
234+ if [ ! -s chainspecs/staging/staging-raw.json ]; then
235+ echo "❌ Error: staging-raw.json is empty!"
236+ exit 1
237+ fi
238+ echo "✅ All staging chain spec files are populated"
192239
193240 - name : Commit staging chainspecs to repository
194241 run : |
@@ -197,13 +244,13 @@ jobs:
197244 git config --local user.name "GitHub Action"
198245
199246 # Add the staging chainspecs
200- git add Chainspecs/Staging /staging-chainspec.json Chainspecs/Staging /staging-raw.json
247+ git add chainspecs/staging /staging-chainspec.json chainspecs/staging /staging-raw.json
201248
202249 # Check if there are changes to commit
203250 if git diff --staged --quiet; then
204251 echo "No changes to staging chainspecs"
205252 else
206- # Commit the changes
253+ # Commit the changes with [skip ci] to prevent retriggering
207254 git commit -m "Update staging chainspecs with bootnodes [skip ci]"
208255
209256 # Push the changes back to the repository
@@ -217,10 +264,10 @@ jobs:
217264 with :
218265 name : fennel-chainspecs
219266 path : |
220- Chainspecs/Development /development.json
221- Chainspecs/Development /development-raw.json
222- Chainspecs/Staging /staging-chainspec.json
223- Chainspecs/Staging /staging-raw.json
267+ chainspecs/development /development.json
268+ chainspecs/development /development-raw.json
269+ chainspecs/staging /staging-chainspec.json
270+ chainspecs/staging /staging-raw.json
224271
225272 # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
226273 # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
@@ -236,6 +283,7 @@ jobs:
236283 build-args : |
237284 WASM_HASH=${{ env.WASM_HASH }}
238285 cache-from : type=gha
286+ cache-to : type=gha,mode=max
239287 provenance : false
240288
241289 # Create and upload artifact containing image info
@@ -252,5 +300,4 @@ jobs:
252300 uses : actions/upload-artifact@v4
253301 with :
254302 name : fennel-node-image-info
255- path : ./artifacts/image-info.txt
256-
303+ path : ./artifacts/image-info.txt
0 commit comments