Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/long running epoch testing #627

Open
wants to merge 97 commits into
base: feature/lit-2921-js-sdk-migrate-to-jest
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
d53f855
test: add initial epoch transition test
Aug 29, 2024
ee8f71c
Merge branch 'master' of github.com:LIT-Protocol/js-sdk into feature/…
Aug 29, 2024
69d9c55
test: increase timeout for test
Aug 29, 2024
0b9697f
test: up time for timeout
Aug 29, 2024
0b7721d
test: lower epoch transition time
Aug 29, 2024
76c143c
test: remove await
Aug 29, 2024
ed091cf
test: add long running test harness back for epoch testing wip
Aug 30, 2024
bc746a8
ci: change epoch testing runner for ci
Aug 30, 2024
bbc15da
test: ref test name for jest isolation
Sep 3, 2024
2cce825
ref: test assert
Sep 3, 2024
4c5bbee
test: lower epoch transition and adjust test case.
Sep 3, 2024
3e5d8f6
test: remove unused import
Sep 3, 2024
d8e5491
test: add further basic epoch transition assertions.
Sep 3, 2024
4a97bca
test: add logging on active set change for test run
Sep 4, 2024
3860448
test: wait longer to observe epoch change from chain event.
Sep 4, 2024
63e3d16
test: change url processing on epoch change event
Sep 4, 2024
7df8c4c
test: add more logging and change vaildator delta check
Sep 4, 2024
1fdd91e
test: fix assertions in epoch transition test case
Sep 4, 2024
34c5a59
ref: testing tweaks to staking event
Sep 4, 2024
33a0cb2
ref: lower polling interval for test
Sep 4, 2024
2be86b7
ref: delay epoch check for prop delay
Sep 4, 2024
b9e086e
ref: remove loging
Sep 4, 2024
d04aa19
test: add epoch session signing
Sep 4, 2024
659cb2b
test: add log to verifier
Sep 4, 2024
2fea789
test: add signing during epoch
Sep 4, 2024
1f47d6d
ref: fix epoch compare
Sep 4, 2024
d8a259e
dev: add handshake test during epoch transition
Sep 6, 2024
a8a00dc
chore: fmt
Sep 6, 2024
481677b
ref: remove build dir
Sep 6, 2024
4534d12
ci: add stop flag to testnet
Sep 6, 2024
5f24446
dev: change connection test during epoch
Sep 9, 2024
2db5012
ref: test global hooks in jest
Sep 9, 2024
72515f9
chore: fmt
Sep 9, 2024
311692f
test: refactor tests to use global setup/teardown
Sep 10, 2024
f38987b
ci: change test commands
Sep 10, 2024
9e5f5e7
test: add ignore flag to ci run
Sep 10, 2024
b8b8aee
ref: remove module import for require
Sep 10, 2024
5c94b06
ref: tweaks from ci failure
Sep 10, 2024
c1c34a7
ref: remove loging of staking contract object changed to address
Sep 11, 2024
e7961fc
ref: change process exit to error throw
Sep 11, 2024
2b813fb
ref: changes to jest setup for intigration tests
Sep 11, 2024
2f3ab78
test: reorg spec files for ci runs
Sep 11, 2024
9aa5478
ref: remove custom test harness and test files
Sep 11, 2024
6a0a7a0
Merge branch 'feature/lit-2921-js-sdk-migrate-to-jest' of github.com:…
Sep 11, 2024
a178fb0
ref: add ts expect error to ci config
Sep 11, 2024
9640cdd
ref: fix run cmd
Sep 11, 2024
9e4b2cd
ref: rename ci config
Sep 11, 2024
8364dae
ref: move ci config to folder
Sep 11, 2024
fc82f84
ref: add ts ignore for type resolve error
Sep 11, 2024
c58e472
ref: fix jest config for ci
Sep 11, 2024
9803e36
ref: fix pathing in ci jest config
Sep 11, 2024
e2dc2b5
ref: add test matcher to ci config
Sep 11, 2024
d8ba4c3
ref: fix config type
Sep 11, 2024
1a737df
ref: add test case root directory
Sep 12, 2024
9e420ad
ref: scope folders for root ci config
Sep 12, 2024
74c0598
ref: move tests to core folder
Sep 12, 2024
1b918de
ref: modify test case for runtime exception test
Sep 12, 2024
f8c0074
ci: move to workflow dispatch
Sep 12, 2024
106e4d4
ci: add workflow calls
Sep 12, 2024
3a808a6
ci: add condition for test runs on linter
Sep 12, 2024
5cadf6f
ci: add condition to master trigger workflow for testing jobs
Sep 12, 2024
876da8d
chore: fmt
Sep 12, 2024
26a7fe8
ci: modify master trigger for required job relationships
Sep 12, 2024
2c5426c
ref: fix syntax
Sep 12, 2024
73be2c7
ci: add status check to linter as test
Sep 12, 2024
4286837
ci: add dep on unit tests for intigration test runs
Sep 12, 2024
23c7126
ci: change master job name
Sep 12, 2024
84f736d
ci: require change detection before linter run
Sep 12, 2024
a2ee887
ci: abstract shiva standup to reuseable workflow
Sep 13, 2024
30fd2bc
ci: move checkout to testing workflow
Sep 13, 2024
4125029
ci: rework test workflows
Sep 13, 2024
f366656
ci: changes to workflows
Sep 16, 2024
752aca5
ref: fix master trigger
Sep 16, 2024
b2d6cb7
ci: change var export and update runner for unit test
Sep 16, 2024
cf8ee36
ci: add sha check back to unit test run
Sep 16, 2024
7eadbda
ci: change output for commit hash
Sep 16, 2024
d22e2b6
ci: change var export
Sep 16, 2024
04bb7bd
ref: fix unit test workflow command
Sep 16, 2024
8b3e5b7
ref: add repo env for commit hash
Sep 16, 2024
7628173
ref: use vars for repo env settings
Sep 16, 2024
13996ab
ref: fix commit hash
Sep 16, 2024
df93e46
ci: run epoch tests on core changes
Sep 16, 2024
f5dd863
test: update test commands for e2e
Sep 16, 2024
7488170
chore: fmt
Sep 16, 2024
854bdf2
ci: add more conditions to intigration tests
Sep 16, 2024
ecbc2ae
ci: change command for epoch tests
Sep 16, 2024
8c83405
ref: change epoch testing command
Sep 16, 2024
fb6ba91
ref: add hook timeouts
Sep 16, 2024
257d5a9
test: tweak test cases and settings
Sep 17, 2024
622d323
chore: fmt
Sep 17, 2024
ba67f78
dev: expose options for tinny env
Sep 17, 2024
5332c76
ci: change master to root
Sep 17, 2024
6b5645b
test: increase timer for epoch waiting to test node state syncing.
Sep 17, 2024
7405ba5
test: query validator info in epoch transition connection test
Sep 18, 2024
86b806e
Merge branch 'feature/lit-2921-js-sdk-migrate-to-jest' of github.com:…
Sep 24, 2024
b9dfe68
chore: lint
Sep 24, 2024
dfbc148
Merge branch 'feature/lit-2921-js-sdk-migrate-to-jest' of github.com:…
Oct 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/get-sha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Set SHAs
on:
workflow_call: {}

