js-waku/.github/workflows/test-node.yml
Danish Arora 26ab836900
chore: upgrade nwaku to 0.34.0 and update tests suite for compatibility (#2170)
* chore: upgrade nwaku to v0.33.1

* chore: upgrade to nwaku 0.34.0

* feat: connect nwaku nodes amongst each other over relay

* chore(lightpush): use multiple service nodes for lightpush (instead of just one)
- nwaku now expects >=1 nodes at least connected

* chore: all single-node lightpush requests should now be expected to fail

* chore: update sharding tests

* chore: update tests

* chore: improve Docker network config reliability

* chore: deduplicate ecies encrypted payloads

* chore: update to precise expects

* fix: return early if expect passes

* chore: lightpush 5 times instead of 30

* fix: non duplicacy should happen in application-specific scenario

* chore: update mocha config + fix epehermal tests

* chore: reinstall deps after rebase

* chore: attempt stability for test suite

* fix: store tests to now use multiple nodes, delete uneeded test

* fix: memory leak

* chore: switch while loop with timeout-promise

* chore: remove redundant nodes startup

* chore: add delays for nwaku setup
2025-02-17 19:21:33 +05:30

129 lines
4.1 KiB
YAML

# WARNING: This workflow is used by upstream workflows (jswaku, nwaku, gowaku) via workflow_call.
# DO NOT modify the name, inputs, or other parts of this workflow that might break upstream CI.
name: Run Test
on:
workflow_call:
# IMPORTANT: Do not change the name or properties of these inputs.
# If you add new required inputs make sure that they have default value or you make the change upstream as well
inputs:
nim_wakunode_image:
required: true
type: string
test_type:
required: true
type: string
debug:
required: false
type: string
default: ''
allure_reports:
required: false
type: boolean
default: false
env:
NODE_JS: "20"
# Ensure test type conditions remain consistent.
WAKU_SERVICE_NODE_PARAMS: ${{ (inputs.test_type == 'go-waku-master') && '--min-relay-peers-to-publish=0' || '' }}
DEBUG: ${{ inputs.debug }}
GITHUB_TOKEN: ${{ secrets.DEPLOY_TEST_REPORTS_PAT }}
jobs:
node:
runs-on: ubuntu-latest
timeout-minutes: 60 # Add a 1-hour timeout to fail faster
env:
WAKUNODE_IMAGE: ${{ inputs.nim_wakunode_image }}
ALLURE_REPORTS: ${{ inputs.allure_reports }}
permissions:
contents: read
actions: read
checks: write
steps:
- uses: actions/checkout@v3
with:
repository: waku-org/js-waku
- name: Remove unwanted software
uses: ./.github/actions/prune-vm
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
- uses: ./.github/actions/npm
- run: npm run build:esm
- name: Run tests
timeout-minutes: 30
run: ${{ (inputs.test_type == 'node-optional') && 'npm run test:optional --workspace=@waku/tests' || 'npm run test:node' }}
- name: Merge allure reports
if: always() && env.ALLURE_REPORTS == 'true'
run: node ci/mergeAllureResults.cjs
- name: Get allure history
if: always() && env.ALLURE_REPORTS == 'true'
uses: actions/checkout@v3
continue-on-error: true
with:
repository: waku-org/allure-jswaku
ref: gh-pages
path: gh-pages
token: ${{ env.GITHUB_TOKEN }}
- name: Setup allure report
if: always() && env.ALLURE_REPORTS == 'true'
uses: simple-elf/allure-report-action@master
id: allure-report
with:
allure_results: allure-results
gh_pages: gh-pages
allure_history: allure-history
keep_reports: 30
- name: Deploy report to Github Pages
if: always() && env.ALLURE_REPORTS == 'true'
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ env.GITHUB_TOKEN }}
external_repository: waku-org/allure-jswaku
publish_branch: gh-pages
publish_dir: allure-history
- name: Upload debug logs on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ inputs.test_type }}-debug.log
path: debug.log
- name: Sanitize log filenames
if: failure()
run: |
find packages/tests/log/ -type f | while read fname; do
dir=$(dirname "$fname")
base=$(basename "$fname")
sanitized_base=$(echo $base | tr -d '\"*:<>?|' | sed 's/[\\/\r\n]/_/g' | sed 's/_$//')
if [ "$base" != "$sanitized_base" ]; then
mv "$fname" "$dir/$sanitized_base"
fi
done
- name: Upload logs on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ inputs.test_type }}-logs
path: packages/tests/log/
- name: Create test summary
if: always() && env.ALLURE_REPORTS == 'true'
run: |
echo "## Run Information" >> $GITHUB_STEP_SUMMARY
echo "- **NWAKU**: ${{ env.WAKUNODE_IMAGE }}" >> $GITHUB_STEP_SUMMARY
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
echo "Allure report will be available at: https://waku-org.github.io/allure-jswaku/${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY