Skip to content

Commit 34771ae

Browse files
committed
chore: 🤖 Add integration test GitHub action
1 parent a92c83f commit 34771ae

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Run Tests
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
test:
7+
name: Testing
8+
runs-on: ubuntu-latest
9+
timeout-minutes: 20
10+
env:
11+
CI: true
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: '22.x'
17+
cache: 'yarn'
18+
cache-dependency-path: 'tests/yarn.lock'
19+
- name: install dependencies
20+
run: yarn --frozen-lockfile
21+
working-directory: tests
22+
- name: test
23+
run: yarn test
24+
working-directory: tests

scripts/integration-test.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
DEV_ENV_DIR="/tmp/polymesh-dev-env"
4+
INTEGRATION_DIR="$DEV_ENV_DIR/tests"
5+
6+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
7+
SDK_DIR="$SCRIPT_DIR/.."
8+
COMPOSE_ENV="../envs/latest"
9+
10+
echo "cloning the repository"
11+
git clone https://github.com/PolymeshAssociation/polymesh-dev-env.git "$DEV_ENV_DIR"
12+
13+
# register a cleanup function to keep the env clean
14+
function cleanup() {
15+
echo "cleaning up test environment"
16+
17+
cd "$INTEGRATION_DIR"
18+
yarn test:stop
19+
20+
cd "$INTEGRATION_DIR"
21+
yarn unlink "@polymeshassociation/polymesh-sdk"
22+
23+
cd "$SDK_DIR"
24+
rm -rf "$DEV_ENV_DIR"
25+
}
26+
trap cleanup EXIT
27+
28+
cd "$SDK_DIR"
29+
30+
# Install SDK packages and link it
31+
yarn
32+
yarn build:ts
33+
34+
# Link the built version
35+
cd dist
36+
yarn link
37+
38+
cd "$INTEGRATION_DIR"
39+
40+
# Link the built SDK version
41+
echo "Linking built SDK version"
42+
yarn link "@polymeshassociation/polymesh-sdk"
43+
44+
# Install integration test packages
45+
echo "Installing dependencies"
46+
yarn install --force
47+
48+
# Run the tests
49+
yarn test

0 commit comments

Comments
 (0)