mirror of
https://github.com/aljazceru/pubky-core.git
synced 2026-01-24 16:34:24 +01:00
chore(tests): add wasm tests to CI (#83)
* ci: add WASM testing workflow to GitHub Actions * ci: enhance WASM testing workflow with testnet startup and cleanup * ci: enhance testnet setup and testing workflow with improved logging and connectivity checks * trying something different * fix: skip testing browser --------- Co-authored-by: Miguel Medeiros <miguel@miguelmedeiros.com.br>
This commit is contained in:
51
.github/workflows/pr-check.yml
vendored
51
.github/workflows/pr-check.yml
vendored
@@ -77,3 +77,54 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
wasm-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
target: wasm32-unknown-unknown
|
||||
override: true
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
- name: Install wasm-pack
|
||||
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||
|
||||
- name: Cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Build WASM
|
||||
working-directory: pubky/pkg
|
||||
run: |
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
- name: Run the testnet
|
||||
working-directory: pubky/pkg
|
||||
run: npm run testnet > testnet.log 2>&1 &
|
||||
|
||||
- name: Wait for testnet homeserver
|
||||
run: |
|
||||
until nc -zv 127.0.0.1 6286; do
|
||||
echo "Waiting for testnet homeserver to be ready..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
- name: Run Tests (only node-js)
|
||||
working-directory: pubky/pkg
|
||||
# runing only `test-nodjs` and not browser because of weird `exit` behavior
|
||||
run: npm run test-nodejs
|
||||
|
||||
- name: Show testnet logs if tests fail
|
||||
working-directory: pubky/pkg
|
||||
if: failure()
|
||||
run: cat testnet.log
|
||||
|
||||
Reference in New Issue
Block a user