2023-09-26 00:57:29 +03:00
|
|
|
# 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.
|
|
|
|
|
2023-09-13 11:12:12 +03:00
|
|
|
name: Run Test
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
2023-09-26 00:57:29 +03:00
|
|
|
# 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
|
2023-09-13 11:12:12 +03:00
|
|
|
inputs:
|
|
|
|
nim_wakunode_image:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
test_type:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
debug:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: ''
|
|
|
|
|
|
|
|
env:
|
2024-08-23 15:57:20 +05:30
|
|
|
NODE_JS: "20"
|
2023-09-26 00:57:29 +03:00
|
|
|
# Ensure test type conditions remain consistent.
|
2023-09-13 11:12:12 +03:00
|
|
|
WAKU_SERVICE_NODE_PARAMS: ${{ (inputs.test_type == 'go-waku-master') && '--min-relay-peers-to-publish=0' || '' }}
|
2023-09-13 11:20:50 +03:00
|
|
|
DEBUG: ${{ inputs.debug }}
|
2023-09-13 11:12:12 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
node:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
WAKUNODE_IMAGE: ${{ inputs.nim_wakunode_image }}
|
2025-01-27 21:14:34 +05:30
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
actions: read
|
|
|
|
checks: write
|
2023-09-13 11:12:12 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: waku-org/js-waku
|
|
|
|
|
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: ${{ env.NODE_JS }}
|
|
|
|
|
|
|
|
- uses: ./.github/actions/npm
|
|
|
|
|
|
|
|
- run: npm run build:esm
|
2023-09-18 19:42:22 +03:00
|
|
|
|
|
|
|
- run: ${{ (inputs.test_type == 'node-optional') && 'npm run test:optional --workspace=@waku/tests' || 'npm run test:node' }}
|
2023-09-13 11:12:12 +03:00
|
|
|
|
2025-01-27 21:14:34 +05:30
|
|
|
- name: Test Report
|
|
|
|
uses: dorny/test-reporter@v1
|
|
|
|
if: success() || failure()
|
2023-10-23 17:53:56 +03:00
|
|
|
with:
|
2025-01-28 16:24:16 +05:30
|
|
|
name: Test Report - ${{ inputs.test_type }}
|
2025-01-27 21:14:34 +05:30
|
|
|
path: 'packages/tests/reports/mocha-*.json'
|
|
|
|
reporter: mocha-json
|
|
|
|
fail-on-error: true
|
2023-10-23 17:53:56 +03:00
|
|
|
|
2023-09-13 11:12:12 +03:00
|
|
|
- name: Upload debug logs on failure
|
2025-01-28 15:44:07 +05:30
|
|
|
uses: actions/upload-artifact@v4
|
2023-09-13 11:12:12 +03:00
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: ${{ inputs.test_type }}-debug.log
|
|
|
|
path: debug.log
|
|
|
|
|
2023-12-21 09:54:31 +02:00
|
|
|
- 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
|
|
|
|
|
2023-09-13 11:12:12 +03:00
|
|
|
- name: Upload logs on failure
|
2025-01-28 15:44:07 +05:30
|
|
|
uses: actions/upload-artifact@v4
|
2023-09-13 11:12:12 +03:00
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: ${{ inputs.test_type }}-logs
|
|
|
|
path: packages/tests/log/
|