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

automate chain specs generation #132

Merged
merged 19 commits into from
Sep 26, 2024
Merged
Changes from 13 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
82 changes: 82 additions & 0 deletions .github/workflows/generate-chain-specs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Generate Chain Specs

on:
workflow_dispatch:
push:
paths:
- 'chain-spec-generator/**'
- 'relay/**'
- 'system-parachains/**'
- 'Cargo.toml'
- 'Cargo.lock'

permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
generate-chain-specs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Dependencies
run: |
sudo apt update
sudo apt install -y git protobuf-compiler

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79.0
raynaudoe marked this conversation as resolved.
Show resolved Hide resolved
target: wasm32-unknown-unknown
components: rust-src
override: true

- name: Add rust-src
run: rustup component add rust-src --toolchain 1.79.0-x86_64-unknown-linux-gnu
raynaudoe marked this conversation as resolved.
Show resolved Hide resolved

- name: Build chain-spec-generator
run: cargo build --package chain-spec-generator --features=fast-runtime --release

- name: Generate chain specs
run: |
mkdir -p chain-specs/local
PACKAGES=(
"paseo-local"
"paseo-dev"
"asset-hub-paseo-local"
"bridge-hub-paseo-local"
"people-paseo-local"
"coretime-paseo-local"
raynaudoe marked this conversation as resolved.
Show resolved Hide resolved
"coretime-paseo-tot"
"coretime-paseo"
raynaudoe marked this conversation as resolved.
Show resolved Hide resolved
)

for pkg in "${PACKAGES[@]}"; do
./target/release/chain-spec-generator "$pkg" --raw > "chain-specs/local/$pkg.json"
echo "Generated chain-specs/local/$pkg.json"
done

- name: Setup Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.PASEO_RUNTIME_CI_PAT }}

- name: Commit changes
run: |
git add chain-specs/local/*.json
if git diff --staged --quiet; then
echo "No changes detected in chain specs. Skipping commit."
else
git commit -m "Update chain specs"
git push
echo "Changes committed and pushed successfully."
fi