Skip to content

Commit 588566e

Browse files
committed
Merge branch 'main' into ak-adjust-westend
2 parents ea5050a + b48ef2e commit 588566e

Some content is hidden

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

48 files changed

+4135
-1606
lines changed

.github/workflows/check.yml

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: echo "CI_IMAGE=${{ env.CI_IMAGE }}" >> $GITHUB_OUTPUT
3535

3636
check-fmt:
37-
runs-on: ubuntu-latest
37+
runs-on: parity-default
3838
timeout-minutes: 20
3939
needs: [set-image]
4040
container:
@@ -49,16 +49,20 @@ jobs:
4949
5050
- name: Check TOML format
5151
run: |
52-
cargo install taplo-cli
52+
cargo install taplo-cli && taplo --version
5353
if ! taplo format --check --config .config/taplo.toml; then
5454
echo "Please run 'taplo format --config .config/taplo.toml' to fix any TOML formatting issues"
5555
exit 1
5656
fi
57+
cargo install --locked zepter && zepter --version
58+
if ! zepter run check --config .config/zepter.yaml; then
59+
echo "Please run 'zepter run --config .config/zepter.yaml' to fix any TOML formatting issues"
60+
exit 1
61+
fi
5762
5863
check:
5964
name: Cargo check
60-
# TODO: replace `parity-default` with `ubuntu-latest` when the repo becomes public.
61-
runs-on: parity-default
65+
runs-on: parity-large
6266
needs: [set-image, check-fmt]
6367
container:
6468
image: ${{ needs.set-image.outputs.CI_IMAGE }}
@@ -69,36 +73,16 @@ jobs:
6973
- name: Rust cache
7074
uses: Swatinem/rust-cache@v2
7175
with:
72-
cache-on-failure: true
73-
cache-all-crates: true
76+
shared-key: "bulletin-cache-check"
77+
save-if: ${{ github.ref == 'refs/heads/main' }}
7478

7579
- name: Cargo check
76-
run: cargo check --workspace
77-
78-
check-benchmarking:
79-
name: Cargo check (benchmarking)
80-
# TODO: replace `parity-default` with `ubuntu-latest` when the repo becomes public.
81-
runs-on: parity-default
82-
needs: [set-image, check]
83-
container:
84-
image: ${{ needs.set-image.outputs.CI_IMAGE }}
85-
steps:
86-
- name: Checkout sources
87-
uses: actions/checkout@v4
88-
89-
- name: Rust cache
90-
uses: Swatinem/rust-cache@v2
91-
with:
92-
cache-on-failure: true
93-
cache-all-crates: true
94-
95-
- name: Cargo check benchmarking
9680
run: |
81+
cargo check --workspace
9782
cargo check --workspace --features=runtime-benchmarks
9883
9984
clippy:
10085
name: Cargo clippy
101-
# TODO: replace `parity-default` with `ubuntu-latest` when the repo becomes public.
10286
runs-on: parity-default
10387
needs: [set-image, check]
10488
container:
@@ -113,8 +97,8 @@ jobs:
11397
- name: Rust cache
11498
uses: Swatinem/rust-cache@v2
11599
with:
116-
cache-on-failure: true
117-
cache-all-crates: true
100+
shared-key: "bulletin-cache-clippy"
101+
save-if: ${{ github.ref == 'refs/heads/main' }}
118102

119103
- name: Cargo clippy
120104
run: |
@@ -123,10 +107,9 @@ jobs:
123107
124108
test:
125109
name: Test
126-
# TODO: replace `parity-default` with `ubuntu-latest` when the repo becomes public.
127-
runs-on: parity-default
110+
runs-on: parity-large
128111
timeout-minutes: 60
129-
needs: [set-image, check]
112+
needs: [set-image, check-fmt]
130113
container:
131114
image: ${{ needs.set-image.outputs.CI_IMAGE }}
132115
env:
@@ -138,8 +121,8 @@ jobs:
138121
- name: Rust cache
139122
uses: Swatinem/rust-cache@v2
140123
with:
141-
cache-on-failure: true
142-
cache-all-crates: true
124+
shared-key: "bulletin-cache-tests"
125+
save-if: ${{ github.ref == 'refs/heads/main' }}
143126

