Skip to content

Commit

Permalink
feat: [DX-3058] Build examples and test apps against built local SDK (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zaidarain1 authored Aug 2, 2024
1 parent c1071ff commit 777803b
Show file tree
Hide file tree
Showing 14 changed files with 163 additions and 186 deletions.
10 changes: 10 additions & 0 deletions .github/actions/setup-examples/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

name: "Examples setup"
description: "Do necessary setup for examples"

runs:
using: "composite"
steps:
- name: Prepare examples
shell: bash
run: yarn prepare:examples
9 changes: 9 additions & 0 deletions .github/actions/setup-tests/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: "Tests setup"
description: "Do necessary setup for tests"

runs:
using: "composite"
steps:
- name: Prepare tests
shell: bash
run: yarn prepare:tests
53 changes: 0 additions & 53 deletions .github/workflows/build-lint-and-test-examples.yaml

This file was deleted.

112 changes: 78 additions & 34 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ jobs:
echo "Node.js engine version has not changed"
fi
build:
name: Build
build-sdk:
name: Build SDK
runs-on: ubuntu-latest-8-cores
steps:
- name: Checkout code
Expand All @@ -69,11 +69,10 @@ jobs:
- name: Build
run: yarn nx affected --target=build --parallel=5 --exclude=@imtbl/checkout-widgets-sample-app

typecheck:
name: Typecheck
typecheck-sdk:
name: Typecheck SDK
runs-on: ubuntu-latest-4-cores
needs:
- build
needs: build-sdk
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -86,11 +85,10 @@ jobs:
- name: Typecheck
run: yarn typecheck

test:
name: Test
test-sdk:
name: Test SDK
runs-on: ubuntu-latest-8-cores
needs:
- build
needs: build-sdk
env:
NODE_OPTIONS: --max-old-space-size=14366
steps:
Expand All @@ -111,8 +109,8 @@ jobs:
name: coverages
path: ./packages/**/coverage/*

lint:
name: Lint
lint-sdk:
name: Lint SDK
runs-on: ubuntu-latest-4-cores
steps:
- name: Checkout code
Expand All @@ -126,11 +124,68 @@ jobs:
- name: Lint
run: yarn lint

build-examples:
name: Build Examples
needs: build-sdk
runs-on: ubuntu-latest-4-cores
env:
NODE_OPTIONS: --max-old-space-size=14366
steps:
- name: Checkout
uses: actions/checkout@v4

- name: setup
uses: ./.github/actions/setup

- name: Setup examples
uses: ./.github/actions/setup-examples

- name: Build examples
run: yarn build:examples

lint-examples:
name: Lint Examples
needs: build-sdk
runs-on: ubuntu-latest-4-cores
env:
NODE_OPTIONS: --max-old-space-size=14366
steps:
- name: Checkout
uses: actions/checkout@v4

- name: setup
uses: ./.github/actions/setup

- name: Setup examples
uses: ./.github/actions/setup-examples

- name: Lint examples
run: yarn lint:examples

test-examples:
name: Test Examples
needs: build-sdk
runs-on: ubuntu-latest-4-cores
env:
NODE_OPTIONS: --max-old-space-size=14366
steps:
- name: Checkout
uses: actions/checkout@v4

- name: setup
uses: ./.github/actions/setup

- name: Setup examples
uses: ./.github/actions/setup-examples

- name: Test examples
run: yarn test:examples


func-test-imx:
name: imx func tests
runs-on: ubuntu-latest-4-cores
needs:
- build
needs: build-sdk
env:
NETWORK: sepolia
TEST_ALCHEMY_API_KEY: ${{ secrets.TEST_ALCHEMY_API_KEY }}
Expand All @@ -154,14 +209,16 @@ jobs:
- name: setup
uses: ./.github/actions/setup

- name: Setup tests
uses: ./.github/actions/setup-tests

- name: test
run: yarn nx run func-tests-imx:func-test:ci
run: yarn workspace @tests/func-tests-imx func-test:ci

func-test-zkevm:
name: zkevm func tests
runs-on: ubuntu-latest-4-cores
needs:
- build
needs: build-sdk
env:
ZKEVM_ORDERBOOK_BANKER: ${{ secrets.ZKEVM_ORDERBOOK_BANKER }}
ZKEVM_ORDERBOOK_ERC721: "0xBE8B131f39825282Ace9eFf99C0Bb14972417b49"
Expand All @@ -177,25 +234,12 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: setup
uses: ./.github/actions/setup

- name: test
run: yarn nx run func-tests-zkevm:func-test:ci

smoke-test:
name: smoke test
runs-on: ubuntu-latest-4-cores
needs:
- build
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: setup
uses: ./.github/actions/setup

- name: Setup tests
uses: ./.github/actions/setup-tests

- name: test
run: yarn nx run esm-sdk-test:smoke-test
run: yarn workspace @tests/func-tests-zkevm func-test:ci
3 changes: 2 additions & 1 deletion .nxignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
examples
examples
tests
8 changes: 0 additions & 8 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@
}
}
},
"smoke-test": {
"cache": true,
"dependsOn": ["^build"]
},
"func-test:ci": {
"cache": true,
"dependsOn": ["^build"]
},
"build": {
"dependsOn": ["^build"],
"outputs": ["{projectRoot}/dist"],
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
"lint:examples": "yarn workspaces foreach -Apt --include='@examples/**' run lint",
"nx": "nx",
"postinstall": "husky install; ./.husky/install_gitleaks.sh",
"prepare:examples": "yarn build:onlysdk && yarn yalc:sdk:publish && yarn workspaces foreach -Apt --include='@examples/**' exec yarn dlx yalc add @imtbl/sdk && yarn install --no-immutable",
"prepare:tests": "yarn build:onlysdk && yarn yalc:sdk:publish && yarn workspaces foreach -Apt --include='@tests/**' exec yarn dlx yalc add @imtbl/sdk && yarn install --no-immutable",
"release": "release-it",
"scan:secrets": "./.husky/run_gitleaks.sh",
"syncpack:check": "yarn syncpack list-mismatches",
Expand All @@ -65,7 +67,8 @@
"test": "nx affected -t test --parallel=5",
"test:examples": "yarn workspaces foreach -Apt --include='@examples/**' run test",
"test:vpn": "RUN_VPN_TESTS=1 wsrun --exclude-missing -e test",
"typecheck": "nx affected -t typecheck --parallel=5"
"typecheck": "nx affected -t typecheck --parallel=5",
"yalc:sdk:publish": "yarn workspace @imtbl/sdk exec yarn dlx yalc publish"
},
"workspaces": {
"packages": [
Expand Down Expand Up @@ -97,9 +100,7 @@
"packages/game-bridge",
"packages/webhook/sdk",
"packages/minting-backend/sdk",
"tests/smoke/esm",
"tests/func-tests/imx",
"tests/func-tests/zkevm",
"tests/**",
"examples/passport/**"
],
"nohoist": [
Expand Down
2 changes: 1 addition & 1 deletion sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,4 @@
},
"type": "module",
"types": "./dist/index.d.ts"
}
}
2 changes: 1 addition & 1 deletion tests/func-tests/imx/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "func-tests-imx",
"name": "@tests/func-tests-imx",
"dependencies": {
"@ethersproject/providers": "^5.7.2",
"@ethersproject/units": "^5.7.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/func-tests/zkevm/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "func-tests-zkevm",
"name": "@tests/func-tests-zkevm",
"dependencies": {
"@imtbl/contracts": "2.2.6",
"@imtbl/sdk": "0.0.0",
Expand Down
2 changes: 0 additions & 2 deletions tests/smoke/esm/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions tests/smoke/esm/index.mjs

This file was deleted.

12 changes: 0 additions & 12 deletions tests/smoke/esm/package.json

This file was deleted.

Loading

0 comments on commit 777803b

Please sign in to comment.