@@ -467,109 +467,8 @@ jobs:
467
467
echo "All pods are 4/4 up and ready"
468
468
469
469
publish-ghcr-image :
470
- runs-on : ubuntu-latest
471
- permissions :
472
- contents : write
473
- packages : write
474
- steps :
475
- - name : Checkout
476
- uses : actions/checkout@v4
477
- with :
478
- ref : ${{ github.event.inputs.partner-chains-sha }}
479
-
480
- - name : Setup Earthly
481
- uses : ./.github/earthly-setup
482
- with :
483
- ssh_key : ${{ secrets.SUBSTRATE_REPO_SSH_KEY }}
484
- config_tar : ${{ secrets.EARTHLY_TAR }}
485
-
486
- - name : Build and Benchmark
487
- env :
488
- EARTHLY_CI : true
489
- run : |
490
- export EARTHLY_OUTPUT=true
491
- earthly -P +build --PROFILE=production --FEATURES=runtime-benchmarks
492
-
493
- - name : Generate and Extract Weights
494
- continue-on-error : true
495
- run : |
496
- repository_name="${GITHUB_REPOSITORY##*/}"
497
- echo "Listing contents on the runner host in /home/runner/work/${repository_name}/${repository_name}:"
498
- ls -la /home/runner/work/${repository_name}/${repository_name}
499
- echo "Pulling Docker image..."
500
- docker pull ubuntu:22.04
501
- mkdir -p weights
502
- echo "Running Docker container..."
503
- docker run -d --name weight_generation \
504
- --memory=4096m \
505
- --cpus=1 \
506
- -v /home/runner/work/${repository_name}/${repository_name}:/workspace \
507
- ubuntu:22.04 \
508
- /bin/bash -c "sleep infinity"
509
- echo "Installing necessary packages inside the container..."
510
- docker exec weight_generation bash -c "\
511
- apt-get update && \
512
- apt-get install -y jq curl build-essential && \
513
- echo 'Checking files in workspace...' && \
514
- ls -la /workspace && \
515
- mkdir -p /workspace/target/production && \
516
- cp /workspace/sidechains-substrate-node /workspace/target/production/sidechains-substrate-node && \
517
- echo 'Verifying the binary is in the expected path...' && \
518
- ls -la /workspace/target/production && \
519
- cd /workspace && \
520
- echo 'Setting the current working directory to /workspace...' && \
521
- chmod +x scripts/run_all_pallet_overhead_and_machine_benchmarks.sh && \
522
- chmod +x scripts/run_storage_benchmarks.sh && \
523
- source .envrc || true && \
524
- ./scripts/run_all_pallet_overhead_and_machine_benchmarks.sh -b && \
525
- ./scripts/run_storage_benchmarks.sh -b || true"
526
- echo "Finding and copying weight files..."
527
- weight_files=$(docker exec weight_generation find /workspace/runtime/src/weights -name '*.rs')
528
- echo "$weight_files" | while read weight_file; do
529
- weight_file_name=$(basename "$weight_file")
530
- echo "Copying ${weight_file_name}"
531
- docker cp "weight_generation:$weight_file" "weights/${weight_file_name}"
532
- done
533
- docker stop weight_generation
534
- docker rm weight_generation
535
-
536
- - name : Overwrite Weights in Runtime Directory
537
- continue-on-error : true
538
- run : |
539
- sudo chmod -R a+rwx ./runtime/src/weights
540
- for weight_file in weights/*.rs
541
- do
542
- cp "$weight_file" "./runtime/src/weights/$(basename "$weight_file")"
543
- done
544
-
545
- - name : Main Build
546
- if : ${{ inputs.publish_to_ghcr }}
547
- env :
548
- EARTHLY_CI : true
549
- EARTHLY_PUSH : false
550
- EARTHLY_OUTPUT : true
551
- run : earthly -P +docker --image="ghcr-image" --tags="latest"
552
-
553
- - name : Login to GitHub Container Registry
554
- uses : docker/login-action@v3
555
- with :
556
- registry : ghcr.io
557
- username : ${{ github.actor }}
558
- password : ${{ secrets.GITHUB_TOKEN }}
559
- logout : true
560
- env :
561
- SSH_AUTH_SOCK : /tmp/ssh_agent.sock
562
- FORCE_COLOR : 1
563
-
564
- - name : Tag and Push Image to GHCR
565
- run : |
566
- repository_name="${GITHUB_REPOSITORY##*/}"
567
- target_image="ghcr.io/${{ github.repository }}/$repository_name-node"
568
-
569
- docker tag ghcr-image:latest $target_image:latest
570
- docker tag ghcr-image:latest $target_image:${{ github.event.inputs.partner-chains-sha }}
571
- docker tag ghcr-image:latest $target_image:${{ github.event.inputs.partner-chains-tag }}
572
-
573
- docker push $target_image:latest
574
- docker push $target_image:${{ github.event.inputs.partner-chains-sha }}
575
- docker push $target_image:${{ github.event.inputs.partner-chains-tag }}
470
+ uses : ./.github/workflows/modules/build-and-publish-ghcr-image.yml
471
+ with :
472
+ commit_sha : ${{ github.event.inputs.partner-chains-sha }}
473
+ ghcr_tag : ${{ github.event.inputs.partner-chains-tag }}
474
+ publish_to_ghcr : true
0 commit comments