144127
- name: Run pallets tests
145128
run: |
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
name: Integration Tests
2+
3+
# Controls when the action will run.
4+
on:
5+
# Triggers the workflow on push or pull request events but only for the master branch
6+
push:
7+
branches: [main]
8+
pull_request:
9+
branches: [main]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# Cancel previous runs
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
17+
cancel-in-progress: true
18+
19+
env:
20+
NODE_VERSION: 22
21+
POLKADOT_SDK_VERSION: polkadot-stable2512
22+
POLKADOT_SDK_BIN_DIR: ${{ github.workspace }}/.polkadot-sdk-bin
23+
ZOMBIENET_VERSION: v1.3.138
24+
ZOMBIENET_BIN_DIR: ${{ github.workspace }}/.zombienet-bin
25+
26+
jobs:
27+
setup:
28+
name: Setup
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Free Disk Space (Ubuntu)
32+
if: ${{ runner.environment == 'github-hosted' }}
33+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
34+
with:
35+
tool-cache: false
36+
37+
# TODO: remove when released: https://github.com/paritytech/polkadot-sdk/pull/10662
38+
- name: Install Rust toolchain
39+
uses: dtolnay/rust-toolchain@stable
40+
with:
41+
targets: wasm32-unknown-unknown
42+
components: rust-src
43+
- name: Install system dependencies
44+
run: |
45+
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list /etc/apt/sources.list.d/azure-cli.list
46+
sudo apt-get update
47+
sudo apt-get install -y protobuf-compiler libclang-dev
48+
49+
# Cache the Polkadot SDK binaries
50+
- name: Cache Polkadot SDK binaries
51+
uses: actions/cache@v3
52+
id: polkadot-sdk-cache
53+
with:
54+
path: ${{ env.POLKADOT_SDK_BIN_DIR }}
55+
key: polkadot-sdk-${{ env.POLKADOT_SDK_VERSION }}-binaries
56+
# Download and extract binaries if cache missed
57+
- name: Download Polkadot SDK binaries
58+
if: steps.polkadot-sdk-cache.outputs.cache-hit != 'true'
59+
run: |
60+
mkdir -p $POLKADOT_SDK_BIN_DIR
61+
cd $POLKADOT_SDK_BIN_DIR
62+
echo "Downloading Polkadot SDK binaries..."
63+
curl -L -o polkadot https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/polkadot
64+
curl -L -o polkadot-prepare-worker https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/polkadot-prepare-worker
65+
curl -L -o polkadot-execute-worker https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/polkadot-execute-worker
66+
curl -L -o chain-spec-builder https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/chain-spec-builder
67+
# TODO: remove when released: https://github.com/paritytech/polkadot-sdk/pull/10662
68+
# curl -L -o polkadot-omni-node https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/polkadot-omni-node
69+
chmod +x *
70+
# TODO: remove when released: https://github.com/paritytech/polkadot-sdk/pull/10662
71+
git clone https://github.com/paritytech/polkadot-sdk.git
72+
cd polkadot-sdk
73+
git reset --hard b2bcb74b13f1a1e082f701e3e05ce1be44d16790
74+
cargo build -p polkadot-omni-node -r
75+
cd ..
76+
cp polkadot-sdk/target/release/polkadot-omni-node .
77+
rm -R polkadot-sdk
78+
79+
# Cache the Zombienet binaries
80+
- name: Cache Zombienet
81+
uses: actions/cache@v3
82+
id: zombienet-cache
83+
with:
84+
path: ${{ env.ZOMBIENET_BIN_DIR }}
85+
key: zombienet-${{ env.ZOMBIENET_VERSION }}-binaries
86+
# Download and extract binaries if cache missed
87+
- name: Download Zombienet binaries
88+
if: steps.zombienet-cache.outputs.cache-hit != 'true'
89+
run: |
90+
mkdir -p $ZOMBIENET_BIN_DIR
91+
cd $ZOMBIENET_BIN_DIR
92+
curl -L \
93+
-H "Authorization: token ${{ github.token }}" \
94+
-o zombienet-linux-x64 \
95+
"https://github.com/paritytech/zombienet/releases/download/${ZOMBIENET_VERSION}/zombienet-linux-x64"
96+
chmod +x zombienet-linux-x64
97+
98+
integration-tests:
99+
needs: [setup]
100+
name: Integration Tests
101+
runs-on: ubuntu-latest
102+
timeout-minutes: 200
103+
104+
steps:
105+
- name: Checkout sources
106+
uses: actions/checkout@v4
107+
108+
- name: Install Rust toolchain
109+
uses: dtolnay/rust-toolchain@stable
110+
with:
111+
targets: wasm32-unknown-unknown
112+
components: rust-src
113+
114+
- name: Install system dependencies
115+
run: |
116+
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list /etc/apt/sources.list.d/azure-cli.list
117+
sudo apt-get update
118+
sudo apt-get install -y protobuf-compiler libclang-dev
119+
120+
- name: Rust cache (Bulletin)
121+
uses: Swatinem/rust-cache@v2
122+
with:
123+
workspaces: .
124+
shared-key: "bulletin-cache-bulletin-integration-tests"
125+
save-if: ${{ github.ref == 'refs/heads/main' }}
126+
127+
- name: Setup Node.js
128+
uses: actions/setup-node@v4
129+
with:
130+
node-version: ${{ env.NODE_VERSION }}
131+
cache: 'npm'
132+
cache-dependency-path: examples/package.json
133+
134+
- name: Install just
135+
run: cargo install just --locked || true
136+
137+
- name: Cache Polkadot SDK binaries
138+
uses: actions/cache@v3
139+
id: polkadot-sdk-cache
140+
with:
141+
path: ${{ env.POLKADOT_SDK_BIN_DIR }}
142+
key: polkadot-sdk-${{ env.POLKADOT_SDK_VERSION }}-binaries
143+
- name: Cache Zombienet
144+
uses: actions/cache@v3
145+
id: zombienet-cache
146+
with:
147+
path: ${{ env.ZOMBIENET_BIN_DIR }}
148+
key: zombienet-${{ env.ZOMBIENET_VERSION }}-binaries
149+
- name: Add binaries to PATH
150+
run: |
151+
ls -lrt "${POLKADOT_SDK_BIN_DIR}"
152+
ls -lrt "${ZOMBIENET_BIN_DIR}"
153+
echo "${POLKADOT_SDK_BIN_DIR}" >> "$GITHUB_PATH"
154+
echo "SKIP_PARACHAIN_SETUP=1" >> "$GITHUB_ENV"
155+
echo "${ZOMBIENET_BIN_DIR}" >> "$GITHUB_PATH"
156+
echo "ZOMBIENET_BINARY=zombienet-linux-x64" >> "$GITHUB_ENV"
157+
158+
# ========================================================================
159+
# Westend parachain tests
160+
# ========================================================================
161+
- name: Start services (Westend parachain)
162+
working-directory: examples
163+
run: |
164+
TEST_DIR="$(mktemp -d $GITHUB_WORKSPACE/bulletin-tests-run-XXXXX)/test"
165+
echo "TEST_DIR=$TEST_DIR" >> "$GITHUB_ENV"
166+
just start-services "$TEST_DIR" "bulletin-westend-runtime"
167+
168+
- name: Test authorize-and-store ws (Westend parachain)
169+
working-directory: examples
170+
run: just run-test-authorize-and-store "${{ env.TEST_DIR }}" "bulletin-westend-runtime" "ws"
171+
172+
- name: Test authorize-and-store smoldot (Westend parachain)
173+
working-directory: examples
174+
run: just run-test-authorize-and-store "${{ env.TEST_DIR }}" "bulletin-westend-runtime" "smoldot"
175+
176+
- name: Test store-chunked-data (Westend parachain)
177+
working-directory: examples
178+
run: just run-test-store-chunked-data "${{ env.TEST_DIR }}"
179+
180+
- name: Test store-big-data (Westend parachain)
181+
working-directory: examples
182+
run: just run-test-store-big-data "${{ env.TEST_DIR }}"
183+
184+
- name: Stop services (Westend parachain)
185+
if: always()
186+
working-directory: examples
187+
run: just stop-services "${{ env.TEST_DIR }}"
188+
189+
# ========================================================================
190+
# Polkadot solochain tests
191+
# ========================================================================
192+
- name: Start services (Polkadot solochain)
193+
working-directory: examples
194+
run: |
195+
TEST_DIR="$(mktemp -d $GITHUB_WORKSPACE/bulletin-tests-run-XXXXX)/test"
196+
echo "TEST_DIR=$TEST_DIR" >> "$GITHUB_ENV"
197+
just start-services "$TEST_DIR" "bulletin-polkadot-runtime"
198+
199+
- name: Test authorize-and-store ws (Polkadot solochain)
200+
working-directory: examples
201+
run: just run-test-authorize-and-store "${{ env.TEST_DIR }}" "bulletin-polkadot-runtime" "ws"
202+
203+
- name: Test authorize-and-store smoldot (Polkadot solochain)
204+
working-directory: examples
205+
run: just run-test-authorize-and-store "${{ env.TEST_DIR }}" "bulletin-polkadot-runtime" "smoldot"
206+
207+
- name: Test store-chunked-data (Polkadot solochain)
208+
working-directory: examples
209+
run: just run-test-store-chunked-data "${{ env.TEST_DIR }}"
210+
211+
- name: Test store-big-data (Polkadot solochain)
212+
working-directory: examples
213+
run: just run-test-store-big-data "${{ env.TEST_DIR }}"
214+
215+
- name: Stop services (Polkadot solochain)
216+
if: always()
217+
working-directory: examples
218+
run: just stop-services "${{ env.TEST_DIR }}"
219+
220+
# Collects logs from the last failed zombienet run.
221+
- name: Upload Zombienet logs (on failure)
222+
if: failure()
223+
uses: actions/upload-artifact@v4
224+
with:
225+
name: failed-zombienet-logs
226+
path: |
227+
${{ env.TEST_DIR }}/*.log

0 commit comments

Comments
 (0)