jobs:
get-sha:
runs-on: ubuntu-latest
steps:
- name: Check SHA
uses: nrwl/nx-set-shas@v3
id: sha
with:
main-branch-name: 'master'

check_status:
needs: [get-sha]
runs-on: ubuntu-latest
steps:
- name: output SHAs
run: |
if [${{needs.get-sha.result}} == 'success']; then
echo "get sha failed"
exit 1
fi
echo "All steps passed"
Original file line number Diff line number Diff line change
@@ -1,44 +1,20 @@
name: Testing
name: Intigration Testing Datil Long Running
on:
push:
branches:
- master
pull_request:
branches:
- master
- staging/**
- feat/**
- feature/**
workflow_call:
outputs:
intigration-tests:
description: 'unit test results'
value: ${{jobs.integration-tests.result}}
inputs:
commit:
required: true
type: string
workflow_dispatch: {}

jobs:
unit-tests:
runs-on: warp-ubuntu-latest-x64-16x
timeout-minutes: 30
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: nrwl/nx-set-shas@v3
with:
main-branch-name: 'master'
- uses: actions/checkout@v3
- name: Use Node.js
uses: buildjet/setup-node@v3
with:
node-version: 20
cache: yarn
cache-dependency-path: ${{ github.workspace }}/yarn.lock
- name: Install Dependencies
run: yarn
- name: Build
run: yarn build:dev
- name: Run Unit tests
run: yarn test:ci
integration-tests:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
DATIL_COMMIT_HASH: ae3c20e07eb933b61073689b95f56867c03de252
timeout-minutes: 40
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand All @@ -50,7 +26,7 @@ jobs:
with:
fetch-depth: 0
repository: LIT-Protocol/lit-assets
ref: ${{env.DATIL_COMMIT_HASH}}
ref: ${{inputs.commit}}
token: ${{secrets.GH_PAT}}
path: ${{ github.workspace }}/lit-assets/
submodules: false
Expand All @@ -76,7 +52,7 @@ jobs:
run: docker pull ghcr.io/lit-protocol/shiva:latest
- name: Run Shiva Container
id: shiva-runner
run: docker run -d -m 32g -p 8000:8000 -p 8545:8545 -p 7470:7470 -p 7471:7471 -p 7472:7472 -p 7473:7473 -p 7474:7474 -p 7475:7475 -v ${{github.workspace}}/lit-assets:/data -e GH_PAT=${{secrets.GH_PAT}} -e HASH=$DATIL_COMMIT_HASH -e IPFS_API_KEY=${{secrets.IPFS_API_KEY}} --name shiva ghcr.io/lit-protocol/shiva:latest
run: docker run -d -m 32g -p 8000:8000 -p 8545:8545 -p 7470:7470 -p 7471:7471 -p 7472:7472 -p 7473:7473 -p 7474:7474 -p 7475:7475 -v ${{github.workspace}}/lit-assets:/data -e GH_PAT=${{secrets.GH_PAT}} -e HASH=${{inputs.commit}} -e IPFS_API_KEY=${{secrets.IPFS_API_KEY}} --name shiva ghcr.io/lit-protocol/shiva:latest
- name: Install project dependencies
run: yarn
- uses: nrwl/nx-set-shas@v3
Expand All @@ -87,23 +63,17 @@ jobs:
run: yarn build:dev
- name: Copy ENV File
run: cp .env.ci .env
- name: End to End Tests - Connection
id: connection
- name: End to End Tests
id: e2e-tests
if: steps.build.outputs.exit_code == 0
run: yarn test:e2e -t 'Connections'
- name: End Tests Session Compaitiblity
id: session
if: steps.connection.outputs.exit_code == 0
run: yarn test:e2e -t 'SessionSigs'
- name: End to End Tests - PKP Ethers
if: steps.session.outputs.exit_code == 0
id: pkp
run: yarn test:e2e -t 'PKP Ethers'
run: yarn test:e2e:ci:epoch
- name: Get Container Logs
if: always()
run: docker logs shiva
- name: Post Pull Shiva Container
id: container-stop
if: steps.shiva-pull.outputs.exit_code == 0
run: docker stop shiva && docker rm shiva

- name: Post Pull Shiva Image
if: steps.shiva-pull.outputs.exit_code == 0
run: docker rmi ghcr.io/lit-protocol/shiva
79 changes: 79 additions & 0 deletions .github/workflows/intigration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Intigration Testing Datil
on:
workflow_call:
outputs:
intigration-tests:
description: 'unit test results'
value: ${{jobs.integration-tests.result}}
inputs:
commit:
required: true
type: string
workflow_dispatch: {}

jobs:
integration-tests:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Checkout Lit Actions
uses: actions/checkout@v4
id: checkout
with:
fetch-depth: 0
repository: LIT-Protocol/lit-assets
ref: ${{inputs.commit}}
token: ${{secrets.GH_PAT}}
path: ${{ github.workspace }}/lit-assets/
submodules: false
sparse-checkout: |
blockchain
rust/lit-node
- name: Check LA dir
run: ls -la ${{github.workspace}}/lit-assets
- name: Setup Lit Bockchain Dependencies
uses: buildjet/setup-node@v3
with:
node-version: 20
cache: npm
cache-dependency-path: ${{ github.workspace }}/lit-assets/blockchain/contracts/package-lock.json
- name: Install Blockchain Deps
run: npm i
working-directory: ${{github.workspace}}/lit-assets/blockchain/contracts
- name: Docker login
id: login
run: docker login ghcr.io/ -u ${{secrets.GH_USER}} --password ${{secrets.GH_PAT}}
- name: Pull Shiva Container
id: shiva-pull
run: docker pull ghcr.io/lit-protocol/shiva:latest
- name: Run Shiva Container
id: shiva-runner
run: docker run -d -m 32g -p 8000:8000 -p 8545:8545 -p 7470:7470 -p 7471:7471 -p 7472:7472 -p 7473:7473 -p 7474:7474 -p 7475:7475 -v ${{github.workspace}}/lit-assets:/data -e GH_PAT=${{secrets.GH_PAT}} -e HASH=${{inputs.commit}} -e IPFS_API_KEY=${{secrets.IPFS_API_KEY}} --name shiva ghcr.io/lit-protocol/shiva:latest
- name: Install project dependencies
run: yarn
- uses: nrwl/nx-set-shas@v3
with:
main-branch-name: 'master'
- name: Build packages
id: build
run: yarn build:dev
- name: Copy ENV File
run: cp .env.ci .env
- name: End to End Tests
id: e2e-tests
if: steps.build.outputs.exit_code == 0
run: yarn test:e2e:ci
- name: Get Container Logs
if: always()
run: docker logs shiva
- name: Post Pull Shiva Container
id: container-stop
if: steps.shiva-pull.outputs.exit_code == 0
run: docker stop shiva && docker rm shiva
- name: Post Pull Shiva Image
if: steps.shiva-pull.outputs.exit_code == 0
run: docker rmi ghcr.io/lit-protocol/shiva
26 changes: 22 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: lint
on:
pull_request:
push:
branches:
- master
workflow_call:
outputs:
lint_result:
description: 'lint result'
value: ${{jobs.linter.result}}

workflow_dispatch: {}
jobs:
linter:
runs-on: ubuntu-latest
Expand All @@ -22,3 +25,18 @@ jobs:
run: yarn install
- name: Lint
run: yarn nx format:check --all
check_status:
needs:
[
linter,
]
runs-on: ubuntu-latest
steps:
- name: Check Status
working-directory: ${{ github.workspace }}
run: |
if [ ${{ needs.linter.result }} != 'success' ]; then
echo "Linting failed"
exit 1
fi
echo "All tests passed"
64 changes: 64 additions & 0 deletions .github/workflows/list-changed-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# This workflow is triggered by a PR being created or pushed to. It checks out the develop branch and gets the sha of the develop branch. It then checks for changes in the files and triggers the appropriate workflows based on the changes. It also checks the status of all the triggered workflows and fails the build if any of the workflows fail. It runs the test against a new temporary branch which is created by merging the PR into develop. This means that someone pushing to develop can break your PR even if you haven't changed anything! This is a tradeoff to ensure that the tests are run against the latest code on develop. If you want to run the tests against the code in your PR, you can run the tests locally.
name: master-trigger
on:
workflow_call:
outputs:
lit_core_changed:
description: 'lit_core_changed'
value: ${{ jobs.list_changed_files.outputs.lit_core_changed }}

workflow_dispatch: {}


jobs:
get_base_commit_hash:
runs-on: ubuntu-latest
outputs:
base_sha: ${{ steps.base_sha.outputs.base_sha }}
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v7

- name: Make sure we checked out develop, so we can get it's sha
uses: actions/checkout@v4
with:
ref: ${{ steps.branch-name.outputs.base_ref_branch }}

- name: Get sha of base branch
id: base_sha
run: |
export BASE_SHA=$(git rev-parse HEAD)
echo "Base sha is $BASE_SHA"
echo "base_sha=$BASE_SHA" >> $GITHUB_OUTPUT

list_changed_files:
runs-on: ubuntu-latest
needs: [get_base_commit_hash]
outputs:
lit_core_changed: ${{ steps.changed-files-yaml.outputs.lit_core_any_modified }}

steps:
- name: Checkout js-sdk
uses: actions/checkout@v4

- name: Print base sha
run: |
echo "Base sha is ${{ needs.get_base_commit_hash.outputs.base_sha }}"

- name: Get changed files
id: changed-files-yaml
uses: tj-actions/changed-files@v41
with:
base_sha: ${{ needs.get_base_commit_hash.outputs.base_sha }}
files_yaml: |
lit_core:
- packages/core/**
any:
- ./**

- name: List all changed files
run: |
for file in ${{ steps.changed-files-yaml.outputs.any_all_modified_files }}; do
echo "$file was changed"
done
50 changes: 50 additions & 0 deletions .github/workflows/master-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: root-trigger
on:
pull_request:
workflow_dispatch: {}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
list_changed_files_and_trigger_workflows:
uses: ./.github/workflows/list-changed-files.yml
secrets: inherit
get_shas:
uses: ./.github/workflows/get-sha.yml
secrets: inherit
lint:
needs: [list_changed_files_and_trigger_workflows]
uses: ./.github/workflows/lint.yml
secrets: inherit
unit_tests:
uses: ./.github/workflows/unit-test.yml
secrets: inherit
needs: [lint, get_shas]
intigration_tests:
uses: ./.github/workflows/intigration-test.yml
secrets: inherit
if: ${{needs.list_changed_files_and_trigger_workflows.outputs.lit_core_changed == 'true'}}
needs: [lint, get_shas, list_changed_files_and_trigger_workflows, unit_tests]
with:
commit: ${{vars.DATIL_COMMIT_HASH}}
intigration_tests_longrun_epoch:
uses: ./.github/workflows/intigration-test-long-running.yml
secrets: inherit
needs: [lint, get_shas, list_changed_files_and_trigger_workflows, unit_tests]
with:
commit: ${{vars.DATIL_COMMIT_HASH}}
all_jobs:
if: ${{ always() }}
needs: [
lint,
unit_tests,
intigration_tests
]
runs-on: ubuntu-latest
steps:
- name: Check status
run: |
echo "Linter ${{needs.lint.result}}"
echo "Tests Unit ${{needs.unit_tests.result}}"
echo "Tests Intigration"
Loading
Loading