make reusable test node workflow

This commit is contained in:
fbarbu15 2023-09-12 17:33:34 +03:00
parent c3c31b192e
commit 4683d246ea
2 changed files with 26 additions and 107 deletions

View File

@ -72,111 +72,25 @@ jobs:
uses: ./.github/workflows/test-node.yml uses: ./.github/workflows/test-node.yml
with: with:
nim_wakunode_image: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.19.0' }} nim_wakunode_image: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.19.0' }}
test_type: node
node_optional: node_optional:
runs-on: ubuntu-latest uses: ./.github/workflows/test-node.yml
env:
WAKUNODE_IMAGE: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.19.0' }}
steps:
- uses: actions/checkout@v3
with: with:
repository: waku-org/js-waku nim_wakunode_image: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.19.0' }}
test_type: node-optional
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
- uses: ./.github/actions/npm
- run: npm run build:esm
- uses: Wandalen/wretry.action@master
with:
attempt_limit: ${{ env.RETRY_ATTEMPTS }}
command: npm run test:optional --workspace=@waku/tests
with: |
DEBUG: ""
node_with_go_waku_master: node_with_go_waku_master:
runs-on: ubuntu-latest uses: ./.github/workflows/test-node.yml
env:
WAKUNODE_IMAGE: "statusteam/go-waku:latest"
WAKU_SERVICE_NODE_PARAMS: "--min-relay-peers-to-publish=0" # Can be removed once https://github.com/status-im/nwaku/issues/1004 is done
DEBUG: "waku*"
steps:
- uses: actions/checkout@v3
with: with:
repository: waku-org/js-waku nim_wakunode_image: statusteam/go-waku:latest
test_type: go_waku_master
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
- uses: ./.github/actions/npm
- run: npm run build:esm
- uses: Wandalen/wretry.action@master
with:
attempt_limit: ${{ env.RETRY_ATTEMPTS }}
command: npm run test:node
with: |
DEBUG: "waku:nwaku*,waku:test*"
- name: Upload debug logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: go-waku-debug.log
path: debug.log
- name: Upload logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: go-waku-logs
path: packages/tests/log/
node_with_nwaku_master: node_with_nwaku_master:
runs-on: ubuntu-latest uses: ./.github/workflows/test-node.yml
env:
DEBUG: "waku*"
WAKUNODE_IMAGE: "statusteam/nim-waku:deploy-wakuv2-test"
steps:
- uses: actions/checkout@v3
with: with:
repository: waku-org/js-waku nim_wakunode_image: statusteam/nim-waku:deploy-wakuv2-test
test_type: nwaku_master
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
- uses: ./.github/actions/npm
- run: npm run build:esm
- uses: Wandalen/wretry.action@master
with:
attempt_limit: ${{ env.RETRY_ATTEMPTS }}
command: npm run test:node
with: |
DEBUG: "waku:nwaku*,waku:test*"
- name: Upload debug logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: nwaku-master-debug.log
path: debug.log
- name: Upload logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: nwaku-master-logs
path: packages/tests/log/
maybe-release: maybe-release:
name: release name: release

View File

@ -1,21 +1,26 @@
name: Test Node name: Run Test
on: on:
workflow_call: workflow_call:
inputs: inputs:
nim_wakunode_image: nim_wakunode_image:
required: false required: true
type: string
test_type:
required: true
type: string type: string
env: env:
NODE_JS: "18" NODE_JS: "18"
RETRY_ATTEMPTS: 3 RETRY_ATTEMPTS: 3
WAKU_SERVICE_NODE_PARAMS: ${{ (inputs.test_type == 'go_waku_master') && '--min-relay-peers-to-publish=0' || '' }}
DEBUG: ${{ (inputs.test_type == 'go_waku_master' || inputs.test_type == 'nwaku_master') && 'waku:nwaku*,waku:test*' || 'waku*' }}
jobs: jobs:
node: node:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
WAKUNODE_IMAGE: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.19.0' }} WAKUNODE_IMAGE: ${{ inputs.nim_wakunode_image }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@ -32,20 +37,20 @@ jobs:
- uses: Wandalen/wretry.action@master - uses: Wandalen/wretry.action@master
with: with:
attempt_limit: ${{ env.RETRY_ATTEMPTS }} attempt_limit: ${{ env.RETRY_ATTEMPTS }}
command: npm run test:node command: ${{ (inputs.test_type == 'node_optional') && 'npm run test:optional --workspace=@waku/tests' || 'npm run test:node' }}
with: | with: |
DEBUG: "" DEBUG: ${{ env.DEBUG }}
- name: Upload debug logs on failure - name: Upload debug logs on failure
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: failure() if: failure()
with: with:
name: debug.log name: ${{ inputs.test_type }}-debug.log
path: debug.log path: debug.log
- name: Upload nwaku logs on failure - name: Upload logs on failure
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: failure() if: failure()
with: with:
name: nwaku-logs name: ${{ inputs.test_type }}-logs
path: packages/tests/log/ path: packages/tests/log/