Skip to content

Commit e57e3cc

Browse files
committed
initial commit
0 parents  commit e57e3cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+23918
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Free disk space
2+
description: We've run into out-of-disk error when compiling Rust projects, so we free up some space this way.
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Free Disk Space
8+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # 1.3.1
9+
with:
10+
android: true # This alone is a 12 GB save.
11+
# We disable the rest because it caused some problems. (they're enabled by default)
12+
# The Android removal is enough.
13+
dotnet: false
14+
haskell: false
15+
large-packages: false
16+
swap-storage: false
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Install macOS dependencies
2+
description: Installs dependencies required to compile the template on macOS
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- run: |
8+
curl https://sh.rustup.rs -sSf -y | sh
9+
brew install protobuf
10+
rustup target add wasm32-unknown-unknown --toolchain stable-aarch64-apple-darwin
11+
rustup component add rust-src --toolchain stable-aarch64-apple-darwin
12+
shell: sh
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Install Ubuntu dependencies
2+
description: Installs dependencies required to compile the template in Ubuntu
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Rust compilation prerequisites (Ubuntu)
8+
run: |
9+
sudo apt update
10+
sudo apt install -y \
11+
protobuf-compiler
12+
rustup target add wasm32-unknown-unknown
13+
rustup component add rustfmt clippy rust-src
14+
shell: bash
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Description: Smoke test of the network
2+
Network: ../../zombienet.toml
3+
Creds: config
4+
5+
alice: is up
6+
bob: is up
7+
charlie: is up
8+
9+
alice: log line matches "Imported #[0-9]+" within 20 seconds
10+
bob: log line matches "Imported #[0-9]+" within 20 seconds
11+
12+
alice: parachain 1000 is registered within 60 seconds
13+
alice: parachain 1000 block height is at least 10 within 200 seconds
14+
15+
alice: count of log lines matching "err=" is 0 within 10 seconds
16+
alice: count of log lines matching "(?<!o)(?<!s)(?<! )error(?! )(?!1)(?!3)" is 0 within 10 seconds
17+
18+
bob: count of log lines matching "err=" is 0 within 10 seconds
19+
bob: count of log lines matching "(?<!o)(?<!s)(?<! )error(?! )(?!1)(?!3)" is 0 within 10 seconds
20+
21+
charlie: count of log lines matching "err=" is 0 within 10 seconds
22+
charlie: count of log lines matching "(?<!o)(?<!s)(?<! )error(?! )(?!1)(?!3)" is 0 within 10 seconds

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- master
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
ci:
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
matrix:
19+
os: [ubuntu-latest, macos-latest]
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- if: contains(matrix.os, 'ubuntu')
24+
uses: ./.github/actions/free-disk-space
25+
- if: contains(matrix.os, 'ubuntu')
26+
uses: ./.github/actions/ubuntu-dependencies
27+
- if: contains(matrix.os, 'macos')
28+
uses: ./.github/actions/macos-dependencies
29+
30+
- name: Run clippy
31+
run: |
32+
SKIP_WASM_BUILD=1 cargo clippy --all-targets --all-features --locked --workspace --quiet
33+
timeout-minutes: 30
34+
35+
- name: Run the tests
36+
run: SKIP_WASM_BUILD=1 cargo test
37+
timeout-minutes: 15
38+
39+
- name: Build the docs
40+
run: SKIP_WASM_BUILD=1 cargo doc --workspace --no-deps
41+
timeout-minutes: 15
42+
43+
build-docker:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- uses: ./.github/actions/free-disk-space
49+
50+
- name: Build the Dockerfile
51+
run: docker build . -t polkadot-sdk-parachain-template
52+
timeout-minutes: 90

.github/workflows/pr-reminder.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: PR Reminder
2+
3+
permissions:
4+
pull-requests: write
5+
6+
on:
7+
pull_request:
8+
types:
9+
- opened
10+
11+
jobs:
12+
pr-reminder:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Comment a reminder on a new PR
16+
uses: actions/github-script@v6
17+
with:
18+
script: |
19+
github.rest.issues.createComment({
20+
issue_number: context.issue.number,
21+
owner: context.repo.owner,
22+
repo: context.repo.repo,
23+
body: 'Hello, this is an automatic reminder that any code changes should be made to [the source](https://github.com/paritytech/polkadot-sdk/tree/master/templates/parachain).'
24+
})

.github/workflows/release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Release
2+
3+
permissions:
4+
contents: write
5+
packages: write
6+
7+
on:
8+
release:
9+
types: [released]
10+
11+
jobs:
12+
release-docker:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Set up Docker Buildx
16+
uses: docker/setup-buildx-action@v3
17+
18+
- name: Login to GitHub Container Registry
19+
uses: docker/login-action@v3
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
25+
# We've run into out-of-disk error when compiling Polkadot in the next step, so we free up some space this way.
26+
- name: Free Disk Space (Ubuntu)
27+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # 1.3.1
28+
with:
29+
android: true # This alone is a 12 GB save.
30+
# We disable the rest because it caused some problems. (they're enabled by default)
31+
# The Android removal is enough.
32+
dotnet: false
33+
haskell: false
34+
large-packages: false
35+
swap-storage: false
36+
37+
- name: Build and push
38+
uses: docker/build-push-action@v6
39+
with:
40+
push: true
41+
tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }}
42+
43+
release-binaries:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Rust compilation prerequisites
49+
run: |
50+
sudo apt update
51+
sudo apt install -y \
52+
protobuf-compiler
53+
rustup target add wasm32-unknown-unknown
54+
rustup component add rust-src
55+
56+
- name: Build the template
57+
run: cargo build --workspace --locked --profile production
58+
timeout-minutes: 90
59+
60+
- name: Upload the binaries
61+
uses: softprops/action-gh-release@v2
62+
with:
63+
files: |
64+
target/production/parachain-template-node
65+
target/production/wbuild/parachain-template-runtime/parachain_template_runtime.compact.compressed.wasm
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Test Zombienet
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- master
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
test-zombienet:
16+
runs-on: ubuntu-latest
17+
env:
18+
POLKADOT_VERSION: stable2407
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: ./.github/actions/free-disk-space
23+
- uses: ./.github/actions/ubuntu-dependencies
24+
25+
- name: Build the node individually in release mode
26+
run: cargo build --package parachain-template-node --release
27+
timeout-minutes: 90
28+
29+
- name: Download relaychain binaries
30+
run: |
31+
wget --no-verbose https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-${{ env.POLKADOT_VERSION }}/polkadot
32+
wget --no-verbose https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-${{ env.POLKADOT_VERSION }}/polkadot-prepare-worker
33+
wget --no-verbose https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-${{ env.POLKADOT_VERSION }}/polkadot-execute-worker
34+
chmod +x ./polkadot*
35+
working-directory: ./target/release
36+
37+
- name: Run zombienet tests
38+
run: |
39+
export PATH="./target/release:$PATH"
40+
rm -fr /tmp/zn-test || echo "No test directory to remove"
41+
npx --yes @zombienet/cli --dir /tmp/zn-test --provider native test .github/tests/zombienet-smoke-test.zndsl # || echo "Tests failed - proceeding to logs uploading"
42+
shell: bash
43+
timeout-minutes: 60
44+
- name: Upload logs
45+
uses: actions/[email protected]
46+
with:
47+
name: zn-test-logs
48+
path: |
49+
/tmp/zn-test/logs/alice.log
50+
/tmp/zn-test/logs/bob.log
51+
/tmp/zn-test/logs/charlie.log

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target/

0 commit comments

Comments
 (0)