chore: add ES module support for browser compatibility #203
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| types: [ opened, synchronize, reopened, ready_for_review ] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| if: ${{ !github.event.pull_request.draft }} # only run on non-draft PRs | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| run_install: false | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.22.x' | |
| check-latest: true | |
| - name: Install Taskfile | |
| uses: arduino/setup-task@v2 | |
| - name: Checkout KwilDB at specific commit | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: trufnetwork/kwil-db | |
| ref: 500f214cd4b52f9fa72793782ea702396f58cc6a | |
| path: kwil-db-public | |
| - name: Set up KwilDB Docker in Public mode | |
| run: | | |
| # clear any existing kwil-db-public (may happen at local act) | |
| rm -rf /tmp/kwil-db-public | |
| mv kwil-db-public /tmp/kwil-db-public | |
| cd /tmp/kwil-db-public | |
| task work | |
| task build:docker | |
| cd contrib/docker/compose/kwil | |
| echo "services: | |
| kwild: | |
| entrypoint: [\"/app/kwild\"] | |
| command: | | |
| start | |
| --autogen | |
| --root=/app/.kwild | |
| --admin.listen=/tmp/kwild.socket | |
| --rpc.listen=0.0.0.0:8484 | |
| --p2p.listen=0.0.0.0:6600 | |
| --consensus.propose-timeout=1s | |
| --consensus.empty-block-timeout=1s | |
| --db.host=172.5.200.3 | |
| --db.port=5432 | |
| --db.user=kwild | |
| --db.pass=kwild | |
| --db-owner 0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf | |
| " > ./docker-compose.override.yml | |
| echo "Starting kwil docker" | |
| docker compose up -d --build | |
| cd - | |
| - name: Install and build kwiljs | |
| run: | | |
| pnpm install --frozen-lockfile | |
| pnpm run build | |
| - name: Run unit tests | |
| run: | | |
| pnpm test tests/unitTests --testPathIgnorePatterns="testing-functions/test.js" | |
| - name: Run integration tests | |
| run: | | |
| chain_id=`curl -X POST http://localhost:8484/rpc/v1 -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "id": 1, "method": "user.chain_info", "params": {}}' | jq -r '.result.chain_id'` | |
| echo "Chain ID: $chain_id" | |
| echo "run KWIL-JS TEST against kwild(http:localhost:8484), with $chain_id" | |
| PRIVATE_KEY=0000000000000000000000000000000000000000000000000000000000000001 CHAIN_ID=$chain_id GATEWAY_ON=false GAS_ON=false KWIL_PROVIDER=http://localhost:8484 pnpm run integration | |
| - name: Cleanup Docker | |
| if: always() | |
| run: | | |
| docker compose -f /tmp/kwil-db-public/contrib/docker/compose/kwil/docker-compose.yml down | |
| if [ -n "${{ env.ACT }}" ]; then | |
| # only run in act | |
| docker system prune -af | |
| fi | |
| # - name: Set up KwilDB Docker in Private mode | |
| # run: | | |
| # git clone https://github.com/trufnetwork/kwil-db.git /tmp/kwil-db-private -b v0.10.0-beta-1 | |
| # cd /tmp/kwil-db-private | |
| # go work init && go work use . ./test ./core | |
| # task build:docker | |
| # cd - | |
| # cd .github/workflows | |
| # docker compose up -d | |
| # cd - | |
| # - name: Install and build kwiljs | |
| # run: | | |
| # npm install | |
| # npm run build | |
| # - name: Run integration tests in private mode | |
| # run: | | |
| # chain_id=`curl -X POST http://localhost:8484/rpc/v1 -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "id": 1, "method": "user.chain_info", "params": {}}' | jq -r '.result.chain_id'` | |
| # echo "Chain ID: $chain_id" | |
| # echo "run KWIL-JS TEST in private mode against kwild(http:localhost:8484), with $chain_id" | |
| # PRIVATE_KEY=0000000000000000000000000000000000000000000000000000000000000001 CHAIN_ID=$chain_id GATEWAY_ON=FALSE GAS_ON=FALSE PRIVATE_MODE=TRUE KWIL_PROVIDER=http://localhost:8484 npm run integration | |
| # - name: Cleanup Docker | |
| # if: always() | |
| # run: | | |
| # docker compose -f .github/workflows/docker-compose.yml down | |
| # docker system prune -af |