Skip to content

Commit d7a09ba

Browse files
authored
Add a CI job to make sure relaychain produces blocks (#16)
1 parent 1b627cd commit d7a09ba

File tree

4 files changed

+75
-46
lines changed

4 files changed

+75
-46
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: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
if: contains(matrix.os, 'ubuntu')
9+
run: |
10+
sudo apt update
11+
sudo apt install -y \
12+
protobuf-compiler
13+
rustup target add wasm32-unknown-unknown
14+
rustup component add rustfmt clippy rust-src
15+
shell: bash

.github/workflows/ci.yml

Lines changed: 32 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,20 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
jobs:
15-
ci:
15+
build:
1616
runs-on: ${{ matrix.os }}
1717
strategy:
1818
matrix:
1919
os: [ubuntu-latest, macos-latest]
2020
steps:
2121
- uses: actions/checkout@v4
2222

23-
- name: Rust compilation prerequisites (Ubuntu)
24-
if: contains(matrix.os, 'ubuntu')
25-
run: |
26-
sudo apt update
27-
sudo apt install -y \
28-
protobuf-compiler
29-
rustup target add wasm32-unknown-unknown
30-
rustup component add rustfmt clippy rust-src
31-
32-
- name: Install Cargo (MacOS)
33-
if: contains(matrix.os, 'macos')
34-
run: |
35-
curl https://sh.rustup.rs -sSf -y | sh
36-
brew install protobuf
37-
rustup target add wasm32-unknown-unknown --toolchain stable-aarch64-apple-darwin
38-
rustup component add rust-src --toolchain stable-aarch64-apple-darwin
39-
40-
# We've run into out-of-disk error when compiling Polkadot in the next step, so we free up some space this way.
41-
- name: Free Disk Space (Ubuntu)
42-
if: contains(matrix.os, 'ubuntu')
43-
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # 1.3.1
44-
with:
45-
android: true # This alone is a 12 GB save.
46-
# We disable the rest because it caused some problems. (they're enabled by default)
47-
# The Android removal is enough.
48-
dotnet: false
49-
haskell: false
50-
large-packages: false
51-
swap-storage: false
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
5229

5330
- name: Build the template
5431
run: cargo build
@@ -68,30 +45,39 @@ jobs:
6845
run: SKIP_WASM_BUILD=1 cargo doc --workspace --no-deps
6946
timeout-minutes: 15
7047

71-
# This is mentioned as example in the README:
48+
run-node:
49+
runs-on: ${{ matrix.os }}
50+
strategy:
51+
matrix:
52+
os: [ubuntu-latest, macos-latest]
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- if: contains(matrix.os, 'ubuntu')
57+
uses: ./.github/actions/free-disk-space
58+
- if: contains(matrix.os, 'ubuntu')
59+
uses: ./.github/actions/ubuntu-dependencies
60+
- if: contains(matrix.os, 'macos')
61+
uses: ./.github/actions/macos-dependencies
62+
7263
- name: Build the node individually in release mode
73-
run: |
74-
# Save some space from debug builds
75-
rm -rf ./target
76-
cargo build --package minimal-template-node --release
64+
run: cargo build --package minimal-template-node --release
7765
timeout-minutes: 90
7866

67+
- name: Make sure the node is producing blocks
68+
run: |
69+
./target/release/minimal-template-node --dev 2>&1 | tee out.txt &
70+
until curl -s '127.0.0.1:9944'; do sleep 5; done
71+
until cat out.txt | grep -s "Imported #2"; do sleep 5; done
72+
shell: bash
73+
timeout-minutes: 5
74+
7975
build-docker:
8076
runs-on: ubuntu-latest
8177
steps:
8278
- uses: actions/checkout@v4
8379

84-
# We've run into out-of-disk error when compiling Polkadot in the next step, so we free up some space this way.
85-
- name: Free Disk Space (Ubuntu)
86-
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # 1.3.1
87-
with:
88-
android: true # This alone is a 12 GB save.
89-
# We disable the rest because it caused some problems. (they're enabled by default)
90-
# The Android removal is enough.
91-
dotnet: false
92-
haskell: false
93-
large-packages: false
94-
swap-storage: false
80+
- uses: ./.github/actions/free-disk-space
9581

9682
- name: Build the Dockerfile
9783
run: docker build . -t polkadot-sdk-minimal-template

0 commit comments

Comments
 (0)