11# This workflow groups up the unit tests, the standard node build, and the tests that use the standard node build (integration tests, version upgrade tests)
22name : rust-lit-node-group-unit-and-integration-tests
33on :
4- workflow_dispatch :
5- inputs :
6- enable_version_upgrade_tests :
7- description : ' Enable version upgrade tests?'
8- type : boolean
9- default : false
4+ workflow_dispatch : {}
105 workflow_call :
116 push :
127 paths :
138 - rust/lit-node/lit-node/**
149 - .github/workflows/rust-lit-node-integration-tests.yml
1510 - .github/workflows/rust-lit-node-build.yml
1611 - .github/workflows/rust-lit-node-unit-tests.yml
12+ - .github/workflows/rust-lit-node-version-upgrade-tests.yml
1713 - .github/workflows/rust-lit-node-group-unit-and-integration-tests.yml
1814 - scripts/github/**
1915 branches :
@@ -54,14 +50,13 @@ jobs:
5450 lit_node_unit_tests :
5551 needs : build-if-needed
5652 runs-on : warp-ubuntu-latest-x64-8x # change to LargeRunner to run on github. Change to self-hosted to run on our own runner. Change to buildjet-8vcpu-ubuntu-2204 to run on buildjet with 8 cpus
57- timeout-minutes : 30
53+ timeout-minutes : 40
5854
5955 services :
6056 anvil :
6157 image : litptcl/anvil-lit:latest
6258 ports :
6359 - 8545:8545
64- - 8549:8549
6560 credentials :
6661 username : ${{ vars.DOCKERHUB_USERNAME }}
6762 password : ${{ secrets.DOCKERHUB_TOKEN }}
@@ -105,14 +100,13 @@ jobs:
105100 timeout-minutes : 45
106101 strategy :
107102 matrix :
108- partition : [1, 2, 3, 4 ]
103+ partition : [1, 2, 3]
109104
110105 services :
111106 anvil :
112107 image : litptcl/anvil-lit:latest
113108 ports :
114109 - 8545:8545
115- - 8549:8549
116110 credentials :
117111 username : ${{ vars.DOCKERHUB_USERNAME }}
118112 password : ${{ secrets.DOCKERHUB_TOKEN }}
@@ -152,22 +146,34 @@ jobs:
152146 run : zstd -d -c nextest-archive.tar.zst | tar xf -
153147 - name : Setup local files for testing
154148 run : make setup-local-files
149+ - name : Copy lit-node binary to Shiva target directory
150+ run : |
151+ mkdir -p ${{github.workspace}}/rust/lit-node/shiva/target/debug
152+ cp ${{github.workspace}}/rust/lit-node/lit-node/target/debug/lit_node ${{github.workspace}}/rust/lit-node/shiva/target/debug/lit_node
153+ - name : Run Shiva Integration tests
154+ run : |
155+ mv ${{github.workspace}}/rust/lit-node/lit-node/rpc-config.example.yaml ./rpc-config.yaml
156+ cargo nextest run --final-status-level pass --no-capture --
157+ working-directory : ${{github.workspace}}/rust/lit-node/shiva
155158 - name : Run acceptance, component and integration tests.
156- run : " ~/.cargo/bin/cargo-nextest nextest run --archive-file nextest-archive.tar.zst --final-status-level pass --profile integration-tests -E 'test(/^acceptance|^component|^integration|^sdk/) - test(/long/)' --partition count:${{ matrix.partition }}/4 --nocapture --"
157-
158-
159- # after the standard build is done, run the other integration tests
160- lit_node_other_tests :
159+ run : " ~/.cargo/bin/cargo-nextest nextest run --archive-file nextest-archive.tar.zst --final-status-level pass --profile integration-tests -E 'test(/^acceptance|^component|^integration|^sdk/) - test(/long/)' --partition count:${{ matrix.partition }}/3 --nocapture --"
160+ # after the standard build is done, run the upgrade tests
161+ lit_node_version_upgrade_tests :
161162 needs : build-if-needed
162- runs-on : warp-ubuntu-latest-x64-8x # change to LargeRunner to run on github. Change to self-hosted to run on our own runner. Change to buildjet-8vcpu-ubuntu-2204 to run on buildjet with 8 cpus
163- timeout-minutes : 45
163+ runs-on : warp-ubuntu-latest-x64-16x # change to LargeRunner to run on github. Change to self-hosted to run on our own runner. Change to buildjet-8vcpu-ubuntu-2204 to run on buildjet with 8 cpus
164+ # TODO: enable this when you want to turn on version upgrade tests. there's also another spot below where you have to remove a hardcoded "false" with a comment like this.
165+ # To enable, change the condition below to: if: ${{ true }} or remove the if line entirely
166+ if : ${{ github.event_name == 'never' }}
167+ timeout-minutes : 60
168+ strategy :
169+ matrix :
170+ partition : [1, 2, 3]
164171
165172 services :
166173 anvil :
167174 image : litptcl/anvil-lit:latest
168175 ports :
169176 - 8545:8545
170- - 8549:8549
171177 credentials :
172178 username : ${{ vars.DOCKERHUB_USERNAME }}
173179 password : ${{ secrets.DOCKERHUB_TOKEN }}
@@ -179,10 +185,8 @@ jobs:
179185 - name : Checkout lit-assets
180186 uses : actions/checkout@v6
181187 with :
188+ fetch-depth : 0
182189 submodules : recursive
183- - uses : de-vri-es/setup-git-credentials@v2
184- with :
185- credentials : https://glitch003:${{secrets.READ_ONLY_PAT}}@github.com/
186190 - name : Use Node.js
187191 uses : WarpBuilds/setup-node@v4
188192 with :
@@ -195,7 +199,11 @@ jobs:
195199 - name : Run npx hardhat compile for blockchain/contracts
196200 working-directory : ${{ github.workspace }}/blockchain/contracts
197201 run : npx hardhat compile
198- - run : mkdir -p ~/.cargo/bin
202+ - name : Install rust because the version upgrade tests do a recompile
203+ uses : dtolnay/rust-toolchain@master
204+ with :
205+ toolchain : ' 1.91' # keep in sync with rust/lit-node/rust-toolchain.toml
206+ components : rust-src
199207 - name : Install nextest
200208 run : curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C "${CARGO_HOME:-$HOME/.cargo}/bin"
201209 - name : Download archive
@@ -205,28 +213,68 @@ jobs:
205213 key : nextest-archive-${{ github.sha }}-lit-actions|testing
206214 - name : Unzip archive so that we can get the lit_node binary
207215 run : zstd -d -c nextest-archive.tar.zst | tar xf -
208- - name : Setup local files for testing
209- run : make setup-local-files
210- - name : Copy lit-node binary to Shiva target directory
216+ # Get the workflow run that has the latest build for target branches.
217+ - name : Get the latest workflow run ID
218+ id : get_latest_workflow_run_id
211219 run : |
212- mkdir -p ${{github.workspace}}/rust/lit-node/shiva/target/debug
213- cp ${{github.workspace}}/rust/lit-node/lit-node/target/debug/lit_node ${{github.workspace}}/rust/lit-node/shiva/target/debug/lit_node
214- - name : Run Shiva Integration tests
220+ echo "LATEST_WORKFLOW_RUN_ID_HABANERO=$(cd scripts/ci_utils && cargo run --bin get_latest_workflow_run rust/lit-node-build-commit-hash 'origin/release-habanero-*')" >> "$GITHUB_OUTPUT"
221+ echo "LATEST_WORKFLOW_RUN_ID_MANZANO=$(cd scripts/ci_utils && cargo run --bin get_latest_workflow_run rust/lit-node-build-commit-hash 'origin/release-manzano-*')" >> "$GITHUB_OUTPUT"
222+ echo "LATEST_WORKFLOW_RUN_ID_CAYENNE=$(cd scripts/ci_utils && cargo run --bin get_latest_workflow_run rust/lit-node-build-commit-hash 'origin/release-cayenne-*')" >> "$GITHUB_OUTPUT"
223+ env :
224+ GH_PAT : ${{ secrets.GITHUB_TOKEN }}
225+ RUST_LOG : debug
226+ - name : Get the latest commit SHA
227+ id : get_latest_commit_sha
215228 run : |
216- mv ${{github.workspace}}/rust/lit-node/lit-node/rpc-config.example.yaml ./rpc-config.yaml
217- cargo nextest run --final-status-level pass --no-capture --
218- working-directory : ${{github.workspace}}/rust/lit-node/shiva
229+ echo "COMMIT_SHA_HABANERO=$(cd scripts/ci_utils && cargo run --bin get_target_branch_commit_hash 'origin/release-habanero-*')" >> "$GITHUB_OUTPUT"
230+ echo "COMMIT_SHA_MANZANO=$(cd scripts/ci_utils && cargo run --bin get_target_branch_commit_hash 'origin/release-manzano-*')" >> "$GITHUB_OUTPUT"
231+ echo "COMMIT_SHA_CAYENNE=$(cd scripts/ci_utils && cargo run --bin get_target_branch_commit_hash 'origin/release-cayenne-*')" >> "$GITHUB_OUTPUT"
232+ env :
233+ RUST_LOG : debug
234+ - name : Download the latest build for release-habanero-* branch
235+ uses : actions/download-artifact@v7
236+ with :
237+ name : lit_node_${{ steps.get_latest_commit_sha.outputs.COMMIT_SHA_HABANERO }}
238+ run-id : ${{ steps.get_latest_workflow_run_id.outputs.LATEST_WORKFLOW_RUN_ID_HABANERO }}
239+ github-token : ${{ secrets.GITHUB_TOKEN }}
240+ path : rust/lit-node/lit-node/
241+ - name : Move the downloaded binary
242+ run : mv lit_node target/debug/lit_node_${{ steps.get_latest_commit_sha.outputs.COMMIT_SHA_HABANERO }}
243+ - name : Download the latest build for release-manzano-* branch
244+ uses : actions/download-artifact@v7
245+ with :
246+ name : lit_node_${{ steps.get_latest_commit_sha.outputs.COMMIT_SHA_MANZANO }}
247+ run-id : ${{ steps.get_latest_workflow_run_id.outputs.LATEST_WORKFLOW_RUN_ID_MANZANO }}
248+ github-token : ${{ secrets.GITHUB_TOKEN }}
249+ path : rust/lit-node/lit-node/
250+ - name : Move the downloaded binary
251+ run : mv lit_node target/debug/lit_node_${{ steps.get_latest_commit_sha.outputs.COMMIT_SHA_MANZANO }}
252+ - name : Download the latest build for release-cayenne-* branch
253+ uses : actions/download-artifact@v7
254+ with :
255+ name : lit_node_${{ steps.get_latest_commit_sha.outputs.COMMIT_SHA_CAYENNE }}
256+ run-id : ${{ steps.get_latest_workflow_run_id.outputs.LATEST_WORKFLOW_RUN_ID_CAYENNE }}
257+ github-token : ${{ secrets.GITHUB_TOKEN }}
258+ path : rust/lit-node/lit-node/
259+ - name : Move the downloaded binary
260+ run : mv lit_node target/debug/lit_node_${{ steps.get_latest_commit_sha.outputs.COMMIT_SHA_CAYENNE }}
261+ - name : Enable execute permissions for the binary
262+ run : |
263+ chmod +x target/debug/lit_node_${{ steps.get_latest_commit_sha.outputs.COMMIT_SHA_HABANERO }}
264+ chmod +x target/debug/lit_node_${{ steps.get_latest_commit_sha.outputs.COMMIT_SHA_MANZANO }}
265+ chmod +x target/debug/lit_node_${{ steps.get_latest_commit_sha.outputs.COMMIT_SHA_CAYENNE }}
266+ - name : Setup local files for testing
267+ run : make setup-local-files
219268 - name : Run acceptance, component and integration tests.
220- run : " ~/.cargo/bin/cargo-nextest nextest run --archive-file nextest-archive.tar.zst --final-status-level pass --profile integration-tests -E 'test(/^edge/) - test(/long/)' --nocapture --"
221-
222-
269+ run : " ~/.cargo/bin/cargo-nextest nextest run --archive-file nextest-archive.tar.zst --final-status-level pass --profile version-upgrade-tests -E 'test(/^upgrades/)' --partition count:${{ matrix.partition }}/3 --nocapture --"
270+
223271 # AND together the results
224272 check_status :
225273 needs :
226274 [
227275 lit_node_unit_tests,
228276 lit_node_integration_tests,
229- lit_node_other_tests ,
277+ lit_node_version_upgrade_tests ,
230278 ]
231279 runs-on : ubuntu-latest
232280 steps :
@@ -241,4 +289,10 @@ jobs:
241289 echo "Integration tests failed"
242290 exit 1
243291 fi
292+ # TODO: enable this when you want to turn on version upgrade tests
293+ # To enable, uncomment the check below (and enable the job above)
294+ # if [ ${{ needs.lit_node_version_upgrade_tests.result }} != 'success' ]; then
295+ # echo "Version upgrade tests failed"
296+ # exit 1
297+ # fi
244298 echo "All tests passed"
0 commit comments