Skip to content

Commit 38f8c7f

Browse files
x3c41abkontur
andauthored
Added a github workflow for running examples as integration tests (#140)
* added CI for docker workflow * simplified workflow, reused just commands * doubled timeout * use ubuntu-latest directly for Docker suppor * added docker check * simplify docker verification * trigger workflow on ci_cd branch pushes * add protobuf-compiler dependency * add libclang dependency * add wasm32 target for runtime compilation * add rust-src component for wasm compilation * use host networking for IPFS Docker on Linux/CI * fix Docker networking and add zombienet debugging * fix: use absolute paths for zombienet and bulletin binary * renamed * removed docker verification step - not needed anymore * Update .github/workflows/integration-test.yml Co-authored-by: Branislav Kontur <[email protected]> * Update .github/workflows/integration-test.yml Co-authored-by: Branislav Kontur <[email protected]> * added another test as step * updated on push branches * removed branhces from on pull_request * added ci_cd back, modified network_args (added ports) * removed flag in wget * added docker setup * added missing dependency * commented out first test - debugging second * fixed commit * reverted import, increased node version to 22 * uncommented first test * reverted branches * Update .github/workflows/integration-test.yml Co-authored-by: Branislav Kontur <[email protected]> * removed local set-up * Update examples/justfile * parametrized run-authorize-and-store * removed duplicate * Update examples/justfile Co-authored-by: Branislav Kontur <[email protected]> * Removed older TODO * Extract node version * Actually use CI_IMAGE and align with check.yml --------- Co-authored-by: Branislav Kontur <[email protected]>
1 parent f2bbffe commit 38f8c7f

File tree

4 files changed

+164
-215
lines changed

4 files changed

+164
-215
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 5 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:
@@ -57,7 +57,6 @@ jobs:
5757
5858
check:
5959
name: Cargo check
60-
# TODO: replace `parity-default` with `ubuntu-latest` when the repo becomes public.
6160
runs-on: parity-default
6261
needs: [set-image, check-fmt]
6362
container:
@@ -77,7 +76,6 @@ jobs:
7776

7877
check-benchmarking:
7978
name: Cargo check (benchmarking)
80-
# TODO: replace `parity-default` with `ubuntu-latest` when the repo becomes public.
8179
runs-on: parity-default
8280
needs: [set-image, check]
8381
container:
@@ -98,7 +96,6 @@ jobs:
9896
9997
clippy:
10098
name: Cargo clippy
101-
# TODO: replace `parity-default` with `ubuntu-latest` when the repo becomes public.
10299
runs-on: parity-default
103100
needs: [set-image, check]
104101
container:
@@ -123,7 +120,6 @@ jobs:
123120
124121
test:
125122
name: Test
126-
# TODO: replace `parity-default` with `ubuntu-latest` when the repo becomes public.
127123
runs-on: parity-default
128124
timeout-minutes: 60
129125
needs: [set-image, check]
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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+
# Parity CI image to use
20+
# Common variable is defined in the workflow
21+
# Repo env variable doesn't work for PRs from forks
22+
env:
23+
CI_IMAGE: "paritytech/ci-unified:bullseye-1.88.0-2025-06-27-v202507112050"
24+
NODE_VERSION: 22
25+
26+
jobs:
27+
set-image:
28+
# This workaround sets the container image for each job using 'set-image' job output.
29+
# env variables don't work for PRs from forks, so we need to use outputs.
30+
runs-on: ubuntu-latest
31+
outputs:
32+
CI_IMAGE: ${{ steps.set_image.outputs.CI_IMAGE }}
33+
steps:
34+
- id: set_image
35+
run: echo "CI_IMAGE=${{ env.CI_IMAGE }}" >> $GITHUB_OUTPUT
36+
37+
integration-tests:
38+
name: Integration Tests
39+
runs-on: parity-default
40+
timeout-minutes: 60
41+
needs: [ set-image ]
42+
container:
43+
image: ${{ needs.set-image.outputs.CI_IMAGE }}
44+
45+
steps:
46+
- name: Checkout sources
47+
uses: actions/checkout@v4
48+
49+
- name: Install Rust toolchain
50+
uses: dtolnay/rust-toolchain@stable
51+
with:
52+
targets: wasm32-unknown-unknown
53+
components: rust-src
54+
55+
- name: Install system dependencies
56+
run: |
57+
sudo apt-get update
58+
sudo apt-get install -y protobuf-compiler libclang-dev
59+
60+
- name: Rust cache
61+
uses: Swatinem/rust-cache@v2
62+
with:
63+
cache-on-failure: true
64+
cache-all-crates: true
65+
66+
- name: Setup Node.js
67+
uses: actions/setup-node@v4
68+
with:
69+
node-version: ${{ env.NODE_VERSION }}
70+
cache: 'npm'
71+
cache-dependency-path: examples/package.json
72+
73+
- name: Install just
74+
run: cargo install just --locked || true
75+
76+
- name: Download zombienet
77+
run: |
78+
curl -L \
79+
-H "Authorization: token ${{ github.token }}" \
80+
-o zombienet-linux-x64 \
81+
"https://github.com/paritytech/zombienet/releases/download/v1.3.138/zombienet-linux-x64"
82+
chmod +x zombienet-linux-x64
83+
echo "ZOMBIENET_BINARY=$GITHUB_WORKSPACE/zombienet-linux-x64" >> $GITHUB_ENV
84+
85+
- name: Run authorize and store (PAPI, smoldot)
86+
working-directory: examples
87+
run: just run-authorize-and-store "smoldot"
88+
89+
- name: Run authorize and store (PAPI, RPC node)
90+
working-directory: examples
91+
run: just run-authorize-and-store "ws"

0 commit comments

Comments
 (0)