Skip to content

Commit c69a824

Browse files
authored
Merge pull request #78 from pubky/v3
V3
2 parents cf55897 + fe8bdd7 commit c69a824

Some content is hidden

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

62 files changed

+6995
-3386
lines changed

.github/workflows/rust.yaml

+43-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
pull_request:
77
branches: [ main ]
88

9+
permissions:
10+
contents: write
11+
912
jobs:
1013
build-and-test:
1114
runs-on: ubuntu-latest
@@ -21,6 +24,43 @@ jobs:
2124
components: rustfmt, clippy
2225
override: true
2326

27+
- name: Cache cargo registry
28+
uses: actions/cache@v2
29+
with:
30+
path: ~/.cargo/registry
31+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
32+
restore-keys: |
33+
${{ runner.os }}-cargo-registry-
34+
35+
- name: Cache cargo index
36+
uses: actions/cache@v2
37+
with:
38+
path: ~/.cargo/git
39+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
40+
restore-keys: |
41+
${{ runner.os }}-cargo-index-
42+
43+
- name: Cache cargo build
44+
id: cargo-build-cache
45+
uses: actions/cache@v2
46+
with:
47+
path: target
48+
key: ${{ runner.os }}-cargo-build-${{ hashFiles('./Cargo.lock') }}
49+
restore-keys: |
50+
${{ runner.os }}-cargo-build-
51+
52+
- name: Cache Nextest installation
53+
uses: actions/cache@v2
54+
with:
55+
path: ~/.cargo/bin/cargo-nextest
56+
key: ${{ runner.os }}-cargo-nextest
57+
58+
- name: Install Nextest if not cached
59+
run: |
60+
if [ ! -f ~/.cargo/bin/cargo-nextest ]; then
61+
cargo install cargo-nextest
62+
fi
63+
2464
- name: Check no default features
2565
run: cargo check --no-default-features
2666

@@ -31,10 +71,11 @@ jobs:
3171
run: cargo clippy --workspace --all-features --bins --tests
3272

3373
- name: Build
74+
if: steps.cargo-build-cache.outputs.cache-hit != 'true'
3475
run: cargo build --release --workspace --all-features --verbose
3576

36-
- name: Run tests
37-
run: cargo test --all-features --workspace --verbose
77+
- name: Run tests with Nextest
78+
run: cargo nextest run --all-features --workspace --verbose
3879

3980
- name: Run docs
4081
run: cargo doc --workspace --all-features --no-deps --document-private-items --verbose

.github/workflows/wasm.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: WASM Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install Rust
17+
uses: dtolnay/rust-toolchain@stable
18+
with:
19+
targets: wasm32-unknown-unknown
20+
21+
- name: Install wasm-pack
22+
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
23+
24+
- name: Build server
25+
run: cargo build
26+
27+
- name: Start server and run tests
28+
run: |
29+
# Start the server binary in the background
30+
./target/debug/pkarr-relay --testnet &
31+
SERVER_PID=$!
32+
33+
# Change the working directory to pkarr crate
34+
cd ./pkarr
35+
36+
# Run wasm-pack tests
37+
wasm-pack test --headless --firefox --lib
38+
39+
# Kill the server
40+
kill $SERVER_PID
41+

0 commit comments

Comments
 (0)