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
with:
nim_wakunode_image: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.19.0' }}
test_type: node
node_optional:
runs-on: ubuntu-latest
env:
WAKUNODE_IMAGE: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.19.0' }}
steps:
- uses: actions/checkout@v3
uses: ./.github/workflows/test-node.yml
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
- uses: Wandalen/wretry.action@master
with:
attempt_limit: ${{ env.RETRY_ATTEMPTS }}
command: npm run test:optional --workspace=@waku/tests
with: |
DEBUG: ""
nim_wakunode_image: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.19.0' }}
test_type: node-optional
node_with_go_waku_master:
runs-on: ubuntu-latest
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
uses: ./.github/workflows/test-node.yml
with:
repository: waku-org/js-waku
- 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/
nim_wakunode_image: statusteam/go-waku:latest
test_type: go_waku_master
node_with_nwaku_master:
runs-on: ubuntu-latest
env:
DEBUG: "waku*"
WAKUNODE_IMAGE: "statusteam/nim-waku:deploy-wakuv2-test"
steps:
- uses: actions/checkout@v3
uses: ./.github/workflows/test-node.yml
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
- 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/
nim_wakunode_image: statusteam/nim-waku:deploy-wakuv2-test
test_type: nwaku_master
maybe-release:
name: release

View File

@ -1,21 +1,26 @@
name: Test Node
name: Run Test
on:
workflow_call:
inputs:
nim_wakunode_image:
required: false
required: true
type: string
test_type:
required: true
type: string
env:
NODE_JS: "18"
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:
node:
runs-on: ubuntu-latest
env:
WAKUNODE_IMAGE: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.19.0' }}
WAKUNODE_IMAGE: ${{ inputs.nim_wakunode_image }}
steps:
- uses: actions/checkout@v3
with:
@ -32,20 +37,20 @@ jobs:
- uses: Wandalen/wretry.action@master
with:
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: |
DEBUG: ""
DEBUG: ${{ env.DEBUG }}
- name: Upload debug logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: debug.log
name: ${{ inputs.test_type }}-debug.log
path: debug.log
- name: Upload nwaku logs on failure
- name: Upload logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: nwaku-logs
name: ${{ inputs.test_type }}-logs
path: packages/tests/log/