From 4683d246ea79967770445b4d915e6a247c7d3a6a Mon Sep 17 00:00:00 2001 From: fbarbu15 Date: Tue, 12 Sep 2023 17:33:34 +0300 Subject: [PATCH] make reusable test node workflow --- .github/workflows/ci.yml | 112 ++++---------------------------- .github/workflows/test-node.yml | 21 +++--- 2 files changed, 26 insertions(+), 107 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ad1d9f6d5..b056f20118 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 - 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: "" + uses: ./.github/workflows/test-node.yml + with: + 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 - 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/ + uses: ./.github/workflows/test-node.yml + with: + 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 - 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/ + uses: ./.github/workflows/test-node.yml + with: + nim_wakunode_image: statusteam/nim-waku:deploy-wakuv2-test + test_type: nwaku_master maybe-release: name: release diff --git a/.github/workflows/test-node.yml b/.github/workflows/test-node.yml index 5fdcca15f6..858372329f 100644 --- a/.github/workflows/test-node.yml +++ b/.github/workflows/test-node.yml @@ -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/